Table of Contents

Class NDListArray

Namespace
NumSharp
Assembly
NumSharp.dll

NumPy's object array of Python lists — what np.char.split, rsplit and splitlines return (array([list(['a', 'b']), list([])], dtype=object)). NumSharp has no object dtype, so this type holds the array's elements as list ids (NumPy's object pointers) into a shared store of the lists: the text of the pieces once, each piece with its exact length.

public sealed class NDListArray : IEnumerable, IDisposable
Inheritance
NDListArray
Implements
Inherited Members

Remarks

Element access. The indexer is NumPy's: a full integer index (one integer per axis, negative values counting from the end) returns the element's LIST as a 0-d NDListArray that stands for it (NumSharp.NDListArray.IsStandIn), every other index a list array over the selected lists (a view for slices). The list's pieces come out as .NET values from item(params long[]) and tolist(), every piece exact. Iterating a 1-d list array yields each element's list as a NEW 1-D array of the input's string class — S / U as wide as its longest piece (at least 1), or StringDType for a StringDType input — which is the closest NumSharp value to NumPy's Python list; a piece that ENDS in a NUL loses it in that array, as every fixed-width element does (np.array(['a\x00']) reads 'a' in NumPy too).

Lifetime. The arrays the type holds are NumSharp arrays: Dispose() releases them at once (the shared lists when the last array pointing at them is disposed), the finalizers release them otherwise. A view keeps the memory it reads alive (it counts its own references).

Properties

this[object[]]

NumPy's indexing of an object array of lists (ndarray.getitem / ndarray.setitem) as the one C# indexer: every index NumPy takes — integers, slices, slice notation ("1:", "::-1, 0"), index arrays, boolean masks and sequences, in any mix.

public NDListArray this[params object[] key] { get; set; }

Parameters

key object[]

The index tuple, as for this[object[]] (a lone string holds the whole index in slice notation; a Slice[] or object[] passed alone is the tuple itself).

Property Value

NDListArray

GET: a list array over the selected lists — a VIEW for an index of integers and slices (the lists are shared, as a NumPy view shares the pointers), a new array of the same lists for an index array or a mask (NumPy's advanced indexing copies the pointers, not the lists). One integer per axis is NumPy's element access, which returns the LIST itself: a 0-d array marked as its stand-in (NumSharp.NDListArray.IsStandIn). Read the list's pieces with item(params long[]) or tolist(). SET: NumPy's a[index] = value of an object array (see SetItem(Slice[], NDListArray)): one integer per axis stores the list a 0-d value stands for, a sub-array or an advanced selection receives a list array's lists by broadcasting.

Remarks

One member, NumPy's signature: it replaced this[string], this[params Slice[]] and the element forms NDArray this[params long[]] / this[params int[]], which returned the element's pieces as a new array (iterating a 1-d list array still yields those arrays, see GetEnumerator()).

Exceptions

ArgumentNullException

key is null; SET: a null value (Python's None has no NDListArray form).

IndexError

An integer outside its axis (NumPy's index 5 is out of bounds for axis 0 with size 2), or an invalid index (NumPy's texts).

ValueError

SET: a read-only array (assignment destination is read-only, checked before the index), or a value that does not broadcast (could not broadcast input array from shape (3,) into shape (2,), or NumPy's shape mismatch text for an advanced index).

NotSupportedException

SET: an assignment whose NumPy result holds an element that is not a list (an array stored into one element, a list's items stored into a sub-array, a list of the other piece class).

ObjectDisposedException

The array or the value was disposed.

Shape

The outer shape as a NumSharp Shape (dimensions only: the lists have no strides).

public Shape Shape { get; }

Property Value

Shape

T

NumPy's T: the transposed view (the axes reversed), sharing the lists.

public NDListArray T { get; }

Property Value

NDListArray

Exceptions

ObjectDisposedException

The array was disposed.

base

NumPy's base: the list array owning the pointers this one views — the array a view was taken from (a view of a view gives that owner, as in NumPy), or NumPy's intermediate copy for a view of one (a reshape in the other order) — or null for an array that owns its pointers (a copy, a take, a repeat).

public NDListArray @base { get; }

Property Value

NDListArray

Remarks

Each read is a NEW list array over the owner's pointers and the shared lists (new references, released by its Dispose()), as base is a new array over its owner's storage; NumPy returns the owner object itself.

Exceptions

ObjectDisposedException

The array was disposed.

device

NumPy's device (the Array API's): always "cpu".

public string device { get; }

Property Value

string

flags

NumPy's flags of the outer array: C / F contiguity, OWNDATA (a copy owns its pointers, a view does not), WRITEABLE (false for a diagonal view, as in NumPy) and ALIGNED — the flags of the id array, which has the object array's layout.

public NDArrayFlags flags { get; }

Property Value

NDArrayFlags

Remarks

The object is the flags of the id array: reading it is NumPy's answer, and setting WRITEABLE through it (flags.writeable = false, or setflags(bool?, bool?, bool?)) guards the element assignments as NumPy's does.

Exceptions

ObjectDisposedException

The array was disposed.

flat

NumPy's flat, as NumSharp spells it for an NDArray: the elements as a 1-D list array in C order (a view when the layout allows, else a copy of the pointers; the lists are shared).

public NDListArray flat { get; }

Property Value

NDListArray

Exceptions

ObjectDisposedException

The array was disposed.

imag

NumPy's imag of an object array: a new READ-ONLY array of the int 0 — which a list array cannot hold, except an empty one.

public NDListArray imag { get; }

Property Value

NDListArray

An empty read-only list array for an empty array.

Exceptions

NotSupportedException

A non-empty array (NumPy's elements are ints).

ObjectDisposedException

The array was disposed.

itemsize

NumPy's itemsize of an object array: 8, the size of one element's pointer.

public int itemsize { get; }

Property Value

int

mT

NumPy's mT: the view with the last two axes swapped.

public NDListArray mT { get; }

Property Value

NDListArray

Exceptions

ArgumentException

Fewer than two axes (matrix transpose with ndim < 2 is undefined, NumPy's ValueError text under mT's type).

ObjectDisposedException

The array was disposed.

nbytes

NumPy's nbytes of an object array: size * 8 (the pointers, not the lists they point to).

public long nbytes { get; }

Property Value

long

Exceptions

ObjectDisposedException

The array was disposed.

ndim

NumPy's ndim: the number of axes.

public int ndim { get; }

Property Value

int

real

NumPy's real of an object array: the array ITSELF (a.real is a), so the caller must not dispose it separately.

public NDListArray real { get; }

Property Value

NDListArray

Exceptions

ObjectDisposedException

The array was disposed.

shape

NumPy's shape (a copy, NumPy's tuple).

public long[] shape { get; }

Property Value

long[]

size

NumPy's size: the number of elements (lists).

public long size { get; }

Property Value

long

strides

NumPy's strides in bytes: an object array steps 8 bytes per element (one pointer), and the range arrays are int64, so a view's strides are NumPy's (a transpose of a (2, 3) array is (8, 24)).

public long[] strides { get; }

Property Value

long[]

Exceptions

ObjectDisposedException

The array was disposed.

Methods

Dispose()

Releases the ids this list array holds and its reference on the lists (a view releases only its own).

public void Dispose()

Equals(object)

Reference equality, as for NDArray: the operators compare elements, these compare objects.

public override bool Equals(object obj)

Parameters

obj object

The other object.

Returns

bool

True for the same list array object.

GetEnumerator()

Iterates the first axis: for a 1-d array every element's list as a new 1-D array of its pieces (S / U as wide as the longest piece, or StringDType), for an N-d array every sub-array as an NDListArray view.

public IEnumerator GetEnumerator()

Returns

IEnumerator

The enumerator.

Exceptions

TypeError

A 0-d array (iteration over a 0-d array).

ObjectDisposedException

The array was disposed.

GetHashCode()

The object's identity hash (see Equals(object)).

public override int GetHashCode()

Returns

int

The hash.

ToString()

NumPy's str(): [list(['a', 'b']) list(['c'])], each element list( + the Python repr of its list + ), wrapped and summarized as NumPy's _formatArray does; a 0-d array prints its list (['a', 'b']).

public override string ToString()

Returns

string

The text.

ToString(bool)

NumPy's str() (repr false) or repr() (true): the repr is array([list(['a', 'b']), list([])], dtype=object), with shape= for an empty array of another shape than (0,) and for a summarized one.

public string ToString(bool repr)

Parameters

repr bool

True for repr().

Returns

string

The text.

Exceptions

ObjectDisposedException

The array was disposed.

all(int?, NDArray, bool, NDArray)

NumPy's all(axis=None, out=None, keepdims=False, *, where=True): whether every list is non-empty (Python's truth of a list), reduced as NDArray's all(int?, NDArray, bool, NDArray) reduces a bool array.

public NDArray all(int? axis = null, NDArray @out = null, bool keepdims = false, NDArray where = null)

Parameters

axis int?

The axis, or null for every element.

out NDArray

NumPy's out=: a bool (or castable) array of the result's shape.

keepdims bool

Keep the reduced axis as length 1.

where NDArray

NumPy's where= mask.

Returns

NDArray

A 0-d bool for axis=None, else the reduced bool array (or out).

Exceptions

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

Exception

NDArray.all's own errors for out and where.

any(int?, NDArray, bool, NDArray)

NumPy's any(axis=None, out=None, keepdims=False, *, where=True): whether some list is non-empty (see all(int?, NDArray, bool, NDArray)).

public NDArray any(int? axis = null, NDArray @out = null, bool keepdims = false, NDArray where = null)

Parameters

axis int?

The axis, or null for every element.

out NDArray

NumPy's out=.

keepdims bool

Keep the reduced axis as length 1.

where NDArray

NumPy's where= mask.

Returns

NDArray

A 0-d bool for axis=None, else the reduced bool array (or out).

Exceptions

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

Exception

NDArray.any's own errors for out and where.

argmax(int?, NDArray, bool)

NumPy's argmax(axis=None, out=None, *, keepdims=False): the index of the FIRST greatest list (Python's list order) of the flattened array or along axis — OBJECT_argmax's scan, one pass per line.

public NDArray argmax(int? axis = null, NDArray @out = null, bool keepdims = false)

Parameters

axis int?

The axis, or null for the flattened array.

out NDArray

NumPy's out= (an int64-castable array of the result's shape).

keepdims bool

Keep the reduced axis as length 1.

Returns

NDArray

A 0-d int64 for axis=None, else the int64 indices (or out).

Exceptions

ValueError

An empty array (attempt to get argmax of an empty sequence), or NDArray's out= errors.

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

argmin(int?, NDArray, bool)

NumPy's argmin(axis=None, out=None, *, keepdims=False): the index of the FIRST smallest list (OBJECT_argmin's scan; see argmax(int?, NDArray, bool)).

public NDArray argmin(int? axis = null, NDArray @out = null, bool keepdims = false)

Parameters

axis int?

The axis, or null for the flattened array.

out NDArray

NumPy's out=.

keepdims bool

Keep the reduced axis as length 1.

Returns

NDArray

A 0-d int64 for axis=None, else the int64 indices (or out).

Exceptions

ValueError

An empty array (attempt to get argmin of an empty sequence).

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

argpartition(NDArray, int?, string, string)

NumPy's argpartition(kth, axis=-1, kind='introselect', order=None): after NumPy's checks, the default argsort of every line (an object array has no selection function); a 0-d array is ravelled to one element first, as NumPy's argument-side axis check does.

public NDArray argpartition(NDArray kth, int? axis = -1, string kind = "introselect", string order = null)

Parameters

kth NDArray

NumPy's kth: one index or a sequence of them (see partition(NDArray, int, string, string)).

axis int?

The axis, or null for the flattened array.

kind string

Must be 'introselect'.

order string

Must be null.

Returns

NDArray

The int64 indices.

Remarks

One overload, NumPy's signature (see partition(NDArray, int, string, string)).

Exceptions

ArgumentNullException

kth is null.

ValueError

The kind, an order, a bool kth, a kth of two or more dimensions, or a kth outside the axis.

TypeError

A kth array that is not integer.

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

argsort(int?, string, object, bool?)

NumPy's argsort(axis=-1, kind=None, order=None, *, stable=None): the int64 indices that sort every line (C-ordered, the array's shape); axis null sorts the flattened (C-order) array.

public NDArray argsort(int? axis = -1, string kind = null, object order = null, bool? stable = null)

Parameters

axis int?

The axis, or null for the flattened array.

kind string

See sort(int, string, object, bool?).

order object

Must be null.

stable bool?

NumPy's stable=.

Returns

NDArray

The indices.

Exceptions

ValueError

An unknown kind, kind with stable, or an order.

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

astype(DType, char, string, bool, bool)

NumPy's astype(dtype, order='K', casting='unsafe', subok=True, copy=True) of an object array of lists (see the file header): bool is each list's truth, StringDType its str(); every other dtype is NumPy's conversion error for the first element, and an empty array the empty array of the dtype.

public NDArray astype(DType dtype, char order = 'K', string casting = "unsafe", bool subok = true, bool copy = true)

Parameters

dtype DType

The target dtype.

order char

'C', 'F', 'A' or 'K' (any case): the result's layout.

casting string

The casting rule: only 'unsafe' allows a cast from object.

subok bool

NumPy's subok (the result is never a subclass here).

copy bool

NumPy's copy (a conversion always makes a new array).

Returns

NDArray

The converted array.

Exceptions

ArgumentNullException

dtype is null.

ValueError

An unknown order or casting name; a float, S or U dtype for a non-empty array (setting an array element with a sequence. / without the period for text).

TypeError

A rule other than 'unsafe' (Cannot cast array data from dtype('O') to dtype('bool') according to the rule 'safe'); an integer or complex dtype for a non-empty array.

ObjectDisposedException

The array was disposed.

byteswap(bool)

NumPy's byteswap(inplace=False) of an object array: pointers are not swapped, so it is a copy in 'A' order (an F-contiguous array stays F), or — in place — the array itself.

public NDListArray byteswap(bool inplace = false)

Parameters

inplace bool

Swap in place (returns this array).

Returns

NDListArray

The copy, or this array.

Exceptions

ValueError

In place on a read-only array (array to be byte-swapped is read-only).

ObjectDisposedException

The array was disposed.

choose(object, NDArray, string)

NumPy's choose(choices, out=None, mode='raise') with this array as the INDEX array: an object array does not cast to intp safely, so after the mode check it is always NumPy's TypeError.

public NDArray choose(object choices, NDArray @out = null, string mode = "raise")

Parameters

choices object

The choice arrays (never read).

out NDArray

The destination (never written).

mode string

"raise", "wrap" or "clip".

Returns

NDArray

Never returns.

Exceptions

ValueError

A bad mode.

TypeError

Cannot cast array data from dtype('O') to dtype('int64') according to the rule 'safe'.

ObjectDisposedException

The array was disposed.

clip(object, object, NDListArray, DType, NDArray)

NumPy's clip(min=None, max=None, out=None, **kwargs) of lists — NumPy's _clip: np.maximum with min (a list below it becomes it), np.minimum with max, np.clip with both, np.positive with neither, element by element over the broadcast operands, by Python's list order.

public NDListArray clip(object min = null, object max = null, NDListArray @out = null, DType dtype = null, NDArray where = null)

Parameters

min object

The lower bounds (a list array, broadcast), a Python value, or null.

max object

The upper bounds, or null.

out NDListArray

A list array to store into, or null: the broadcast of every operand (it may be larger than the inputs, which then broadcast to it; it is never stretched itself).

dtype DType

The ufunc's dtype= (null: the object loop). Every other loop needs the object array cast to it under same_kind, which NumPy refuses, so a non-null dtype always raises (see the exceptions).

where NDArray

The ufunc's where= mask (null, or the C# literal true, for none; a bool array that broadcasts with the operands): the loop runs only where it is true, and out keeps its lists elsewhere.

Returns

NDListArray

The clipped lists (a 0-d list array stands for NumPy's list), or out.

Remarks

One overload, NumPy's signature with the two keywords of its **kwargs that NumSharp's clip(NDArray, NDArray, NDArray, DType, NDArray) takes. The checks run in the ufunc's order: the dtype's class, the bounds' conversion, out, where, the loop, the broadcast.

Exceptions

IncorrectShapeException

The operands do not broadcast (NumPy's text: every operand's shape, out and where included).

ValueError

A read-only out (output array is read-only), or one of another shape than the broadcast (non-broadcastable output operand with shape (1,) doesn't match the broadcast shape (4,)).

ArgumentException

A where that is not bool (the house type of NumPy's Cannot cast array data from dtype('int64') to dtype('bool') according to the rule 'safe').

TypeError

A bound that is not a list ('>=' not supported between instances of 'list' and 'str'), an unorderable item pair, or no bound at all (np.positive of a list: bad operand type for unary +: 'list') — each only where the loop runs; a dtype: NumPy's refusal of the descriptor as a ufunc argument, No loop matching the specified signature and casting was found for ufunc clip (text dtypes), or Cannot cast ufunc 'clip' input 0 from dtype('O') to dtype('float64') with casting rule 'same_kind'.

NotSupportedException

A new result with masked-off elements (NumPy leaves them None, which a list array cannot hold); a bound with no NumSharp array form.

ObjectDisposedException

The array or out was disposed.

compress(NDArray, int?, NDListArray)

NumPy's compress(condition, axis=None, out=None): the lists where condition is true (of the flattened array, or the slices along axis).

public NDListArray compress(NDArray condition, int? axis = null, NDListArray @out = null)

Parameters

condition NDArray

A 1-D bool array (a shorter one selects its prefix; a longer one with a true entry past the end is NumPy's IndexError).

axis int?

The axis, or null for the flattened array.

out NDListArray

A list array of the result's shape to store into (NumPy's compress is a take of the condition's nonzero indices, so its checks and texts are take's), or null.

Returns

NDListArray

The selected lists (a copy of the pointers), or out.

Exceptions

IndexError

A true entry past the axis (index 6 is out of bounds for axis 0 with size 6).

AxisError

An axis outside the array.

ValueError

An out of another shape (output array does not match result of ndarray.take) or a read-only one.

NotSupportedException

An out of the other piece class.

ObjectDisposedException

The array was disposed.

conj(NDListArray)

NumPy's conj() of lists: the conjugate ufunc's object loop looks for a conjugate method a list does not have (an empty array gives an empty result).

public NDListArray conj(NDListArray @out = null)

Parameters

out NDListArray

NumPy's positional out (see conjugate(NDListArray)), or null.

Returns

NDListArray

An empty result (or out) when the loop visits no element.

Remarks

One member: NumPy's ndarray.conj is conjugate's alias (see it for out).

Exceptions

TypeError

loop of ufunc does not support argument 0 of type list which has no callable conjugate method.

ValueError

A read-only out, or one the array does not broadcast to.

IncorrectShapeException

The array and out do not broadcast.

ObjectDisposedException

The array or out was disposed.

conjugate(NDListArray)

NumPy's conjugate() of lists — np.conjugate(self, out): the object loop's TypeError at the first element it visits; an empty broadcast gives an empty result (or out untouched).

public NDListArray conjugate(NDListArray @out = null)

Parameters

out NDListArray

NumPy's out, which array_conjugate parses positionally only (its documented signature has none; a keyword is NumPy's TypeError): a list array the array broadcasts to (it may be larger, it is never stretched), or null.

Returns

NDListArray

An empty result (or out) when the loop visits no element.

Exceptions

TypeError

The object loop's TypeError when it visits an element.

ValueError

A read-only out (output array is read-only, checked first); an out of another shape than the broadcast (non-broadcastable output operand with shape (1,) doesn't match the broadcast shape (0,)).

IncorrectShapeException

The array and out do not broadcast (operands could not be broadcast together with shapes (4,) (3,) ), checked before the loop.

ObjectDisposedException

The array or out was disposed.

copy(char)

NumPy's copy(order='C'): a SHALLOW copy — new pointers in order, the same lists (NumSharp's lists cannot be changed in place, so sharing them is invisible but for the memory saved).

public NDListArray copy(char order = 'C')

Parameters

order char

'C', 'F', 'A' or 'K'.

Returns

NDListArray

The copy (it owns its pointers: no base).

Exceptions

ValueError

An order NumPy does not take.

ObjectDisposedException

The array was disposed.

cumprod(int?, DType, NDListArray)

NumPy's cumprod(axis=None, dtype=None, out=None) of lists: the first element of each line is itself, the second multiplies (CPython's TypeError).

public NDListArray cumprod(int? axis = null, DType dtype = null, NDListArray @out = null)

Parameters

axis int?

The axis, or null for the flattened array.

dtype DType

NumPy's loop dtype (see cumsum(int?, DType, NDListArray)).

out NDListArray

A list array to store into, or null (see cumsum(int?, DType, NDListArray)).

Returns

NDListArray

The result (for lines of at most one element), or out.

Remarks

One overload, NumPy's signature (see cumsum(int?, DType, NDListArray)).

Exceptions

AxisError

An axis outside the array.

TypeError

can't multiply sequence by non-int of type 'list' for a line of two or more; a refused dtype, or an integer / complex one over lists.

ValueError

A read-only out, or one that does not fit (see cumsum(int?, DType, NDListArray)); a float dtype over lists.

NotSupportedException

A non-list result (see cumsum(int?, DType, NDListArray)).

ObjectDisposedException

The array or out was disposed.

cumsum(int?, DType, NDListArray)

NumPy's cumsum(axis=None, dtype=None, out=None) of lists: the running concatenation along axis (the flattened C-order array for null); the result has the array's shape in its memory order (a 1-D array for null).

public NDListArray cumsum(int? axis = null, DType dtype = null, NDListArray @out = null)

Parameters

axis int?

The axis, or null for the flattened array.

dtype DType

NumPy's loop dtype: null (the object loop), or a dtype NumPy converts the lists to (see sum(int?, DType, NDListArray, bool, object, NDArray); this C method passes the dtype's TYPE NUMBER, so a sized or byte-swapped descriptor names its class here, where sum(int?, DType, NDListArray, bool, object, NDArray) refuses it).

out NDListArray

A list array to store into, or null: the running lists of each line are written over its first elements along the axis, NumPy's accumulate rules deciding what fits (see the remarks).

Returns

NDListArray

The running concatenations, or out.

Remarks

One overload, NumPy's signature.

PyUFunc_Accumulate takes one of two routes, with different out checks: a 1-D object accumulation into an out that does not overlap the array runs without an iterator — an empty array or an empty out returns out untouched, any other shape than the array's is "the wrong size" —; everything else (two or more dimensions, a dtype cast, an overlapping out) builds NumPy's outer iterator, whose texts are reproduced, and whose out may have MORE axes (the extra ones are read at index 0) or broadcast the array. NumPy 2.4.2 crashes the process for a 0-d out on the first route; NumSharp reports it as the wrong size ([Misaligned]).

Exceptions

AxisError

An axis outside the array.

ValueError

A read-only out (output array is read-only); an out that does not fit (provided out is the wrong size for the accumulation., or the iterator's operands could not be broadcast together with remapped shapes [original->remapped]: ... / non-broadcastable output operand with shape ... [remapped to ...] ... / Iterator input op_axes[0][0] (==1) is not a valid axis of op[0], which has 1 dimensions); a float dtype over lists.

TypeError

A StringDType dtype, a dtype without a loop, or an integer / complex one over lists (see sum(int?, DType, NDListArray, bool, object, NDArray)).

NotSupportedException

A non-list result (every result of a dtype NumPy computes over at least one list, or its empty result without out).

ObjectDisposedException

The array or out was disposed.

diagonal(int, int, int)

NumPy's diagonal(offset=0, axis1=0, axis2=1): the READ-ONLY view of the lists on a diagonal.

public NDListArray diagonal(int offset = 0, int axis1 = 0, int axis2 = 1)

Parameters

offset int

The diagonal's offset from the main one (positive above).

axis1 int

The first axis of the 2-D sub-arrays.

axis2 int

The second axis.

Returns

NDListArray

The view (WRITEABLE false, as NumPy's).

Exceptions

ValueError

Fewer than two axes (diag requires an array of at least two dimensions), or equal axes.

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

dot(object, NDListArray)

NumPy's dot(b, out=None) of an object array of lists (OBJECT_dot): a 0-d operand multiplies (each list repeated); otherwise each output is the sum (concatenation, in k order) of a[..., k] * b[..., k, ...] over this array's last axis and b's second-to-last (its only one for 1-D).

public NDListArray dot(object b, NDListArray @out = null)

Parameters

b object

The other operand: an integer / bool array or C# number (repeat counts), or a list array / another value (CPython's TypeError for the first product).

out NDListArray

A C-contiguous, writeable list array of the result's shape to store into, or null.

Returns

NDListArray

The result (a 0-d list array for two 1-D operands: NumPy's list), or out.

Exceptions

IncorrectShapeException

The shapes are not aligned (shapes (2,3) and (2,) not aligned: 3 (dim 1) != 2 (dim 0)), or a multiply's operands do not broadcast.

ValueError

An unusable out (output array is not acceptable (must have the right datatype, number of dimensions, and be a C-Array), output array has wrong dimensions).

TypeError

A product a list does not take (can't multiply sequence by non-int of type 'list').

OverflowException

A count past a C ssize_t.

OutOfMemoryException

A product that cannot be allocated.

NotSupportedException

An empty contraction (NumPy's int 0 per output).

ObjectDisposedException

The array was disposed.

fill(object)

NumPy's fill(value): every element becomes the SAME list (NumPy stores one object in every element).

public void fill(object value)

Parameters

value object

The list: a 0-d NDListArray (as lists["1"] or lists.max() give), or a C# sequence of string pieces (a list of str) or byte[] pieces (a list of bytes).

Exceptions

ValueError

A read-only array (assignment destination is read-only, checked first).

NotSupportedException

A value that is not one list (NumPy stores any object: an ndarray, a number, a str, None), or a list of the other piece class.

ObjectDisposedException

The array or the value was disposed.

flatten(char)

NumPy's flatten(order='C'): a 1-D COPY (the lists shared, the pointers copied).

public NDListArray flatten(char order = 'C')

Parameters

order char

'C', 'F', 'A' or 'K'.

Returns

NDListArray

The flattened copy.

Exceptions

ValueError

An order NumPy does not take.

ObjectDisposedException

The array was disposed.

getfield(DType, int)

NumPy's getfield(dtype, offset=0) of an object array: only the object dtype at offset 0 is a field of it, and NumSharp has no object dtype, so every dtype it can spell is _getfield_is_safe's TypeError.

public NDListArray getfield(DType dtype, int offset = 0)

Parameters

dtype DType

The field's dtype. Null is Python's None, which NumPy's dtype converter reads as float64, refused like any other.

offset int

The field's byte offset.

Returns

NDListArray

Never returns.

Exceptions

TypeError

Cannot get/set field of an object array.

ObjectDisposedException

The array was disposed.

item(params long[])

NumPy's item(*args): the list of one element as a .NET list of its pieces (string for str pieces, byte[] for bytes pieces), every piece exact — no argument for the element of a one-element array, ONE integer for a flat index in C order (negative from the end), one integer per axis for a full index.

public List<object> item(params long[] index)

Parameters

index long[]

None (lists.item()), a flat index, or one integer per axis; a C# long[] is NumPy's index tuple (a.item((1, 2))).

Returns

List<object>

The list.

Remarks

One member, NumPy's signature: the params array is NumPy's *args, so the no-argument form is this member with an empty array.

Exceptions

ValueError

No argument and more or fewer than one element (NumPy's can only convert an array of size 1 to a Python scalar); neither one integer nor one per axis (incorrect number of indices for array).

IndexError

An index outside the array (index 6 is out of bounds for size 6 for a flat index, index 5 is out of bounds for axis 1 with size 3 for a full one).

ObjectDisposedException

The array was disposed.

SystemError

A U piece holds a code unit above U+10FFFF.

max(int?, NDListArray, bool, object, NDArray)

NumPy's max(axis=None, out=None, keepdims=False, initial=<no value>, where=True): the greatest list in Python's list order (a tie keeps the first visited), see the file header for the order and the rules.

public NDListArray max(int? axis = null, NDListArray @out = null, bool keepdims = false, object initial = null, NDArray where = null)

Parameters

axis int?

The axis, or null for every element.

out NDListArray

A list array of the result's shape to store into, or null.

keepdims bool

Keep the reduced axes as length 1.

initial object

The start of the fold: a Python list (an NDListArray of one element, or a C# sequence of string / byte[] pieces), or another Python value (it raises CPython's TypeError when compared with a list); null for none.

where NDArray

NumPy's where= mask (null, or the C# literal true, for none).

Returns

NDListArray

The result list array (out when given).

Exceptions

ValueError

An empty slice without initial; a mask without initial; NumPy's out= errors.

AxisError

An axis outside the array.

TypeError

A comparison of a str item with a bytes item, or of a list with a non-list initial.

NotSupportedException

A result element that is not a list (a non-list initial over an empty slice).

ObjectDisposedException

The array was disposed.

mean(int?, DType, NDArray, bool, NDArray)

NumPy's mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True) of lists (NumPy's _mean): the sum divided by the count. Whole-array: the concatenated list divided by NumPy's intp count — an empty list is an empty float64 array, a list of str or bytes NumPy's divide TypeError, an empty array NaN; along an axis (or with keepdims): each list divided in the object loop, CPython's TypeError; into out: NumPy's sum stored into it first (see the remarks).

public NDArray mean(int? axis = null, DType dtype = null, NDArray @out = null, bool keepdims = false, NDArray where = null)

Parameters

axis int?

The axis, or null for every element.

dtype DType

NumPy's loop dtype: null (the object loop), or a dtype NumPy converts the lists to before it sums them (the bool loop sums their truths; the others fail at the first list).

out NDArray

NumPy's out=: an array of the result's shape that receives the mean (returned), or null.

keepdims bool

Keep the reduced axes as length 1.

where NDArray

NumPy's where= mask: the object loop has no identity for it (ValueError over any list), a dtype loop reduces the selected elements and divides by the per-output counts.

Returns

NDArray

The NumPy values a list array's mean has (a 0-d NaN, an empty float64 array, a value of dtype), or out.

Remarks

One overload, NumPy's signature. _mean is _count_reduce_items (the axis and the mask's broadcast), ret = umr_sum(arr, axis, dtype, out, keepdims, where=where), then true_divide(ret, rcount, out=ret, casting='unsafe'). With out the object sum casts each output's first list into it — NumPy's conversion error for a numeric or text out — except a bool out, which takes the list's truth and adds the next list to it (CPython's TypeError); an output that sums no list holds the identity 0, divided by 0 in the out's dtype (NaN, NumPy's unsafe NaN cast for an integer, True for a bool).

Exceptions

TypeError

ufunc 'divide' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' (whole array); unsupported operand type(s) for /: 'list' and 'int' (along an axis); a list stored into an integer or complex out or dtype (int() argument must be ... not 'list', must be real number, not list); two lists added in a bool out; a refused or loop-less dtype (see sum(int?, DType, NDListArray, bool, object, NDArray)); a StringDType out.

ValueError

A mask in the object loop (add has no identity for it); a list stored into a float or text out or dtype (setting an array element with a sequence.); NumPy's out= checks (read-only, rank, shape).

DivideByZeroException

An empty slice along an axis (NumPy's ZeroDivisionError, division by zero).

AxisError

An axis outside the array (a 0-d array has none).

NotSupportedException

NumPy's result is an object array (an empty result along an axis).

ObjectDisposedException

The array was disposed.

min(int?, NDListArray, bool, object, NDArray)

NumPy's min(...): the smallest list (see max(int?, NDListArray, bool, object, NDArray)).

public NDListArray min(int? axis = null, NDListArray @out = null, bool keepdims = false, object initial = null, NDArray where = null)

Parameters

axis int?

The axis, or null for every element.

out NDListArray

A list array of the result's shape to store into, or null.

keepdims bool

Keep the reduced axes as length 1.

initial object

The start of the fold (see max(int?, NDListArray, bool, object, NDArray)), or null.

where NDArray

NumPy's where= mask.

Returns

NDListArray

The result list array.

Exceptions

ValueError

An empty slice or a mask without initial; out= errors.

AxisError

An axis outside the array.

TypeError

An unorderable pair.

NotSupportedException

A result element that is not a list.

ObjectDisposedException

The array was disposed.

nonzero()

NumPy's nonzero(): the indices of the non-empty lists, one int64 array per axis, in C order.

public NDArray[] nonzero()

Returns

NDArray[]

The index arrays (one for a 0-d array, as NumPy's 0-d nonzero gives).

Exceptions

ObjectDisposedException

The array was disposed.

partition(NDArray, int, string, string)

NumPy's in-place partition(kth, axis=-1, kind='introselect', order=None): an object array has no selection function, so after NumPy's checks every line is SORTED with the default kind (each kth element is then in its final place, as the partition promises).

public void partition(NDArray kth, int axis = -1, string kind = "introselect", string order = null)

Parameters

kth NDArray

NumPy's kth: one index or a sequence of them (negative from the end), whose elements land in their sorted places. A C# integer (lists.partition(1)) or integer array (new long[] { 0, 2 }) converts to the array NumPy's PyArray_IntpConverter reads; an integer NDArray of at most one dimension is taken as it is.

axis int

The axis (negative from the end).

kind string

Must be 'introselect'.

order string

Must be null (an object array has no fields).

Remarks

One overload, NumPy's signature: NumPy's kth is an int or an int sequence, which a single NDArray parameter receives through NumSharp's implicit conversions (a C# literal is a Python int, a C# array a Python sequence), so the kth-shaped overloads this member used to have add nothing.

Exceptions

ArgumentNullException

kth is null.

ValueError

select kind must be 'introselect' (got 'x'), an order, a kth of two or more dimensions (object too deep for desired array), a bool kth (Booleans unacceptable as partition index), a read-only array (partition array is read-only), or a kth outside the axis (kth(=5) out of bounds (4)) — in NumPy's order.

TypeError

A kth array that is not integer (Partition index must be integer).

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

prod(int?, DType, NDListArray, bool, object, NDArray)

NumPy's prod(axis=None, dtype=None, out=None, keepdims=False, initial=<no value>, where=True) of lists: a slice of one list is that list, two or more are list * list (CPython's TypeError).

public NDListArray prod(int? axis = null, DType dtype = null, NDListArray @out = null, bool keepdims = false, object initial = null, NDArray where = null)

Parameters

axis int?

The axis, or null for every element.

dtype DType

NumPy's loop dtype: null (the object loop), or a dtype NumPy converts the lists to (see sum(int?, DType, NDListArray, bool, object, NDArray)).

out NDListArray

A list array of the result's shape to store into, or null.

keepdims bool

Keep the reduced axes as length 1.

initial object

The start of the fold: an int repeats the first list (Python's n * list), a list multiplies (TypeError), null for none.

where NDArray

NumPy's where= mask.

Returns

NDListArray

The result list array.

Remarks

One overload, NumPy's signature (see sum(int?, DType, NDListArray, bool, object, NDArray) for dtype).

Exceptions

ValueError

A mask without initial (the object loop); out= errors; a float dtype over lists.

AxisError

An axis outside the array.

TypeError

can't multiply sequence by non-int of type 'list'; a refused dtype (see sum(int?, DType, NDListArray, bool, object, NDArray)), or an integer or complex one over lists.

NotSupportedException

An empty slice without initial (NumPy's int 1), or a non-list result (every result of a dtype NumPy computes).

ObjectDisposedException

The array was disposed.

put(NDArray, NDListArray, string)

NumPy's put(indices, values, mode='raise'): a.flat[indices[i]] = values.flat[i % len(values)] — the lists of values, cycled, stored at the flat positions (NumPy's PyArray_PutTo: a non-contiguous array written back through its own layout).

public void put(NDArray indices, NDListArray values, string mode = "raise")

Parameters

indices NDArray

The flat indices: an integer array (NumPy casts an ndarray of indices safely), or one C# integer (lists.put(1, values)), which converts to the 0-d array NumPy's np.asarray(1) is.

values NDListArray

The lists (a list array of any shape, read in C order). A 0-d list array stands for one Python list, which NumPy converts to the array of its ITEMS (NotSupportedException unless it is empty, or no index is given).

mode string

"raise", "wrap" or "clip" (null is "raise").

Remarks

One overload, NumPy's signature: NumPy's indices is an int or an int array_like, which this NDArray parameter receives through NumSharp's implicit conversions.

Exceptions

ValueError

A bad mode; a read-only array (put: output array is read-only).

TypeError

Indices that do not cast to int64 under safe.

IndexError

An index out of bounds under "raise"; indices into an empty array (cannot replace elements of an empty array).

NotSupportedException

A list as values whose items would be stored, or a list of the other piece class.

ArgumentNullException

values is null.

ObjectDisposedException

The array or the values were disposed.

ravel(char)

NumPy's ravel(order='C'): the 1-D list array, a view whenever the pointers are contiguous in that order ('K': their memory order).

public NDListArray ravel(char order = 'C')

Parameters

order char

'C', 'F', 'A' or 'K'.

Returns

NDListArray

The flattened list array.

Exceptions

ValueError

An order NumPy does not take.

ObjectDisposedException

The array was disposed.

repeat(NDArray, int?)

NumPy's repeat(repeats, axis=None): every list repeated (of the flattened array, or along axis), the pointers copied, the lists shared.

public NDListArray repeat(NDArray repeats, int? axis = null)

Parameters

repeats NDArray

The counts: one C# integer for every element (lists.repeat(2), the 0-d array NumPy's np.asarray(2) is), or an integer array of one count per element along the axis (broadcast against it).

axis int?

The axis, or null for the flattened array.

Returns

NDListArray

The repeated lists.

Remarks

One overload, NumPy's signature: NumPy's repeats is an int or an int array_like, which this NDArray parameter receives through NumSharp's implicit conversions.

Exceptions

ArgumentException

A negative count: repeat(NDArray, int?)'s text, repeats may not contain negative values (NumPy's ValueError reads negative dimensions are not allowed: the wording divergence NDArray.repeat has for every dtype); counts that do not broadcast (operands could not be broadcast together with shape (6,) (2,), NumPy's ValueError text).

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

reshape(Shape, char, bool?)

NumPy's reshape(shape, /, *, order='C', copy=None): the elements read in order and placed in the new shape in the same order — a view when the pointers allow one (else a view of a copy, as in NumPy), always a copy for copy=true, and NumPy's ValueError for copy=false when no view can be made.

public NDListArray reshape(Shape shape, char order = 'C', bool? copy = null)

Parameters

shape Shape

The new shape: a Shape, or a C# long[] / int[] / tuple / integer, which convert to one (one entry may be -1, inferred).

order char

'C', 'F' or 'A' (F when the array is F-contiguous and not C); NumPy refuses 'K'.

copy bool?

NumPy's copy: null (a copy only when needed), true (always a copy, in order), false (never: a reshape that needs a copy raises).

Returns

NDListArray

The reshaped list array (it shares the lists in every case: a copy copies the pointers).

Remarks

NumPy takes the shape as one tuple OR as separate integers, then the keyword-only order and copy; C# has no keyword-only parameter after a params array, so the two spellings are two members: reshape(params long[]) for separate integers and this one for everything else.

Exceptions

IncorrectShapeException

The size differs.

ValueError

An order NumPy does not take (order 'K' is not permitted for reshaping); more than one -1; Unable to avoid creating a copy while reshaping. for copy=false.

ObjectDisposedException

The array was disposed.

reshape(params long[])

NumPy's reshape(*shape) with separate integers, NumPy's defaults order='C' and copy=None: a view when the pointers allow one, else a copy (see reshape(Shape, char, bool?), the spelling that takes order and copy).

public NDListArray reshape(params long[] shape)

Parameters

shape long[]

The new shape (one entry may be -1, inferred).

Returns

NDListArray

The reshaped list array.

Exceptions

IncorrectShapeException

The size differs (cannot reshape array of size 6 into shape (4,)).

ValueError

More than one -1 (can only specify one unknown dimension).

ObjectDisposedException

The array was disposed.

resize(Shape, bool)

NumPy's in-place resize(new_shape, refcheck=True): the array keeps its first lists (in its memory order: an F-contiguous array keeps its column-major prefix) and is relabelled with the new shape. NumPy fills grown elements with the int 0, which a list array cannot hold, so a GROWING resize is refused — after NumPy's own checks, in its order: one segment, no negative dimension, ownership, other references.

public void resize(Shape new_shape, bool refcheck = true)

Parameters

new_shape Shape

The new shape (a 0-d shape for a scalar).

refcheck bool

Refuse when another array shares the elements (default true).

Remarks

NumPy's resize(*new_shape, refcheck=True) takes the shape as one tuple OR as separate integers, and the keyword-only refcheck after them. C# has no keyword-only parameter after a params array, so the two spellings are two members: this one (a Shape, which a C# long[] or tuple converts to, with refcheck) and resize(params long[]) (separate integers, NumPy's default refcheck).

Exceptions

IncorrectShapeException

NumPy's ValueErrors (house type): resize only works on single-segment arrays, negative dimensions not allowed, cannot resize this array: it does not own its data, cannot resize an array that references or is referenced ....

OutOfMemoryException

A size whose product overflows (NumPy's MemoryError).

NotSupportedException

A growing resize (NumPy's new elements are ints).

ObjectDisposedException

The array was disposed.

resize(params long[])

NumPy's resize(*new_shape) with separate integers, NumPy's default refcheck=True (see resize(Shape, bool), the spelling that takes refcheck).

public void resize(params long[] new_shape)

Parameters

new_shape long[]

The new dimensions (none: a no-op, NumPy's a.resize()).

Exceptions

IncorrectShapeException

See resize(Shape, bool).

OutOfMemoryException

See resize(Shape, bool).

NotSupportedException

A growing resize.

ObjectDisposedException

The array was disposed.

round(int, NDListArray)

NumPy's round(decimals=0, out=None) of lists: rint (decimals 0), a multiply by 10.0 ** decimals (positive) or a divide by 10.0 ** -decimals (negative) — each CPython's TypeError for a list; an empty array gives an empty result.

public NDListArray round(int decimals = 0, NDListArray @out = null)

Parameters

decimals int

The decimals.

out NDListArray

A list array of the same SIZE, or null.

Returns

NDListArray

An empty result (or out) for an empty array.

Exceptions

ValueError

out of another size (invalid output shape).

TypeError

loop of ufunc does not support argument 0 of type list which has no callable rint method, can't multiply sequence by non-int of type 'float', unsupported operand type(s) for /: 'list' and 'float'.

ObjectDisposedException

The array was disposed.

searchsorted(object, string, NDArray)

NumPy's searchsorted(v, side='left', sorter=None) over a 1-D array of lists sorted in Python's list order: for each element of v, the index where it would be inserted (before equal lists for 'left', after them for 'right'), through sorter when given.

public NDArray searchsorted(object v, string side = "left", NDArray sorter = null)

Parameters

v object

The values to place: a list array (its lists, any shape: the result has its shape), the 0-d stand-in of one Python list (lists["0"]: NumPy's np.asarray makes it the array of its ITEMS), or any other C# value as the Python value it stands for (an NDArray, a string, a number), whose elements NumPy compares with the lists — CPython's TypeError for the first comparison.

side string

"left" or "right".

sorter NDArray

int64 indices that sort this array, or null.

Returns

NDArray

The int64 insertion points (zeros of the value's shape when nothing is compared: an empty haystack or an empty value).

Remarks

One overload, NumPy's signature: NumPy's v is any array_like, so the list arrays that used to have an overload of their own are one case of v (SearchSortedLists(NDListArray, string, NDArray)).

Exceptions

ArgumentNullException

v is null.

ValueError

An unknown side, a haystack of more than one dimension (object too deep for desired array), a sorter of another size, or a sorter index outside the array (Sorter index out of range.).

TypeError

A str list item compared with a bytes one; a list compared with a value that is not a list ('<' not supported between instances of 'list' and 'str'); a sorter that is not 1-D integers.

ObjectDisposedException

The array or v was disposed.

setfield(object, DType, int)

NumPy's setfield(val, dtype, offset=0) of an object array: the writeability first (assignment destination is read-only), then getfield(DType, int)'s TypeError for every dtype NumSharp can spell.

public void setfield(object value, DType dtype, int offset = 0)

Parameters

value object

The value (never stored).

dtype DType

The field's dtype. Null is Python's None (float64), refused like any other.

offset int

The field's byte offset.

Exceptions

ValueError

A read-only array.

TypeError

Cannot get/set field of an object array.

ObjectDisposedException

The array was disposed.

setflags(bool?, bool?, bool?)

NumPy's setflags(write=None, align=None, uic=None): the flags of the array of pointers (the id array), with NumPy's rules and texts.

public void setflags(bool? write = null, bool? align = null, bool? uic = null)

Parameters

write bool?

Set or clear WRITEABLE (null: unchanged).

align bool?

Set or clear ALIGNED (null: unchanged).

uic bool?

NumPy's WRITEBACKIFCOPY flag (only false is accepted).

Exceptions

ValueError

NumPy's refusals (making a view of a read-only base writeable, …).

ObjectDisposedException

The array was disposed.

sort(int, string, object, bool?)

NumPy's in-place sort(axis=-1, kind=None, order=None, *, stable=None): every line along axis ordered by Python's list order — the default kind with NumPy's introsort (the order of EQUAL lists is the algorithm's, not their input order), the stable kind keeping equal lists in order.

public void sort(int axis = -1, string kind = null, object order = null, bool? stable = null)

Parameters

axis int

The axis (negative from the end).

kind string

'quicksort' / 'heapsort' (the default sort for objects), 'mergesort' / 'stable'; NumPy's parser reads the first letter.

order object

Must be null (an object array has no fields).

stable bool?

NumPy's keyword-only stable=: true selects the stable kind.

Exceptions

ValueError

An unknown kind, kind with stable, an order, or a read-only array (sort array is read-only).

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

squeeze(int?)

NumPy's squeeze(axis=None): the view without the length-1 axes (or without the one given); with none to remove this array ITSELF, as NumPy returns its receiver.

public NDListArray squeeze(int? axis = null)

Parameters

axis int?

The axis to remove, or null for every length-1 axis.

Returns

NDListArray

The view, or this array.

Exceptions

ValueError

An axis of another length (cannot select an axis to squeeze out which has size not equal to one).

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

std(int?, DType, NDArray, int, bool, NDArray, object)

NumPy's std(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True, mean=<no value>) of lists: sqrt(var(...)) (NumPy's _std), whose variance step raises for any list (see var(int?, DType, NDArray, int, bool, NDArray, object)).

public NDArray std(int? axis = null, DType dtype = null, NDArray @out = null, int ddof = 0, bool keepdims = false, NDArray where = null, object mean = null)

Parameters

axis int?

The axis, or null for every element.

dtype DType

NumPy's loop dtype (see var(int?, DType, NDArray, int, bool, NDArray, object)).

out NDArray

NumPy's out=: an array of the result's shape (returned), or null.

ddof int

NumPy's delta degrees of freedom.

keepdims bool

Keep the reduced axes as length 1.

where NDArray

NumPy's where= mask.

mean object

NumPy's keyword-only mean= (see var(int?, DType, NDArray, int, bool, NDArray, object)), or null.

Returns

NDArray

NumPy's value for a list array whose deviations are empty, or out.

Remarks

One overload, NumPy's signature (see var(int?, DType, NDArray, int, bool, NDArray, object)).

Exceptions

TypeError

See var(int?, DType, NDArray, int, bool, NDArray, object); and loop of ufunc does not support argument 0 of type float which has no callable sqrt method (the square root of an object array of floats).

DivideByZeroException

An empty slice (NumPy's ZeroDivisionError).

ValueError

See var(int?, DType, NDArray, int, bool, NDArray, object).

IncorrectShapeException

mean does not broadcast with the array.

TypeError

An integer or bool out or array result (NumPy's Cannot cast ufunc 'sqrt' output from dtype('float64') to dtype('int64') with casting rule 'same_kind', the house type).

AxisError

An axis outside the array.

NotSupportedException

NumPy's result is an object array; a mean with no NumSharp array form.

ObjectDisposedException

The array was disposed.

sum(int?, DType, NDListArray, bool, object, NDArray)

NumPy's sum(axis=None, dtype=None, out=None, keepdims=False, initial=<no value>, where=True) of lists: their CONCATENATION in NumPy's visiting order (a transposed array's sum is its memory order), starting from initial when given.

public NDListArray sum(int? axis = null, DType dtype = null, NDListArray @out = null, bool keepdims = false, object initial = null, NDArray where = null)

Parameters

axis int?

The axis, or null for every element.

dtype DType

NumPy's loop dtype: null (NumPy's None, the object loop: the concatenation), or a dtype whose loop NumPy runs over the lists converted to it — see the remarks.

out NDListArray

A list array of the result's shape to store into, or null.

keepdims bool

Keep the reduced axes as length 1.

initial object

A Python list to start from (see max(int?, NDListArray, bool, object, NDArray)), or another Python value (CPython's TypeError, unsupported operand type(s) for +: 'int' and 'list'); null for none.

where NDArray

NumPy's where= mask.

Returns

NDListArray

The result list array.

Remarks

One overload, NumPy's signature. With a non-null dtype NumPy casts every list to the loop's dtype and reduces those values: an integer, float or complex loop fails at the first list with the conversion error astype(DType, char, string, bool, bool) gives, and the bool loop (each list's truth) or an empty array returns a value of the dtype, which a list array cannot hold — NumPy's value is np.sum(lists.astype(dtype), ...) in that dtype. NumPy's checks run first, in its order: the dtype's class, out, where, the axis, the loop, the shape of out, initial.

Exceptions

ValueError

A mask without initial (the object loop); out= errors; a float dtype over lists (setting an array element with a sequence.).

AxisError

An axis outside the array.

TypeError

A non-list initial added to a list; a dtype NumPy refuses as a ufunc argument (The dtype and signature arguments to ufuncs only select the general DType ... for a sized, byte-swapped or unit-carrying descriptor, Cannot pass a new user DType instance ... for a StringDType), a dtype without a loop (No loop matching the specified signature and casting was found for ufunc add), an integer or complex dtype over lists.

NotSupportedException

An empty slice without initial (NumPy's int 0), a list of str and bytes items (the classes of initial and the array differ), or a non-list result — every result of a dtype NumPy computes (a bool, a number of the dtype).

ObjectDisposedException

The array was disposed.

swapaxes(int, int)

NumPy's swapaxes(axis1, axis2): the view with two axes interchanged.

public NDListArray swapaxes(int axis1, int axis2)

Parameters

axis1 int

The first axis (negative counts from the end).

axis2 int

The second axis.

Returns

NDListArray

The view.

Exceptions

AxisError

An axis outside the array.

ObjectDisposedException

The array was disposed.

take(NDArray, int?, NDListArray, string)

NumPy's take(indices, axis=None, out=None, mode='raise'): the lists at indices (of the flattened array, or along axis), a new array of pointers to the same lists.

public NDListArray take(NDArray indices, int? axis = null, NDListArray @out = null, string mode = "raise")

Parameters

indices NDArray

The integer indices: an integer array of any shape (NumPy's conversion and its TypeError for a float array), or one C# integer (lists.take(1)), which converts to the 0-d array NumPy's np.asarray(1) is — the take of one index without an axis is then the element itself, a 0-d list array standing for NumPy's returned list (its item(params long[]) is the list).

axis int?

The axis, or null for the flattened array.

out NDListArray

NumPy's out=: a list array of the result's shape whose elements are set to the taken lists (returned), or null for a new array.

mode string

"raise", "wrap" or "clip" (null is "raise").

Returns

NDListArray

The taken lists (out when given).

Remarks

One overload, NumPy's signature: NumPy's indices is an int or an int array_like, which this NDArray parameter receives through NumSharp's implicit conversions.

Exceptions

IndexError

An index out of bounds under "raise" (index 7 is out of bounds for axis 0 with size 6).

AxisError

An axis outside the array.

TypeError

Indices that are not integers.

ValueError

A mode NumPy does not take; an out of another shape (output array does not match result of ndarray.take) or a read-only one (WRITEBACKIFCOPY base is read-only), both checked before the indices' bounds.

NotSupportedException

An out of the other piece class (str and bytes) that would receive a non-empty list.

ObjectDisposedException

The array was disposed.

to_device(string, object)

NumPy's to_device(device, stream=None) (the Array API's): this array itself for "cpu", the only device.

public NDListArray to_device(string device, object stream = null)

Parameters

device string

The device: "cpu".

stream object

The Array API's stream argument: must be null.

Returns

NDListArray

This array.

Exceptions

ArgumentNullException

A null device (NumPy's TypeError to_device() argument 1 must be str, not None).

ValueError

A stream (The stream argument in to_device() is not supported), then another device (Unsupported device: gpu. Only 'cpu' is accepted.): to_device(string, object)'s types and texts, NumPy's.

ObjectDisposedException

The array was disposed.

tobytes(char)

NumPy's tobytes() of an object array is the bytes of its PyObject* pointers — addresses in one Python process, meaningless as data — so it is not offered.

public byte[] tobytes(char order = 'C')

Parameters

order char

The byte order NumPy would read the elements in.

Returns

byte[]

Never returns.

Exceptions

NotSupportedException

Always.

tofile(object, string, string)

NumPy's tofile(fid, sep='', format='%s') of an object array: binary mode is NumPy's OSError; text mode writes each list as format % (list,) ("": its repr), the separator between elements, in C order, as ASCII.

public void tofile(object fid, string sep = "", string format = "%s")

Parameters

fid object

NumPy's fid: a file name — a string, a byte[] (Python bytes, UTF-8 as Windows' file-system encoding) or a FileSystemInfo (Python's os.PathLike) — which is created or truncated first, as NumPy opens it with "wb"; or an open Stream (NumPy's file object), written from its position and left open.

sep string

The separator; "" is binary mode. Null is Python's None, which NumPy refuses.

format string

CPython's % format applied to each list (%s / %r its repr, %a its ascii(), width and precision as for a str). Null is Python's None, which NumPy refuses.

Remarks

One overload, NumPy's signature: NumPy's fid is "an open file object, or a string containing a filename", so a name and a stream are two cases of one parameter.

Exceptions

AttributeError

fid is neither a file name nor a stream: NumPy calls its flush() first ('NoneType' object has no attribute 'flush' for null).

OSError

cannot write object arrays to a file in binary mode (an empty array too), after the file is created, as in NumPy.

ValueError

A NUL in sep or format (checked before the file is opened); a malformed format.

TypeError

A null sep or format (tofile() argument 2 must be str, not None, argument 3 for the format; checked before the file is opened), a conversion a list does not take (%d format: a real number is required, not list), or the wrong number of conversions.

UnicodeEncodeError

A list whose text is not ASCII (NumPy 2.4.2 crashes the process there); a lone surrogate in sep or format.

IOException

The file cannot be created (.NET's exception for NumPy's OSError).

UnauthorizedAccessException

The name is a directory or is not writable (NumPy's PermissionError).

ObjectDisposedException

The array was disposed.

tolist()

NumPy's tolist(): nested .NET lists of the outer shape whose leaves are the element lists, each a List<T> of its pieces (string for str pieces, byte[] for bytes pieces, every piece exact); a 0-d array gives its one list.

public object tolist()

Returns

object

The nested lists.

Exceptions

ObjectDisposedException

The array was disposed.

SystemError

A U piece holds a code unit above U+10FFFF (it has no .NET form).

trace(int, int, int, DType, NDListArray)

NumPy's trace(offset=0, axis1=0, axis2=1, dtype=None, out=None) of lists: the concatenation of the diagonal's lists (NumPy's add.reduce over the diagonal's last axis).

public NDListArray trace(int offset = 0, int axis1 = 0, int axis2 = 1, DType dtype = null, NDListArray @out = null)

Parameters

offset int

The diagonal's offset.

axis1 int

The first axis of the 2-D sub-arrays.

axis2 int

The second axis.

dtype DType

NumPy's loop dtype: null (the object loop), or a dtype NumPy converts the lists to (see cumsum(int?, DType, NDListArray): the C method passes its type number).

out NDListArray

A list array to store into, or null.

Returns

NDListArray

The concatenations (a 0-d list array for a 2-D array).

Remarks

One overload, NumPy's signature: PyArray_Trace is the diagonal, then add.reduce(diagonal, -1, dtype=PyArray_DescrFromType(rtype), out=out).

Exceptions

ValueError

Fewer than two axes (diag requires an array of at least two dimensions); out= errors; a float dtype over lists.

AxisError

An axis outside the array.

TypeError

A refused dtype, or an integer / complex one over lists.

NotSupportedException

An empty diagonal (NumPy's int 0), or a non-list result.

ObjectDisposedException

The array was disposed.

transpose(params int[])

NumPy's transpose(*axes): the view with the axes permuted (reversed when none are given).

public NDListArray transpose(params int[] axes)

Parameters

axes int[]

The permutation, or none to reverse the axes.

Returns

NDListArray

The view.

Exceptions

ValueError

The axes do not match the array (axes don't match array) or repeat (repeated axis in transpose).

AxisError

An axis outside the array (axis 2 is out of bounds for array of dimension 2).

ObjectDisposedException

The array was disposed.

var(int?, DType, NDArray, int, bool, NDArray, object)

NumPy's var(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True, mean=<no value>) of lists (NumPy's _var): its first step that touches a list — the division of the kept-dims sum, or the subtraction of mean — is CPython's TypeError; an array whose deviations are EMPTY gets NumPy's value (see the remarks).

public NDArray var(int? axis = null, DType dtype = null, NDArray @out = null, int ddof = 0, bool keepdims = false, NDArray where = null, object mean = null)

Parameters

axis int?

The axis, or null for every element.

dtype DType

NumPy's loop dtype: null (the object loop), or a dtype NumPy converts the lists to for the mean (the bool loop's mean is then subtracted from the lists: CPython's TypeError).

out NDArray

NumPy's out=: an array of the result's shape that receives the variance (returned), or null.

ddof int

NumPy's delta degrees of freedom (the divisor is max(count - ddof, 0)).

keepdims bool

Keep the reduced axes as length 1.

where NDArray

NumPy's where= mask.

mean object

NumPy's keyword-only mean=: the mean to subtract instead of computing it (any value NumPy takes: a list array, an array, a C# number or string as the Python value it stands for), or null (NumPy's default, computed).

Returns

NDArray

NumPy's value for a list array whose deviations are empty (a 0-d float64 0.0 or NaN, an array of dtype), or out.

Remarks

One overload, NumPy's signature (ndarray.var takes no correction=: NumPy 2.4.2's _var refuses it, where the function np.var takes it).

_var's statements over lists: _count_reduce_items; the mean (umr_sum(arr, axis, dtype, keepdims=True, where=where) divided by the count) or mean; x = arr - arrmean, the object subtraction, CPython's TypeError for any element; then, for EMPTY deviations, ret = umr_sum(x, axis, dtype, out, keepdims=keepdims, where=where) — every output its identity 0 — divided by max(count - ddof, 0): NaN or 0.0 for a scalar, ZeroDivisionError for an object array divided by 0, the dtype's unsafe cast for dtype or out. out is first checked by that last sum, so an earlier TypeError wins over its errors.

Exceptions

TypeError

unsupported operand type(s) for /: 'list' and 'int' (the mean's division); unsupported operand type(s) for -: 'list' and 'float' (the subtraction, naming the mean's element type); ufunc 'divide' not supported ... (a 0-d array of a non-empty list); a list converted to an integer or complex dtype; a refused or loop-less dtype; std's sqrt of an object result.

DivideByZeroException

An empty slice (NumPy's ZeroDivisionError, division by zero).

ValueError

A mask (the object loop has no identity for it); a list converted to a float dtype; NumPy's out= checks.

IncorrectShapeException

mean does not broadcast with the array (operands could not be broadcast together with shapes (4,) (3,) ).

TypeError

std into an integer or bool out (NumPy's sqrt output cast, the house type).

AxisError

An axis outside the array (a 0-d array has none).

NotSupportedException

NumPy's result is an object array (along an axis of an empty array); a mean with no NumSharp array form.

ObjectDisposedException

The array was disposed.

view(object, object)

NumPy's view([dtype][, type]) of an object array: a new list array over the same pointers (its base is this array's owner). Only the object dtype keeps an array of references viewable, and only ndarray is a class a list array can be viewed as here.

public NDListArray view(object dtype, object type)

Parameters

dtype object

NumPy's dtype, omitted for none. The object dtype — typeof(object), np.object_, or a NumPy spelling of it ("O", "|O", "=O", "<O", ">O", "O8", "O4", "object", "object_") — is the same view; any other dtype (a DType, a CLR element type, an NPTypeCode, a dtype string, and null, which is NumPy's None and converts to float64) is NumPy's TypeError. An ARRAY CLASS here is the type argument, as in NumPy.

type object

NumPy's type, omitted for none: the class of the result — typeof(NDArray) or typeof(NDListArray) (NumPy's ndarray) give the view; typeof(NDCharArray) is its finalize error; typeof(NDMatrix) and typeof(NDMaskedArray) would be an object matrix / masked array, which NumSharp has no type for. Anything else — null (NumPy's None) included — is not an array class.

Returns

NDListArray

The view.

Remarks

One member, NumPy's signature. Both parameters are [Optional] objects without a default constant, so an omitted argument arrives as Missing while an explicit null stays NumPy's None — a.view(None) and a.view(type=None) raise in NumPy, where a.view() does not. The checks run in array_view's order: the swap of an array class given as the dtype, the type, the dtype's conversion, the class's finalize (PyArray_View builds the subclass object before it assigns the dtype), then the dtype's refusal.

Exceptions

ValueError

Cannot specify output type twice. (an array class as dtype beside a type); Type must be a sub-type of ndarray type; the class's finalize error (Can only create a chararray from string data., shape too large to be a matrix.).

TypeError

Cannot change data-type for array of references. for a dtype that is not the object dtype; Cannot interpret '1' as a data type for a value that names no dtype; NumPy's data type 'x' not understood for a dtype string NumPy cannot parse.

NotSupportedException

A dtype string or CLR type naming a dtype NumSharp has no class for; a view as an object matrix, masked array or typed NDArray<T>.

IncorrectShapeException

A matrix view of more than two axes where one has extent 0.

ObjectDisposedException

The array was disposed.

Operators

operator +(NDArray, NDListArray)

NumPy's x + lists with an ndarray on the left: the element's own + (unsupported operand type(s) for +: 'int' and 'list', can only concatenate str (not "list") to str).

public static NDListArray operator +(NDArray left, NDListArray right)

Parameters

left NDArray

The array.

right NDListArray

The list array.

Returns

NDListArray

An empty list array (nothing was added).

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's addition.

operator +(NDCharArray, NDListArray)

NumPy's c + lists (see the reflected form).

public static NDListArray operator +(NDCharArray left, NDListArray right)

Parameters

left NDCharArray

The chararray.

right NDListArray

The list array.

Returns

NDListArray

Never returns.

Exceptions

ValueError

Can only create a chararray from string data.

operator +(NDListArray, NDArray)

NumPy's lists + x with an ndarray (or a C# value its implicit conversion made one): CPython's TypeError for the first pair, can only concatenate list (not "int") to list.

public static NDListArray operator +(NDListArray left, NDArray right)

Parameters

left NDListArray

The list array.

right NDArray

The array.

Returns

NDListArray

An empty list array (nothing was added).

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's concatenation.

operator +(NDListArray, NDCharArray)

NumPy's lists + c with a chararray: the chararray's reflected add, whose object result cannot be a chararray.

public static NDListArray operator +(NDListArray left, NDCharArray right)

Parameters

left NDListArray

The list array.

right NDCharArray

The chararray.

Returns

NDListArray

Never returns.

Exceptions

ValueError

Can only create a chararray from string data.

operator +(NDListArray, NDListArray)

NumPy's a + b of two list arrays: each broadcast pair's concatenation, a new list.

public static NDListArray operator +(NDListArray left, NDListArray right)

Parameters

left NDListArray

The left list array.

right NDListArray

The right list array.

Returns

NDListArray

The concatenations, in NumPy's ufunc output layout.

Exceptions

ArgumentNullException

An operand is null.

IncorrectShapeException

The shapes do not broadcast (operands could not be broadcast together with shapes (4,) (3,) ).

NotSupportedException

The results would hold str and bytes items together (NumPy's object lists can; an NDListArray holds one piece class).

ObjectDisposedException

An operand was disposed.

operator +(NDListArray, byte[])

NumPy's lists + bytes with a C# byte[] (a Python bytes): CPython's TypeError for the first pair (can only concatenate list (not "str") to list; with the text on the left, can only concatenate str (not "list") to str / can't concat list to bytes).

public static NDListArray operator +(NDListArray left, byte[] right)

Parameters

left NDListArray

The left operand.

right byte[]

The right operand.

Returns

NDListArray

The result over the list array's shape (empty: nothing was computed).

Exceptions

TypeError

The first pair's operation (an empty array computes nothing).

operator +(NDListArray, object)

NumPy's lists + x with a C# value (null is Python's None; a list array concatenates).

public static NDListArray operator +(NDListArray left, object right)

Parameters

left NDListArray

The list array.

right object

The value.

Returns

NDListArray

The concatenations (a list array value), or an empty result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's concatenation.

NotSupportedException

The value has no NumSharp array form.

operator +(NDListArray, string)

NumPy's lists + str with a C# string (a Python str): CPython's TypeError for the first pair (can only concatenate list (not "str") to list; with the text on the left, can only concatenate str (not "list") to str / can't concat list to bytes).

public static NDListArray operator +(NDListArray left, string right)

Parameters

left NDListArray

The left operand.

right string

The right operand.

Returns

NDListArray

The result over the list array's shape (empty: nothing was computed).

Exceptions

TypeError

The first pair's operation (an empty array computes nothing).

operator +(byte[], NDListArray)

NumPy's bytes + lists with a C# byte[] (a Python bytes): CPython's TypeError for the first pair (can only concatenate list (not "str") to list; with the text on the left, can only concatenate str (not "list") to str / can't concat list to bytes).

public static NDListArray operator +(byte[] left, NDListArray right)

Parameters

left byte[]

The left operand.

right NDListArray

The right operand.

Returns

NDListArray

The result over the list array's shape (empty: nothing was computed).

Exceptions

TypeError

The first pair's operation (an empty array computes nothing).

operator +(object, NDListArray)

NumPy's x + lists with a C# value on the left (see the array form).

public static NDListArray operator +(object left, NDListArray right)

Parameters

left object

The value.

right NDListArray

The list array.

Returns

NDListArray

The concatenations (a list array value), or an empty result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's addition.

NotSupportedException

The value has no NumSharp array form.

operator +(string, NDListArray)

NumPy's str + lists with a C# string (a Python str): CPython's TypeError for the first pair (can only concatenate list (not "str") to list; with the text on the left, can only concatenate str (not "list") to str / can't concat list to bytes).

public static NDListArray operator +(string left, NDListArray right)

Parameters

left string

The left operand.

right NDListArray

The right operand.

Returns

NDListArray

The result over the list array's shape (empty: nothing was computed).

Exceptions

TypeError

The first pair's operation (an empty array computes nothing).

operator ==(NDArray, NDListArray)

NumPy's x == lists with an ndarray on the left (the reflected comparison).

public static NDArray<bool> operator ==(NDArray left, NDListArray right)

Parameters

left NDArray

The array.

right NDListArray

The list array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

operator ==(NDCharArray, NDListArray)

NumPy's c == lists: the chararray's comparison refuses the object array.

public static NDArray<bool> operator ==(NDCharArray left, NDListArray right)

Parameters

left NDCharArray

The chararray.

right NDListArray

The list array.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator ==(NDListArray, NDArray)

NumPy's lists == x with an ndarray (or a C# value its implicit conversion made one): every element False (a list never equals a number or a str), broadcast together.

public static NDArray<bool> operator ==(NDListArray left, NDArray right)

Parameters

left NDListArray

The list array.

right NDArray

The array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

operator ==(NDListArray, NDCharArray)

NumPy's lists == c beside a chararray: the chararray's own comparison runs first (a subclass's reflected method), which refuses an object array.

public static NDArray<bool> operator ==(NDListArray left, NDCharArray right)

Parameters

left NDListArray

The list array.

right NDCharArray

The chararray.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator ==(NDListArray, NDListArray)

NumPy's a == b of two object arrays of lists: each pair compared as Python lists (equal lengths and equal items), broadcast together.

public static NDArray<bool> operator ==(NDListArray left, NDListArray right)

Parameters

left NDListArray

The left list array (null: NDArray's reference test).

right NDListArray

The right list array (null: NDArray's reference test).

Returns

NDArray<bool>

The bool result (a 0-d one for a null operand).

Exceptions

IncorrectShapeException

The shapes do not broadcast (NumPy's ValueError text).

operator ==(NDListArray, byte[])

NumPy's lists == bytes with a C# byte[] (a Python bytes): every element False (a list never equals a str or bytes).

public static NDArray<bool> operator ==(NDListArray left, byte[] right)

Parameters

left NDListArray

The left operand.

right byte[]

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

operator ==(NDListArray, object)

NumPy's lists == x with a C# value (a byte[] is Python bytes, a string a Python str, null NDArray's reference test).

public static NDArray<bool> operator ==(NDListArray left, object right)

Parameters

left NDListArray

The list array.

right object

The value.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

NotSupportedException

The value has no NumSharp array form.

operator ==(NDListArray, string)

NumPy's lists == str with a C# string (a Python str): every element False (a list never equals a str or bytes).

public static NDArray<bool> operator ==(NDListArray left, string right)

Parameters

left NDListArray

The left operand.

right string

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

operator ==(byte[], NDListArray)

NumPy's bytes == lists with a C# byte[] (a Python bytes): every element False (a list never equals a str or bytes).

public static NDArray<bool> operator ==(byte[] left, NDListArray right)

Parameters

left byte[]

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

operator ==(object, NDListArray)

NumPy's x == lists with a C# value on the left.

public static NDArray<bool> operator ==(object left, NDListArray right)

Parameters

left object

The value.

right NDListArray

The list array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

NotSupportedException

The value has no NumSharp array form.

operator ==(string, NDListArray)

NumPy's str == lists with a C# string (a Python str): every element False (a list never equals a str or bytes).

public static NDArray<bool> operator ==(string left, NDListArray right)

Parameters

left string

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

operator >(NDArray, NDListArray)

NumPy's x > lists (the reflected <).

public static NDArray<bool> operator >(NDArray left, NDListArray right)

Parameters

left NDArray

The array.

right NDListArray

The list array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

operator >(NDCharArray, NDListArray)

NumPy's c > lists (see ==).

public static NDArray<bool> operator >(NDCharArray left, NDListArray right)

Parameters

left NDCharArray

The chararray.

right NDListArray

The list array.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator >(NDListArray, NDArray)

NumPy's lists > x with an ndarray (see <).

public static NDArray<bool> operator >(NDListArray left, NDArray right)

Parameters

left NDListArray

The list array.

right NDArray

The array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

operator >(NDListArray, NDCharArray)

NumPy's lists > c beside a chararray (see ==).

public static NDArray<bool> operator >(NDListArray left, NDCharArray right)

Parameters

left NDListArray

The list array.

right NDCharArray

The chararray.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator >(NDListArray, NDListArray)

NumPy's a > b of two object arrays of lists (see <).

public static NDArray<bool> operator >(NDListArray left, NDListArray right)

Parameters

left NDListArray

The left list array.

right NDListArray

The right list array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

A str item meets a bytes item, or a null operand.

operator >(NDListArray, byte[])

NumPy's lists > bytes with a C# byte[] (a Python bytes): CPython's TypeError for the first pair.

public static NDArray<bool> operator >(NDListArray left, byte[] right)

Parameters

left NDListArray

The left operand.

right byte[]

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator >(NDListArray, object)

NumPy's lists > x with a C# value.

public static NDArray<bool> operator >(NDListArray left, object right)

Parameters

left NDListArray

The list array.

right object

The value.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

NotSupportedException

The value has no NumSharp array form.

operator >(NDListArray, string)

NumPy's lists > str with a C# string (a Python str): CPython's TypeError for the first pair.

public static NDArray<bool> operator >(NDListArray left, string right)

Parameters

left NDListArray

The left operand.

right string

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator >(byte[], NDListArray)

NumPy's bytes > lists with a C# byte[] (a Python bytes): CPython's TypeError for the first pair.

public static NDArray<bool> operator >(byte[] left, NDListArray right)

Parameters

left byte[]

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator >(object, NDListArray)

NumPy's x > lists with a C# value on the left (the reflected <).

public static NDArray<bool> operator >(object left, NDListArray right)

Parameters

left object

The value.

right NDListArray

The list array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

NotSupportedException

The value has no NumSharp array form.

operator >(string, NDListArray)

NumPy's str > lists with a C# string (a Python str): CPython's TypeError for the first pair.

public static NDArray<bool> operator >(string left, NDListArray right)

Parameters

left string

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator >=(NDArray, NDListArray)

NumPy's x >= lists (the reflected <=).

public static NDArray<bool> operator >=(NDArray left, NDListArray right)

Parameters

left NDArray

The array.

right NDListArray

The list array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

operator >=(NDCharArray, NDListArray)

NumPy's c >= lists (see ==).

public static NDArray<bool> operator >=(NDCharArray left, NDListArray right)

Parameters

left NDCharArray

The chararray.

right NDListArray

The list array.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator >=(NDListArray, NDArray)

NumPy's lists >= x with an ndarray (see <).

public static NDArray<bool> operator >=(NDListArray left, NDArray right)

Parameters

left NDListArray

The list array.

right NDArray

The array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

operator >=(NDListArray, NDCharArray)

NumPy's lists >= c beside a chararray (see ==).

public static NDArray<bool> operator >=(NDListArray left, NDCharArray right)

Parameters

left NDListArray

The list array.

right NDCharArray

The chararray.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator >=(NDListArray, NDListArray)

NumPy's a >= b of two object arrays of lists (see <).

public static NDArray<bool> operator >=(NDListArray left, NDListArray right)

Parameters

left NDListArray

The left list array.

right NDListArray

The right list array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

A str item meets a bytes item, or a null operand.

operator >=(NDListArray, byte[])

NumPy's lists >= bytes with a C# byte[] (a Python bytes): CPython's TypeError for the first pair.

public static NDArray<bool> operator >=(NDListArray left, byte[] right)

Parameters

left NDListArray

The left operand.

right byte[]

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator >=(NDListArray, object)

NumPy's lists >= x with a C# value.

public static NDArray<bool> operator >=(NDListArray left, object right)

Parameters

left NDListArray

The list array.

right object

The value.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

NotSupportedException

The value has no NumSharp array form.

operator >=(NDListArray, string)

NumPy's lists >= str with a C# string (a Python str): CPython's TypeError for the first pair.

public static NDArray<bool> operator >=(NDListArray left, string right)

Parameters

left NDListArray

The left operand.

right string

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator >=(byte[], NDListArray)

NumPy's bytes >= lists with a C# byte[] (a Python bytes): CPython's TypeError for the first pair.

public static NDArray<bool> operator >=(byte[] left, NDListArray right)

Parameters

left byte[]

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator >=(object, NDListArray)

NumPy's x >= lists with a C# value on the left (the reflected <=).

public static NDArray<bool> operator >=(object left, NDListArray right)

Parameters

left object

The value.

right NDListArray

The list array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

NotSupportedException

The value has no NumSharp array form.

operator >=(string, NDListArray)

NumPy's str >= lists with a C# string (a Python str): CPython's TypeError for the first pair.

public static NDArray<bool> operator >=(string left, NDListArray right)

Parameters

left string

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator !=(NDArray, NDListArray)

NumPy's x != lists with an ndarray on the left (the reflected comparison).

public static NDArray<bool> operator !=(NDArray left, NDListArray right)

Parameters

left NDArray

The array.

right NDListArray

The list array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

operator !=(NDCharArray, NDListArray)

NumPy's c != lists (see ==).

public static NDArray<bool> operator !=(NDCharArray left, NDListArray right)

Parameters

left NDCharArray

The chararray.

right NDListArray

The list array.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator !=(NDListArray, NDArray)

NumPy's lists != x with an ndarray: every element True.

public static NDArray<bool> operator !=(NDListArray left, NDArray right)

Parameters

left NDListArray

The list array.

right NDArray

The array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

operator !=(NDListArray, NDCharArray)

NumPy's lists != c beside a chararray (see ==).

public static NDArray<bool> operator !=(NDListArray left, NDCharArray right)

Parameters

left NDListArray

The list array.

right NDCharArray

The chararray.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator !=(NDListArray, NDListArray)

NumPy's a != b of two object arrays of lists (see ==).

public static NDArray<bool> operator !=(NDListArray left, NDListArray right)

Parameters

left NDListArray

The left list array.

right NDListArray

The right list array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

operator !=(NDListArray, byte[])

NumPy's lists != bytes with a C# byte[] (a Python bytes): every element True.

public static NDArray<bool> operator !=(NDListArray left, byte[] right)

Parameters

left NDListArray

The left operand.

right byte[]

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

operator !=(NDListArray, object)

NumPy's lists != x with a C# value.

public static NDArray<bool> operator !=(NDListArray left, object right)

Parameters

left NDListArray

The list array.

right object

The value.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

NotSupportedException

The value has no NumSharp array form.

operator !=(NDListArray, string)

NumPy's lists != str with a C# string (a Python str): every element True.

public static NDArray<bool> operator !=(NDListArray left, string right)

Parameters

left NDListArray

The left operand.

right string

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

operator !=(byte[], NDListArray)

NumPy's bytes != lists with a C# byte[] (a Python bytes): every element True.

public static NDArray<bool> operator !=(byte[] left, NDListArray right)

Parameters

left byte[]

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

operator !=(object, NDListArray)

NumPy's x != lists with a C# value on the left.

public static NDArray<bool> operator !=(object left, NDListArray right)

Parameters

left object

The value.

right NDListArray

The list array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

NotSupportedException

The value has no NumSharp array form.

operator !=(string, NDListArray)

NumPy's str != lists with a C# string (a Python str): every element True.

public static NDArray<bool> operator !=(string left, NDListArray right)

Parameters

left string

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

operator <(NDArray, NDListArray)

NumPy's x < lists: Python runs lists > x, whose TypeError names '>'.

public static NDArray<bool> operator <(NDArray left, NDListArray right)

Parameters

left NDArray

The array.

right NDListArray

The list array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

'>' not supported between instances of 'list' and 'int'.

operator <(NDCharArray, NDListArray)

NumPy's c < lists (see ==).

public static NDArray<bool> operator <(NDCharArray left, NDListArray right)

Parameters

left NDCharArray

The chararray.

right NDListArray

The list array.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator <(NDListArray, NDArray)

NumPy's lists < x with an ndarray: CPython's TypeError for the first pair (an empty broadcast gives an empty result).

public static NDArray<bool> operator <(NDListArray left, NDArray right)

Parameters

left NDListArray

The list array.

right NDArray

The array.

Returns

NDArray<bool>

An empty bool result (nothing was compared).

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

'<' not supported between instances of 'list' and 'int' (the element's Python type).

operator <(NDListArray, NDCharArray)

NumPy's lists < c beside a chararray (see ==).

public static NDArray<bool> operator <(NDListArray left, NDCharArray right)

Parameters

left NDListArray

The list array.

right NDCharArray

The chararray.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator <(NDListArray, NDListArray)

NumPy's a < b of two object arrays of lists: Python's list ordering (the first unequal items decide, then the lengths).

public static NDArray<bool> operator <(NDListArray left, NDListArray right)

Parameters

left NDListArray

The left list array.

right NDListArray

The right list array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

A str item meets a bytes item ('<' not supported between instances of 'str' and 'bytes'), or an operand is null (the ordering against None).

operator <(NDListArray, byte[])

NumPy's lists < bytes with a C# byte[] (a Python bytes): CPython's TypeError for the first pair ('<' not supported between instances of 'list' and 'str').

public static NDArray<bool> operator <(NDListArray left, byte[] right)

Parameters

left NDListArray

The left operand.

right byte[]

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator <(NDListArray, object)

NumPy's lists < x with a C# value (null is Python's None).

public static NDArray<bool> operator <(NDListArray left, object right)

Parameters

left NDListArray

The list array.

right object

The value.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

NotSupportedException

The value has no NumSharp array form.

operator <(NDListArray, string)

NumPy's lists < str with a C# string (a Python str): CPython's TypeError for the first pair ('<' not supported between instances of 'list' and 'str').

public static NDArray<bool> operator <(NDListArray left, string right)

Parameters

left NDListArray

The left operand.

right string

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator <(byte[], NDListArray)

NumPy's bytes < lists with a C# byte[] (a Python bytes): CPython's TypeError for the first pair ('<' not supported between instances of 'list' and 'str').

public static NDArray<bool> operator <(byte[] left, NDListArray right)

Parameters

left byte[]

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator <(object, NDListArray)

NumPy's x < lists with a C# value on the left (the reflected >).

public static NDArray<bool> operator <(object left, NDListArray right)

Parameters

left object

The value.

right NDListArray

The list array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

NotSupportedException

The value has no NumSharp array form.

operator <(string, NDListArray)

NumPy's str < lists with a C# string (a Python str): CPython's TypeError for the first pair ('<' not supported between instances of 'list' and 'str').

public static NDArray<bool> operator <(string left, NDListArray right)

Parameters

left string

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator <=(NDArray, NDListArray)

NumPy's x <= lists (the reflected >=).

public static NDArray<bool> operator <=(NDArray left, NDListArray right)

Parameters

left NDArray

The array.

right NDListArray

The list array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

operator <=(NDCharArray, NDListArray)

NumPy's c <= lists (see ==).

public static NDArray<bool> operator <=(NDCharArray left, NDListArray right)

Parameters

left NDCharArray

The chararray.

right NDListArray

The list array.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator <=(NDListArray, NDArray)

NumPy's lists <= x with an ndarray (see <).

public static NDArray<bool> operator <=(NDListArray left, NDArray right)

Parameters

left NDListArray

The list array.

right NDArray

The array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

operator <=(NDListArray, NDCharArray)

NumPy's lists <= c beside a chararray (see ==).

public static NDArray<bool> operator <=(NDListArray left, NDCharArray right)

Parameters

left NDListArray

The list array.

right NDCharArray

The chararray.

Returns

NDArray<bool>

Never returns.

Exceptions

TypeError

comparison of non-string arrays.

operator <=(NDListArray, NDListArray)

NumPy's a <= b of two object arrays of lists (see <).

public static NDArray<bool> operator <=(NDListArray left, NDListArray right)

Parameters

left NDListArray

The left list array.

right NDListArray

The right list array.

Returns

NDArray<bool>

The bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

A str item meets a bytes item, or a null operand.

operator <=(NDListArray, byte[])

NumPy's lists <= bytes with a C# byte[] (a Python bytes): CPython's TypeError for the first pair.

public static NDArray<bool> operator <=(NDListArray left, byte[] right)

Parameters

left NDListArray

The left operand.

right byte[]

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator <=(NDListArray, object)

NumPy's lists <= x with a C# value.

public static NDArray<bool> operator <=(NDListArray left, object right)

Parameters

left NDListArray

The list array.

right object

The value.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

NotSupportedException

The value has no NumSharp array form.

operator <=(NDListArray, string)

NumPy's lists <= str with a C# string (a Python str): CPython's TypeError for the first pair.

public static NDArray<bool> operator <=(NDListArray left, string right)

Parameters

left NDListArray

The left operand.

right string

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator <=(byte[], NDListArray)

NumPy's bytes <= lists with a C# byte[] (a Python bytes): CPython's TypeError for the first pair.

public static NDArray<bool> operator <=(byte[] left, NDListArray right)

Parameters

left byte[]

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator <=(object, NDListArray)

NumPy's x <= lists with a C# value on the left (the reflected >=).

public static NDArray<bool> operator <=(object left, NDListArray right)

Parameters

left object

The value.

right NDListArray

The list array.

Returns

NDArray<bool>

An empty bool result.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

The first pair's ordering.

NotSupportedException

The value has no NumSharp array form.

operator <=(string, NDListArray)

NumPy's str <= lists with a C# string (a Python str): CPython's TypeError for the first pair.

public static NDArray<bool> operator <=(string left, NDListArray right)

Parameters

left string

The left operand.

right NDListArray

The right operand.

Returns

NDArray<bool>

The result over the list array's shape.

Exceptions

TypeError

The first pair's ordering (an empty array compares nothing).

operator *(NDArray, NDListArray)

NumPy's n * lists (list.rmul): see the reflected form; a str / bytes array on the left is its own repetition by a list (can't multiply sequence by non-int of type 'list').

public static NDListArray operator *(NDArray left, NDListArray right)

Parameters

left NDArray

The counts.

right NDListArray

The list array.

Returns

NDListArray

The repetitions.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

Counts that are not integers.

OverflowException

A count past a C ssize_t.

OutOfMemoryException

A repetition that cannot be allocated.

operator *(NDCharArray, NDListArray)

NumPy's c * lists: the chararray's multiply refuses the object counts.

public static NDListArray operator *(NDCharArray left, NDListArray right)

Parameters

left NDCharArray

The chararray.

right NDListArray

The list array.

Returns

NDListArray

Never returns.

Exceptions

ValueError

Can only multiply by integers.

operator *(NDListArray, NDArray)

NumPy's lists * n: each list repeated by the broadcast integer (or bool) count.

public static NDListArray operator *(NDListArray left, NDArray right)

Parameters

left NDListArray

The list array.

right NDArray

The counts (any integer or bool array; a C# number converts to a 0-d one).

Returns

NDListArray

The repetitions, in NumPy's ufunc output layout.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

Counts that are not integers (can't multiply sequence by non-int of type 'float').

OverflowException

A count past a C ssize_t (cannot fit 'int' into an index-sized integer).

OutOfMemoryException

A repetition that cannot be allocated (NumPy's MemoryError).

operator *(NDListArray, NDCharArray)

NumPy's lists * c with a chararray: the chararray's reflected multiply refuses a non-integer count.

public static NDListArray operator *(NDListArray left, NDCharArray right)

Parameters

left NDListArray

The list array.

right NDCharArray

The chararray.

Returns

NDListArray

Never returns.

Exceptions

ValueError

Can only multiply by integers.

operator *(NDListArray, NDListArray)

NumPy's a * b of two list arrays: list * list, CPython's TypeError for the first pair.

public static NDListArray operator *(NDListArray left, NDListArray right)

Parameters

left NDListArray

The left list array.

right NDListArray

The right list array.

Returns

NDListArray

An empty list array (nothing was multiplied).

Exceptions

ArgumentNullException

An operand is null.

IncorrectShapeException

The shapes do not broadcast.

TypeError

can't multiply sequence by non-int of type 'list'.

operator *(NDListArray, byte[])

NumPy's lists * bytes with a C# byte[] (a Python bytes): CPython's TypeError for the first pair (can't multiply sequence by non-int of type 'str'; with the text on the left, ... of type 'list').

public static NDListArray operator *(NDListArray left, byte[] right)

Parameters

left NDListArray

The left operand.

right byte[]

The right operand.

Returns

NDListArray

The result over the list array's shape (empty: nothing was computed).

Exceptions

TypeError

The first pair's operation (an empty array computes nothing).

operator *(NDListArray, object)

NumPy's lists * x with a C# value (a BigInteger is a Python int of any size; null is None; a list array is list * list).

public static NDListArray operator *(NDListArray left, object right)

Parameters

left NDListArray

The list array.

right object

The count.

Returns

NDListArray

The repetitions.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

A count that is not an integer.

OverflowException

A count past a C ssize_t.

OutOfMemoryException

A repetition that cannot be allocated.

NotSupportedException

The value has no NumSharp array form.

operator *(NDListArray, string)

NumPy's lists * str with a C# string (a Python str): CPython's TypeError for the first pair (can't multiply sequence by non-int of type 'str'; with the text on the left, ... of type 'list').

public static NDListArray operator *(NDListArray left, string right)

Parameters

left NDListArray

The left operand.

right string

The right operand.

Returns

NDListArray

The result over the list array's shape (empty: nothing was computed).

Exceptions

TypeError

The first pair's operation (an empty array computes nothing).

operator *(byte[], NDListArray)

NumPy's bytes * lists with a C# byte[] (a Python bytes): CPython's TypeError for the first pair (can't multiply sequence by non-int of type 'str'; with the text on the left, ... of type 'list').

public static NDListArray operator *(byte[] left, NDListArray right)

Parameters

left byte[]

The left operand.

right NDListArray

The right operand.

Returns

NDListArray

The result over the list array's shape (empty: nothing was computed).

Exceptions

TypeError

The first pair's operation (an empty array computes nothing).

operator *(object, NDListArray)

NumPy's x * lists with a C# value on the left.

public static NDListArray operator *(object left, NDListArray right)

Parameters

left object

The count.

right NDListArray

The list array.

Returns

NDListArray

The repetitions.

Exceptions

IncorrectShapeException

The shapes do not broadcast.

TypeError

A count that is not an integer.

OverflowException

A count past a C ssize_t.

OutOfMemoryException

A repetition that cannot be allocated.

NotSupportedException

The value has no NumSharp array form.

operator *(string, NDListArray)

NumPy's str * lists with a C# string (a Python str): CPython's TypeError for the first pair (can't multiply sequence by non-int of type 'str'; with the text on the left, ... of type 'list').

public static NDListArray operator *(string left, NDListArray right)

Parameters

left string

The left operand.

right NDListArray

The right operand.

Returns

NDListArray

The result over the list array's shape (empty: nothing was computed).

Exceptions

TypeError

The first pair's operation (an empty array computes nothing).