Table of Contents

Class NDMatrix

Namespace
NumSharp
Assembly
NumSharp.dll

NumPy's numpy.matrix: a two-dimensional array whose * is the matrix product, whose rows and columns stay two-dimensional when indexed, and which adds T, H, I, A and A1. Create one with matrix(NDArray, DType, bool), asmatrix(NDArray, DType) or bmat(NDArray[][]). Use it to port NumPy code written against np.matrix; for new code NumPy recommends plain arrays and np.matmul.

public class NDMatrix : NDArray, IIndex, ICloneable, IDisposable, IEnumerable
Inheritance
NDMatrix
Implements
Inherited Members
Extension Methods

Remarks

Members and operators follow the static type. The members and operators of this class are chosen by the compiler when the expression is typed NDMatrix. The same object seen through an NDArray reference (a cast, a variable typed NDArray) is a plain 2-D array to the operators, the indexers and the NDArray members: * is elementwise there, an integer index drops an axis and a.sum(0) has N elements.

The np.* functions follow the object. A public function that receives a matrix object returns the class and the shape NumPy returns for a numpy.matrix operand: np.sum(m, 0) is a 1 x N matrix, np.negative(m), np.transpose(m) and np.linalg.inv(m) are matrices, np.ravel(m) is a plain array, np.stack raises shape too large to be a matrix.. The result is typed NDArray; cast it ((NDMatrix)np.sum(m, 0)) to reach the matrix members, no copy is made. A function whose C# return type is a typed array (isclose(NDArray, NDArray, double, double, bool)) or a struct of arrays (np.gradient, np.meshgrid) returns plain arrays. The mechanisms are declared on the computations and woven into the functions (NumSharp.NDSubclass).

Always two-dimensional. Every matrix result goes through NumPy's finalize rule (NumSharp.Shape.AsMatrix()): a 1-d result becomes a row (1, N), a 0-d result (1, 1), and a result with more than two axes longer than 1 raises shape too large to be a matrix.. Two NumPy quirks are kept: indexing with a new axis (m[Slice.NewAxis]) and an in-place resize can leave a matrix object with another rank.

Scalars. Where NumPy returns a scalar, a member returns a 0-d NDArray when the result is always a scalar (m[0, 0], m.sum()) and a 0-d NDMatrix when it depends on the arguments (m["0, 0"]). A C# number converts implicitly to a 0-d NDMatrix, so m * 2, m + 1.5 and m[mask] = 0 compile. A 0-d matrix is a scalar: * scales by it, and so does every 0-d NDArray that a computation returned (m * m.sum(), m * np.linalg.norm(a), m * a[0, 0]). The exception is NumPy's: an explicit 0-d ARRAY (np.array(2), np.asarray(2); NumSharp.NDArray.IsExplicitZeroDimArray) is an ndarray to matrix.__mul__, so m * np.array(2) is the product with a 1 x 1 matrix and raises shapes (2,3) and (1,1) not aligned unless m has one column. A 0-d array built another way (np.zeros(()), x.reshape(())) still scales, where NumPy raises.

Lifetime. A matrix is an NDArray: it holds one counted reference on its buffer and is released with Dispose() or an NDScope. A matrix that views another array (asmatrix(NDArray, DType), T, a row) keeps that array's buffer alive.

Constructors

NDMatrix(UnmanagedStorage)

Wraps storage as a matrix WITHOUT applying the finalize rule and without copying. Callers must pass a storage object that no other array wraps: an in-place shape change of either array would otherwise show through the other.

public NDMatrix(UnmanagedStorage storage)

Parameters

storage UnmanagedStorage

The storage to wrap. Its shape becomes the matrix's shape as it is (two axes, or zero axes for the scalar stand-in; see the file header).

Remarks

The constructor a subclass of the matrix chains to (: base(storage)). To build a matrix from data, use asmatrix(NDArray, DType) or np.matrix: they apply NumPy's finalize rule, which this constructor skips, so a storage of three axes here gives a three-axis matrix NumPy could never hold.

Exceptions

NullReferenceException

storage is null.

Fields

__name__

NumPy's class name (matrix.name), for its error texts; NumSharp.Build's weave reads it to find the array subclasses and name them in the generated method dispatch.

protected const string __name__ = "matrix"

Field Value

string

Properties

A

NumPy's matrix.A: this matrix as a plain NDArray of the same shape. Use it to leave the matrix semantics: m.A * m.A is elementwise and m.A[0] is 1-d.

public NDArray A { get; }

Property Value

NDArray

A new array object over the same memory (a view; writes reach the matrix). It keeps the matrix's buffer alive while it lives.

Remarks

A cast ((NDArray)m) gives the plain semantics too, without a new object.

A1

NumPy's matrix.A1: the elements as a 1-d NDArray in C order (m.A.ravel()).

public NDArray A1 { get; }

Property Value

NDArray

A view when the matrix is C-contiguous (writes reach the matrix), otherwise a copy, exactly as ravel decides.

H

NumPy's matrix.H: the conjugate transpose. For a matrix that is not complex it is the plain transpose.

public NDMatrix H { get; }

Property Value

NDMatrix

A new matrix holding the conjugated elements for a complex matrix; for every other dtype the same VIEW as T, so writes reach this matrix there and not for a complex one.

I

NumPy's matrix.I: the multiplicative inverse of a square matrix (np.linalg.inv), the Moore-Penrose pseudo-inverse of any other (np.linalg.pinv).

public NDMatrix I { get; }

Property Value

NDMatrix

A new matrix. An integer or bool matrix gives float64; float32 stays float32.

Exceptions

LinAlgError

A square matrix is singular.

TypeError

The dtype is not supported by np.linalg (float16, decimal, char).

NotSupportedException

The matrix is not square and no LAPACK backend is installed: the pseudo-inverse needs a singular value decomposition, which NumSharp.Core does not carry (reference NumSharp.Interop.OpenBLAS).

ValueError

The matrix object is not two-dimensional (possible only after the rank quirks named on the class): NumPy's M, N = self.shape fails to unpack.

this[long, long]

The element at (row, column) as a 0-d NDArray, NumPy's scalar (NumPy's m[i, j] returns a scalar, not a matrix). Assigning stores one element. Two int arguments bind here too (they convert to long).

public NDArray this[long row, long column] { get; set; }

Parameters

row long

The row; negative counts from the end.

column long

The column; negative counts from the end.

Property Value

NDArray

NumPy's scalar: a read-only 0-d COPY of the element, which does not change when the matrix does (matrix.getitem returns ndarray.getitem's item unwrapped). Convert it with a cast ((double)m[0, 1]); write an element through the setter.

Remarks

The one C# form beside the general indexer, kept because its TYPE differs: the general indexer is typed NDMatrix (a row, a column, a matrix view), while this element access is typed as the scalar it returns, and it checks both integers inline, so the hot element read allocates no index array. C# prefers it for two integer arguments (a conversion to long is better than one to object).

Exceptions

IndexError

An index is out of bounds, or the matrix object does not have two axes.

ValueError

(set) The matrix is read-only, or the value is an array with one or more axes (NumPy's setting an array element with a sequence.).

TypeError

(set) An array with one or more axes into a complex matrix (NumPy's only 0-dimensional arrays can be converted to Python scalars).

this[object[]]

NumPy's matrix.getitem(index) as the one C# indexer: integers, slices, slice notation, index arrays, boolean masks and sequences in any mix, under the matrix rule (file header): a 1-d selection comes back as a row, or as a column when the second entry is a scalar. A boolean matrix from a comparison is an index too: m[m > 5] is a (1, K) row.

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

Parameters

key object[]

The index tuple (NumPy's index tuple; a Slice[] or object[] passed alone is the tuple itself, a single C# tuple entry is spread). A slice-notation string may hold several entries (m["1:3, 0"], m["..., 0"]); an index with a new axis returns a matrix object with three axes, as NumPy does.

Property Value

NDMatrix

A view for an index of integers and slices (m[0] and m[0, ":"] are rows, m[":", 0] a column), a new matrix when an index array or a mask is involved; the 0-d scalar stand-in when the selection has no axis left (prefer this[long, long], which is typed as a scalar).

Remarks

The C# setter type. The value assigned through this indexer is an NDMatrix or a C# number (which converts implicitly to a 0-d matrix). Assign any other value (an NDArray, a list) with __setitem__(object, object).

Static, not virtual. This indexer HIDES this[object[]] instead of overriding it: the matrix rule applies through an NDMatrix reference, and through an NDArray reference a matrix is indexed as a plain 2-d array, which the library's own code relies on (an NDArray member reached through the matrix object computes on its plain view, NumSharp.PlainReceiverAttribute).

Dispatch. An index of integers, slices and slice strings takes the view route (one rule for the row / column shape, NumPy's index errors, and the source's read-only flag kept on the view): the body of the old typed this[int], this[long], this[string] and this[params Slice[]]. Any other index runs the plain array's advanced indexing and is shaped by the matrix rule (the old this[NDArray<bool>] and this[params NDArray<int>[]] took the same route).

Exceptions

ArgumentNullException

key or (set) the value is null.

IndexError

An index is out of bounds, too many entries, a second ellipsis, or index arrays that do not broadcast together (NumPy's texts, checked before the storage is touched).

ValueError

(set) The matrix is read-only (checked first), or the value does not fit the selection (a 1-d value assigned to a COLUMN raises, as in NumPy: a column is (N, 1)).

ReprClassName

The class name NumPy's repr() prints before the opening parenthesis: array for an ndarray, the subclass name for a subclass (type(arr).name in _array_repr_implementation). Override it in a subclass that NumPy prints under another name; the continuation lines and a wrapped dtype= suffix are aligned to this name's length, so it changes the layout of the whole repr, not the first word alone.

protected override string ReprClassName { get; }

Property Value

string

The name without the parenthesis. Never null or empty.

Remarks

A subclass declared outside NumSharp.dll overrides it as protected override; NumPy prints a user subclass under its own name, which is what such an override should return.

Shape

The shape. Assigning reshapes IN PLACE to the given dimensions and folds them onto two axes; see shape.

public Shape Shape { get; set; }

Property Value

Shape

The shape descriptor (dimensions, strides, flags).

Exceptions

AttributeError

(set) The new dimensions need a copy.

IncorrectShapeException

(set) The new size differs from the matrix's size.

ValueError

(set) More than two of the new dimensions are longer than 1; the matrix keeps its old shape.

T

NumPy's matrix.T: the transpose, as a matrix.

public NDMatrix T { get; }

Property Value

NDMatrix

A view with the two axes exchanged (writes reach this matrix).

__array_priority__

NumPy's matrix.array_priority, 10.0: above an ndarray's and a chararray's 0.0, so the class wrap of a ufunc result and the subtype of a sequence function (np.concatenate) are a matrix whenever one operand is. The operators of this class resolve a mixed operation at compile time; the public functions read it at run time.

public override double __array_priority__ { get; }

Property Value

double

imag

The imaginary part, as a matrix. For a complex matrix a VIEW of the imaginary components; for every other dtype a READ-ONLY matrix of zeros. Assigning stores into the imaginary parts of a complex matrix.

public NDMatrix imag { get; set; }

Property Value

NDMatrix

The imaginary part.

Exceptions

TypeError

(set) The matrix is not complex (array does not have imaginary part to set).

ValueError

(set) The matrix is read-only, or the value does not broadcast.

mT

NumPy's m.mT: the matrix transpose; for a matrix the same as T.

public NDMatrix mT { get; }

Property Value

NDMatrix

A view.

Exceptions

ArgumentException

The matrix object has fewer than two axes (the 0-d scalar stand-in).

real

The real part, as a matrix. For a complex matrix a VIEW of the real components (writes reach the matrix); for every other dtype the matrix ITSELF. Assigning stores into the real parts.

public NDMatrix real { get; set; }

Property Value

NDMatrix

The real part.

Exceptions

ValueError

(set) The matrix is read-only, or the value does not broadcast.

shape

The dimensions. Assigning reshapes the matrix IN PLACE and folds the new shape back onto two axes, as NumPy does: m.shape = (6,) gives (1, 6).

public long[] shape { get; set; }

Property Value

long[]

A copy of the dimensions ((rows, columns)).

Exceptions

AttributeError

(set) The new dimensions need a copy (a non-contiguous matrix).

IncorrectShapeException

(set) The new size differs from the matrix's size.

ValueError

(set) More than two of the new dimensions are longer than 1 (shape too large to be a matrix.); the matrix keeps its old shape.

Methods

Clone()

A deep copy that is a matrix again. It HIDES Clone() and does not override it, on purpose: library code that clones an array it holds as NDArray must get a plain array back. Which np.* function returns a matrix is decided by its rule (the mechanism declared on its computation, NumSharp.NDSubclass), never by whether its body happens to clone the operand.

public NDMatrix Clone()

Returns

NDMatrix

A new matrix owning a copy of the data.

Equals(object)

Value equality, as for NDArray: true when every element compares equal after broadcasting. Declared because this class declares ==.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with.

Returns

bool

true when all elements are equal; false for null.

GetEnumerator()

Iterates the rows. Each item is a (1, N) NDMatrix VIEW, as in NumPy, where iterating an NDArray of the same shape yields 1-d rows.

public IEnumerator GetEnumerator()

Returns

IEnumerator

An enumerator over the rows; nothing for a matrix with no rows.

Remarks

Each row holds a counted reference on the buffer: dispose the rows in a hot loop, or iterate inside an NDScope.

Exceptions

TypeError

The matrix is the 0-d scalar stand-in (iteration over a 0-d array).

GetHashCode()

Always throws: an array is mutable and therefore unhashable, as in NumPy.

public override int GetHashCode()

Returns

int

Never returns.

Exceptions

NotSupportedException

Always.

NanMax(NDAxis?, NDArray, bool, object, NDArray)

np.nanmax of a matrix: NumPy's nanmax sends any operand that is not a base ndarray down its branch "slow, but safe for subclasses of ndarray" (NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool)), which ends in this class's own max. A 0-d matrix is a NumPy scalar (a C# number converted to the class), computed as a base ndarray.

protected override NDArray NanMax(NDAxis? axis, NDArray @out, bool keepdims, object initial, NDArray where)

Parameters

axis NDAxis?

The axis to reduce, or null for every axis.

out NDArray

NumPy's out=, or null: a matrix gets the method's answer, a plain array the values and then the method's AttributeError.

keepdims bool

The caller's keepdims; true is matrix.max's TypeError.

initial object

The caller's initial value; any value is matrix.max's TypeError.

where NDArray

The caller's mask; any mask is matrix.max's TypeError.

Returns

NDArray

See NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool).

Remarks

NoInlining | NoOptimization, like every override of a NumSharp.SubclassAwareAttribute member: the test-time caller audit stops its stack walk at this frame, and optimized code may tail-call NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool) and take the frame off the stack, which makes np.nanmax look like a library caller (the chararray override's failure on PR #633's CI). The guard test SubclassAuditFrameTests holds every override to it.

Exceptions

TypeError

See NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool).

AttributeError

See NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool).

ValueError

See NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool).

AxisError

axis is out of bounds.

NanMin(NDAxis?, NDArray, bool, object, NDArray)

np.nanmin of a matrix: NumPy's branch for subclasses (NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool)), ending in this class's own min; a 0-d matrix is a NumPy scalar, computed as a base ndarray.

protected override NDArray NanMin(NDAxis? axis, NDArray @out, bool keepdims, object initial, NDArray where)

Parameters

axis NDAxis?

The axis to reduce, or null for every axis.

out NDArray

NumPy's out=, or null.

keepdims bool

The caller's keepdims; true is matrix.min's TypeError.

initial object

The caller's initial value; any value is matrix.min's TypeError.

where NDArray

The caller's mask; any mask is matrix.min's TypeError.

Returns

NDArray

See NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool).

Remarks

The frame stays on the stack for the caller audit, as for NanMax(NDAxis?, NDArray, bool, object, NDArray).

Exceptions

TypeError

See NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool).

AttributeError

See NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool).

ValueError

See NanExtreme(NDAxis?, NDArray, bool, object, NDArray, bool).

AxisError

axis is out of bounds.

__array_finalize__(NDArray, bool, NewSubtypeZeroDim)

NumPy's creation of a result as a matrix (Py_TYPE(self), then matrix.array_finalize): a matrix view of created under the finalize rule, or WITHOUT it for a result NumPy made by indexing the matrix with a new axis (np.atleast_3d(m) is the 3-d matrix object m[:, :, newaxis], whose _getitem flag switches the rule off).

protected override NDArray __array_finalize__(NDArray created, bool keepRank, NewSubtypeZeroDim zeroDim)

Parameters

created NDArray

The result computed plain.

keepRank bool

Skip the finalize rule (the indexing case).

zeroDim NewSubtypeZeroDim

Unused: a matrix's 0-d result is the finalize rule's 1 x 1 matrix.

Returns

NDArray

created when it is a matrix, else a new matrix view of it.

Exceptions

ValueError

More than two axes longer than 1, unless keepRank.

__array_wrap__(NDArray)

NumPy's array_wrap for a matrix, which is ndarray's (array.view(type(self))) followed by matrix.array_finalize: a matrix view of array under the finalize rule (a 1-d result is a 1 x N row). An array that already is a matrix comes back itself (a matrix out=, an operand handed back).

protected override NDArray __array_wrap__(NDArray array)

Parameters

array NDArray

The result to wrap.

Returns

NDArray

array when it is a matrix, else a new matrix view of it (never an owner).

Exceptions

ValueError

More than two axes longer than 1 (shape too large to be a matrix.).

__getitem__(object)

NumPy's matrix.getitem(index): the same as m[index] (see this[object[]]).

public NDMatrix __getitem__(object index)

Parameters

index object

The index as Python passes it: one entry (an integer, slice notation, a Slice, an index array, a mask) or the whole index tuple — an object[] / Slice[] or a C# tuple. A typed C# array other than Slice[] (int[], bool[]) is ONE entry, NumPy's list.

Returns

NDMatrix

The selection under the matrix rule: a row for one integer, the 0-d scalar stand-in for two.

Remarks

One member, NumPy's signature (it replaced the int, long, string and params int[] forms; coordinates are a tuple: m.getitem((1, 2))).

Exceptions

ArgumentNullException

index is null.

IndexError

An index is out of bounds, more entries than axes, or an invalid index.

__imul__(object)

Python's m *= other: computes m * other and stores it IN this matrix (self[:] = self * other). C#'s own m *= x rebinds the variable to a new matrix instead; call this method when other references to the matrix must see the product.

public NDMatrix __imul__(object other)

Parameters

other object

A matrix, an array, a sequence or a number.

Returns

NDMatrix

This matrix.

Remarks

The product is cast to this matrix's dtype with an unsafe cast, as NumPy's assignment does: an int matrix times 2.5 keeps truncated integers.

Exceptions

ArgumentNullException

other is null.

ArgumentException

The inner dimensions differ.

ValueError

This matrix is read-only, or the product's shape is not this matrix's shape (could not broadcast input array from shape (2,3) into shape (2,2)).

NotSupportedException

The operand holds strings or other objects.

__ipow__(object)

Python's m **= other: computes the power and stores it IN this matrix (self[:] = self ** other).

public NDMatrix __ipow__(object other)

Parameters

other object

The exponent (see __pow__(object)).

Returns

NDMatrix

This matrix.

Remarks

The result is cast to this matrix's dtype with an unsafe cast: the inverse of an integer matrix is truncated.

Exceptions

LinAlgError

The matrix is not square, or a negative power of a singular matrix.

TypeError

The exponent is not an integer.

ValueError

This matrix is read-only.

__iter__()

Python's iter(m): the same as GetEnumerator().

public IEnumerator __iter__()

Returns

IEnumerator

An enumerator over the rows as (1, N) matrices.

Exceptions

TypeError

The matrix is the 0-d scalar stand-in.

__mul__(object)

Python's m.mul(other): the same as m * other.

public NDMatrix __mul__(object other)

Parameters

other object

A matrix, an array, a sequence or a number.

Returns

NDMatrix

The product as a new matrix.

Exceptions

ArgumentNullException

other is null.

ArgumentException

The inner dimensions differ.

ValueError

The operand is ragged or cannot be seen as a matrix.

NotSupportedException

The operand holds strings or other objects.

__pow__(int)

NumPy's m ** n: the matrix power (np.linalg.matrix_power), m multiplied by itself n times. Zero gives the identity, a negative power inverts first.

public NDMatrix __pow__(int n)

Parameters

n int

The integer power.

Returns

NDMatrix

This matrix ITSELF for n == 1 (as NumPy); a new matrix otherwise. A negative power of an integer matrix is float64.

Exceptions

LinAlgError

The matrix is not square (Last 2 dimensions of the array must be square), or a negative power of a singular matrix (Singular matrix).

TypeError

A negative power of a dtype np.linalg does not support.

__pow__(object)

NumPy's m ** other for an exponent of any kind: an integer, a bool or a 0-d integer array is the power; anything else is refused.

public NDMatrix __pow__(object other)

Parameters

other object

The exponent.

Returns

NDMatrix

The power; see __pow__(int).

Exceptions

LinAlgError

The matrix is not square (tested BEFORE the exponent, as NumPy does), or a negative power of a singular matrix.

TypeError

The exponent is not an integer (exponent must be an integer).

OverflowException

The exponent does not fit int.

__rmul__(object)

Python's m.rmul(other): other * m, with other on the LEFT.

public NDMatrix __rmul__(object other)

Parameters

other object

An array, a sequence or a number.

Returns

NDMatrix

The product as a new matrix.

Exceptions

ArgumentNullException

other is null.

ArgumentException

The inner dimensions differ.

ValueError

The operand is ragged, or the product cannot be a matrix.

NotSupportedException

The operand holds strings or other objects.

__rpow__(object)

Python's other ** m. NumPy's matrix does not define it (rpow returns NotImplemented), so a number base is an error; an ARRAY base is ndarray's own elementwise power, wrapped as a matrix.

public NDMatrix __rpow__(object other)

Parameters

other object

The base.

Returns

NDMatrix

np.power(other, m) as a matrix when other is an array.

Exceptions

TypeError

other is not an array: Python's unsupported operand type(s) for ** or pow(): 'int' and 'matrix'.

ValueError

The broadcast result has more than two axes longer than 1.

__setitem__(object, object)

Python's m[index] = value for ANY value: an NDArray, a C# array, a list or tuple, or a number. Use it where the indexer does not accept the value (it takes an NDMatrix or a number).

public void __setitem__(object index, object value)

Parameters

index object

One index entry, or the whole index tuple as an object[] or a C# tuple.

value object

The value. A 1-d value assigned to a COLUMN raises, as in NumPy: a column is (N, 1).

Remarks

One member (it replaced the int, long and string index forms). It HIDES __setitem__(object, object): numpy.matrix inherits ndarray's setitem, whose view assignment goes through the subclass's own getitem, so the matrix rule applies here.

Exceptions

ArgumentNullException

value is null.

IndexError

The index is invalid for this matrix.

ValueError

The matrix is read-only, the value does not broadcast to the selection, or an array is assigned to a single element.

_collapse(NDArray, NDAxis?)

NumPy's matrix._collapse(axis) (self[0, 0] if axis is None else self) after a keepdims=True reduction, applied to the plain reduction (keepdims=False) NumPy's function computed: the scalar without an axis, a column (N, 1) along the last axis, a row or the matrix itself otherwise.

protected override NDArray _collapse(NDArray result, NDAxis? axis)

Parameters

result NDArray

The plain reduction, unaliased (a matrix result, or null, comes back itself).

axis NDAxis?

The caller's axis: null for None (the scalar), an int or a one-axis tuple (row or column for the 1-d plain result), or any other tuple (the kept-dims matrix: (1, 1) for (0, 1), the whole matrix for ()).

Returns

NDArray

The 0-d result, a matrix view of it, or result.

Exceptions

ValueError

More than two axes longer than 1.

all(int, NDArray)

NumPy's matrix.all(axis) for a given axis: whether every element along the axis is true, as a bool matrix that keeps the reduced axis with length 1.

public NDMatrix all(int axis, NDArray @out = null)

Parameters

axis int

The axis to test along.

out NDArray

Must be null (NumPy's matrix.all cannot take one; see any(int, NDArray)).

Returns

NDMatrix

The bool matrix.

Remarks

The C#-typed form of all(NDAxis?, NDArray) for an int axis (C# prefers it there, an exact match): the answer is always a matrix, so the declared type says so.

Exceptions

AxisError

axis is out of bounds.

TypeError

out is not null.

all(NDAxis?, NDArray)

NumPy's matrix.all(axis=None, out=None): ndarray.all(self, axis, out, keepdims=True)._collapse(axis) - a bool scalar without an axis, otherwise a bool matrix that keeps the reduced axes with length 1.

public NDArray all(NDAxis? axis = null, NDArray @out = null)

Parameters

axis NDAxis?

The axis, a tuple of axes ((0, 1) gives the 1 x 1 matrix, () the truth values as a matrix), or null to test every element.

out NDArray

Must be null.

Returns

NDArray

A 0-d bool array when axis is null; otherwise the bool matrix.

Remarks

The target of np.all's generated matrix dispatch ([NumPyMethod]), which hands it np.all's own NDAxis by name and type: a tuple reaches it since API-parity batch 4 (2026-11-12), where the int? axis it took gave a tuple call no matrix arm (a plain result).

Exceptions

AxisError

An axis is out of bounds.

ValueError

A tuple names an axis twice (duplicate value in 'axis').

TypeError

out is not null.

any(int, NDArray)

NumPy's matrix.any(axis) for a given axis: whether any element along the axis is true, as a bool matrix that keeps the reduced axis with length 1.

public NDMatrix any(int axis, NDArray @out = null)

Parameters

axis int

The axis to test along.

out NDArray

Must be null. NumPy's matrix.any hands an out to the argument slot of dtype, so every call with one fails.

Returns

NDMatrix

The bool matrix.

Remarks

The C#-typed form of any(NDAxis?, NDArray) for an int axis (C# prefers it there, an exact match): the answer is always a matrix, so the declared type says so.

Exceptions

AxisError

axis is out of bounds.

TypeError

out is not null (NumPy's Cannot construct a dtype from an array).

any(NDAxis?, NDArray)

NumPy's matrix.any(axis=None, out=None): ndarray.any(self, axis, out, keepdims=True)._collapse(axis) - a bool scalar without an axis, otherwise a bool matrix that keeps the reduced axes with length 1.

public NDArray any(NDAxis? axis = null, NDArray @out = null)

Parameters

axis NDAxis?

The axis, a tuple of axes ((0, 1) gives the 1 x 1 matrix, () the truth values as a matrix), or null to test every element.

out NDArray

Must be null (see any(int, NDArray)).

Returns

NDArray

A 0-d bool array when axis is null; otherwise the bool matrix.

Remarks

The target of np.any's generated matrix dispatch ([NumPyMethod]), which hands it np.any's own NDAxis by name and type: a tuple reaches it since API-parity batch 4 (2026-11-12), where the int? axis it took gave a tuple call no matrix arm (a plain result).

Exceptions

AxisError

An axis is out of bounds.

ValueError

A tuple names an axis twice (duplicate value in 'axis').

TypeError

out is not null.

argmax(int, NDArray)

NumPy's matrix.argmax(axis, out) for a given axis: the index of the first maximum along the axis, as a row (1, N) for axis 0 and a column (M, 1) for axis 1. The flat form m.argmax() is the inherited member and returns a long.

public NDMatrix argmax(int axis, NDArray @out = null)

Parameters

axis int

0 or 1. NumPy's matrix rejects every other value, also -1 and -2.

out NDArray

Must be null in practice: NumPy's method fails for every out (see the exceptions).

Returns

NDMatrix

The int64 indices as a matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

axis is a valid negative axis (unsupported axis), the reduced axis is empty, or out does not have the 1-d result's shape (output array does not match result of np.argmax.; a matrix never has it).

AttributeError

out is a plain array of the right shape: NumPy writes the indices into it and then fails on out._align.

argmax(NDAxis?, NDArray)

NumPy's matrix.argmax(axis=None, out=None) as the generated dispatch of np.argmax calls it (_wrapfunc): along an axis the aligned index matrix of argmax(int, NDArray); without one _align(None), the flat index as a 0-d array.

public NDArray argmax(NDAxis? axis, NDArray @out = null)

Parameters

axis NDAxis?

The axis (0 or 1), or null for the flat index. Deliberately without a default: an m.argmax() call keeps binding the inherited flat member.

out NDArray

Must be null in practice: NumPy's method fails on every out (see the exceptions).

Returns

NDArray

The 0-d flat index without an axis; otherwise the int64 index matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

An unsupported (negative) axis, an empty reduction, or a misshapen out.

AttributeError

out is a plain array NumPy's reduction accepted: _align does not exist on it.

argmin(int, NDArray)

NumPy's matrix.argmin(axis, out) for a given axis; see argmax(int, NDArray).

public NDMatrix argmin(int axis, NDArray @out = null)

Parameters

axis int

0 or 1.

out NDArray

Must be null in practice.

Returns

NDMatrix

The int64 indices as a matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

An unsupported axis, an empty reduction, or a misshapen out.

AttributeError

out is a plain array of the right shape.

argmin(NDAxis?, NDArray)

NumPy's matrix.argmin(axis=None, out=None) as np.argmin's generated dispatch calls it; see argmax(NDAxis?, NDArray).

public NDArray argmin(NDAxis? axis, NDArray @out = null)

Parameters

axis NDAxis?

The axis (0 or 1), or null for the flat index (no default, see argmax).

out NDArray

Must be null in practice.

Returns

NDArray

The 0-d flat index without an axis; otherwise the int64 index matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

An unsupported axis, an empty reduction, or a misshapen out.

AttributeError

out is a plain array NumPy's reduction accepted.

argpartition(int, int?, string, string)

The indices that partition the matrix around the kth element along an axis, as a matrix (NumPy's m.argpartition(kth, axis)).

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

Parameters

kth int

The element position that ends up in its sorted place.

axis int?

The axis (default: the last), or null for the flattened matrix.

kind string

Only "introselect".

order string

Must be null (no structured dtypes).

Returns

NDMatrix

A new int64 matrix.

Exceptions

ValueError

kth is out of bounds, an unknown kind, or an order.

AxisError

axis is out of bounds.

argsort(int?)

The indices that sort the matrix along an axis, as a matrix (NumPy's m.argsort(axis)); with null the indices of the flattened matrix as a row.

public NDMatrix argsort(int? axis = -1)

Parameters

axis int?

The axis (default: the last), or null.

Returns

NDMatrix

A new int64 matrix.

Exceptions

AxisError

axis is out of bounds.

astype(DType, char, string, bool)

Copy of the matrix cast to dtype with a memory order and a casting rule, as a matrix (NumPy's m.astype(dtype, order='K', casting='unsafe', copy=True)).

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

Parameters

dtype DType

The target dtype.

order char

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

casting string

NumPy's casting rule name ("unsafe", "same_kind", "safe", "equiv", "no").

copy bool

false returns this matrix itself when nothing has to change.

Returns

NDMatrix

A new matrix that owns its data, or this matrix.

Remarks

One signature in NumPy's keyword order (API-parity batch 3, 2026-11-11): it replaces the former astype(dtype, copy) / astype(dtype, copy, order, casting) pair, so a.astype(t, 'F') reads as in NumPy and a copy is written copy: false (a bool in the order slot does not compile). subok stays out (the parity plan's exclusion).

Exceptions

InvalidCastException

The cast is not allowed under casting.

ValueError

An unknown order or casting name.

byteswap(bool)

The matrix with its bytes swapped, as a matrix.

public NDMatrix byteswap(bool inplace = false)

Parameters

inplace bool

true swaps this matrix's own bytes and returns this matrix.

Returns

NDMatrix

A new matrix, or this matrix when inplace is true.

Exceptions

ValueError

inplace on a read-only matrix.

choose(NDArray[], string)

Builds a matrix by picking, per element, from choices the array this matrix's integer value names (NumPy's m.choose(choices, mode)).

public NDMatrix choose(NDArray[] choices, string mode = "raise")

Parameters

choices NDArray[]

The arrays to choose from; they broadcast against this matrix.

mode string

"raise", "wrap" or "clip" for a value out of range.

Returns

NDMatrix

A new matrix.

Exceptions

ValueError

A value is out of range under "raise", or the shapes do not broadcast.

ArgumentException

An unknown mode.

clip(NDArray, NDArray)

The elements limited to an interval, as a matrix (NumPy's m.clip(min, max)).

public NDMatrix clip(NDArray min = null, NDArray max = null)

Parameters

min NDArray

The lower bound, or null for none. It broadcasts against the matrix.

max NDArray

The upper bound, or null for none. With no bound at all the result is a copy.

Returns

NDMatrix

A matrix (a view of the computed array).

Exceptions

IncorrectShapeException

A bound does not broadcast against the matrix.

compress(NDArray, int?)

The rows or columns where condition is true, as a matrix (NumPy's m.compress(condition, axis)); without an axis the flattened elements as a row.

public NDMatrix compress(NDArray condition, int? axis = null)

Parameters

condition NDArray

A 1-d bool array.

axis int?

The axis to select along, or null.

Returns

NDMatrix

A new matrix that owns its data.

Exceptions

ValueError

condition is not 1-d.

IndexError

condition is longer than the axis.

AxisError

axis is out of bounds.

conj()

The complex conjugate, as a matrix. A matrix that is not complex is returned ITSELF (as NumPy does), not a copy.

public NDMatrix conj()

Returns

NDMatrix

The conjugated matrix, or this matrix.

conjugate()

The complex conjugate, as a matrix. A matrix that is not complex is returned ITSELF (as NumPy does), not a copy.

public NDMatrix conjugate()

Returns

NDMatrix

The conjugated matrix, or this matrix.

copy(char)

A copy of the matrix, as a matrix (NumPy's m.copy(order)).

public NDMatrix copy(char order = 'C')

Parameters

order char

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

Returns

NDMatrix

A new matrix that owns its data.

Exceptions

ArgumentException

An unknown order.

cumprod(int?, DType)

The running product along an axis, as a matrix (NumPy's m.cumprod(axis, dtype)).

public NDMatrix cumprod(int? axis = null, DType dtype = null)

Parameters

axis int?

The axis, or null for the flattened matrix (a row).

dtype DType

The dtype of the products, or null for NumPy's default.

Returns

NDMatrix

A matrix (a view of the computed array).

Exceptions

AxisError

axis is out of bounds.

cumsum(int?, DType)

The running sum along an axis, as a matrix (NumPy's m.cumsum(axis, dtype)); without an axis the running sum of the flattened matrix as a row.

public NDMatrix cumsum(int? axis = null, DType dtype = null)

Parameters

axis int?

The axis, or null.

dtype DType

The dtype of the sums, or null for NumPy's default.

Returns

NDMatrix

A matrix (a view of the computed array).

Exceptions

AxisError

axis is out of bounds.

diagonal(int, int, int)

The diagonal as a ROW (1, K) (NumPy's m.diagonal()).

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

Parameters

offset int

0 for the main diagonal, positive above it, negative below.

axis1 int

The first axis of the plane.

axis2 int

The second axis of the plane.

Returns

NDMatrix

A READ-ONLY view of the diagonal.

Exceptions

AxisError

An axis is out of bounds.

ArgumentException

The two axes are the same.

dot(NDArray)

NumPy's m.dot(b): the dot product through the ARRAY method, folded onto two axes. With a 1-d b of length N the product of an (M, N) matrix is the 1-d vector of length M, which comes back as a ROW (1, M) — not the column a matrix product would give.

public NDMatrix dot(NDArray b)

Parameters

b NDArray

The right operand, as it is (it is NOT seen as a matrix first, unlike m * b).

Returns

NDMatrix

A new matrix.

Exceptions

ArgumentException

The shapes are not aligned.

ValueError

The product has more than two axes longer than 1.

flatten(char)

NumPy's matrix.flatten(order='C'): a COPY of the elements as one row (1, size).

public NDMatrix flatten(char order = 'C')

Parameters

order char

'C' row-major, 'F' column-major, 'A' column-major when the matrix is F-contiguous, 'K' memory order.

Returns

NDMatrix

A new (1, size) matrix that owns its data.

Exceptions

ArgumentException

order is not one of the four codes.

getA()

NumPy's matrix.getA(): the same as A.

public NDArray getA()

Returns

NDArray

A plain array view of this matrix.

getA1()

NumPy's matrix.getA1(): the same as A1.

public NDArray getA1()

Returns

NDArray

The elements as a 1-d array.

getH()

NumPy's matrix.getH(): the same as H.

public NDMatrix getH()

Returns

NDMatrix

The conjugate transpose.

getI()

NumPy's matrix.getI(): the same as I.

public NDMatrix getI()

Returns

NDMatrix

The inverse or pseudo-inverse.

Exceptions

LinAlgError

A square matrix is singular.

TypeError

The dtype is not supported by np.linalg.

NotSupportedException

A non-square matrix without a LAPACK backend.

ValueError

The matrix object is not two-dimensional.

getT()

NumPy's matrix.getT(): the same as T.

public NDMatrix getT()

Returns

NDMatrix

The transposed matrix (a view).

getfield(DType, int)

A field of the matrix's elements read as dtype at a byte offset, as a matrix (a view).

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

Parameters

dtype DType

The dtype of the field.

offset int

The byte offset inside each element.

Returns

NDMatrix

A view of the field.

Exceptions

ValueError

The field does not fit inside an element.

max(int, NDMatrix)

NumPy's matrix.max(axis, out) for a given axis: the maxima as a matrix that keeps the reduced axis with length 1.

public NDMatrix max(int axis, NDMatrix @out = null)

Parameters

axis int

The axis to reduce along.

out NDMatrix

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

Returns

NDMatrix

The maxima; out itself when it is given.

Exceptions

AxisError

axis is out of bounds.

ValueError

The reduced axis is empty (zero-size array to reduction operation maximum which has no identity), or out is read-only or misshapen.

max(NDAxis?, NDArray)

NumPy's matrix.max(axis=None, out=None); the largest element as a scalar without an axis.

public NDArray max(NDAxis? axis = null, NDArray @out = null)

Parameters

axis NDAxis?

The axis, or null for the maximum of every element. A tuple reduces the axes it names together and keeps them with length 1, as every axis but None does (the (1, 1) matrix for (0, 1), the whole matrix for ()).

out NDArray

A matrix of the kept shape, or null.

Returns

NDArray

A 0-d array when axis is null; otherwise the matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

An empty reduction, or out is read-only or misshapen.

AttributeError

out is a plain (non-matrix) array: NumPy's reduction stores into it, then _collapse does not exist on it ('numpy.ndarray' object has no attribute '_collapse').

mean(int, DType, NDMatrix)

NumPy's matrix.mean(axis, dtype, out) for a given axis: the means as a matrix that keeps the reduced axis with length 1.

public NDMatrix mean(int axis, DType dtype = null, NDMatrix @out = null)

Parameters

axis int

The axis to average along.

dtype DType

The dtype the mean is computed in, or null: float64 for an integer or bool matrix, the matrix's own dtype for a float one.

out NDMatrix

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

Returns

NDMatrix

The means; out itself when it is given.

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape.

mean(NDAxis?, DType, NDArray)

NumPy's matrix.mean(axis=None, dtype=None, out=None); a scalar without an axis.

public NDArray mean(NDAxis? axis = null, DType dtype = null, NDArray @out = null)

Parameters

axis NDAxis?

The axis, or null for the mean of every element. A tuple reduces the axes it names together and keeps them with length 1, as every axis but None does (the (1, 1) matrix for (0, 1), the whole matrix for ()).

dtype DType

The dtype the mean is computed in, or null for NumPy's default.

out NDArray

A matrix of the kept shape, or null. NumPy stores the SUM into it and then divides it in place, both with an unsafe cast, so an integer out holds truncated values.

Returns

NDArray

A 0-d array when axis is null; otherwise the matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape.

AttributeError

out is a plain (non-matrix) array: NumPy's reduction stores into it, then _collapse does not exist on it ('numpy.ndarray' object has no attribute '_collapse').

min(int, NDMatrix)

NumPy's matrix.min(axis, out) for a given axis: the minima as a matrix that keeps the reduced axis with length 1.

public NDMatrix min(int axis, NDMatrix @out = null)

Parameters

axis int

The axis to reduce along.

out NDMatrix

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

Returns

NDMatrix

The minima; out itself when it is given.

Exceptions

AxisError

axis is out of bounds.

ValueError

An empty reduction, or out is read-only or misshapen.

min(NDAxis?, NDArray)

NumPy's matrix.min(axis=None, out=None); the smallest element as a scalar without an axis.

public NDArray min(NDAxis? axis = null, NDArray @out = null)

Parameters

axis NDAxis?

The axis, or null for the minimum of every element. A tuple reduces the axes it names together and keeps them with length 1, as every axis but None does (the (1, 1) matrix for (0, 1), the whole matrix for ()).

out NDArray

A matrix of the kept shape, or null.

Returns

NDArray

A 0-d array when axis is null; otherwise the matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

An empty reduction, or out is read-only or misshapen.

AttributeError

out is a plain (non-matrix) array: NumPy's reduction stores into it, then _collapse does not exist on it ('numpy.ndarray' object has no attribute '_collapse').

prod(int, DType, NDMatrix)

NumPy's matrix.prod(axis, dtype, out) for a given axis: the products as a matrix that keeps the reduced axis with length 1.

public NDMatrix prod(int axis, DType dtype = null, NDMatrix @out = null)

Parameters

axis int

The axis to multiply along.

dtype DType

The dtype the product is computed in, or null for NumPy's default.

out NDMatrix

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

Returns

NDMatrix

The products; out itself when it is given.

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape.

prod(NDAxis?, DType, NDArray)

NumPy's matrix.prod(axis=None, dtype=None, out=None); a scalar without an axis.

public NDArray prod(NDAxis? axis = null, DType dtype = null, NDArray @out = null)

Parameters

axis NDAxis?

The axis, or null to multiply every element. A tuple reduces the axes it names together and keeps them with length 1, as every axis but None does (the (1, 1) matrix for (0, 1), the whole matrix for ()).

dtype DType

The dtype the product is computed in, or null for NumPy's default.

out NDArray

A matrix of the kept shape, or null.

Returns

NDArray

A 0-d array when axis is null; otherwise the matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape.

AttributeError

out is a plain (non-matrix) array: NumPy's reduction stores into it, then _collapse does not exist on it ('numpy.ndarray' object has no attribute '_collapse').

ptp(int, NDArray)

NumPy's matrix.ptp(axis, out) for a given axis: maximum minus minimum along the axis, as a row for axis 0 and a column for axis 1.

public NDMatrix ptp(int axis, NDArray @out = null)

Parameters

axis int

0 or 1. NumPy's matrix rejects every other value, also -1 and -2.

out NDArray

Must be null in practice: NumPy's method fails for every out.

Returns

NDMatrix

The ranges as a matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

axis is a valid negative axis (unsupported axis), the reduced axis is empty, or out is given (NumPy's reduction or broadcast text; a plain out of the right shape holds the MAXIMA afterwards, as in NumPy).

TypeError

The matrix is bool (NumPy's boolean subtract is not defined).

ptp(int?, NDArray)

NumPy's matrix.ptp(axis=None, out=None); the range of every element as a scalar without an axis.

public NDArray ptp(int? axis = null, NDArray @out = null)

Parameters

axis int?

The axis (0 or 1), or null.

out NDArray

Must be null in practice.

Returns

NDArray

A 0-d array when axis is null; otherwise the matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

An unsupported axis, an empty reduction, or an out.

TypeError

The matrix is bool.

ravel(char)

NumPy's matrix.ravel(order='C'): the elements as one row (1, size), a VIEW when the memory layout allows it and a copy otherwise. One signature: m.ravel() binds here with the default 'C'.

public NDMatrix ravel(char order = 'C')

Parameters

order char

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

Returns

NDMatrix

A (1, size) matrix; writes reach this matrix when it is a view.

Exceptions

ArgumentException

order is not one of the four codes.

repeat(NDArray, int?)

Each element repeated, as a matrix (NumPy's m.repeat(repeats, axis)); without an axis the flattened elements as a row.

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

Parameters

repeats NDArray

The repeat count per element (one value, or one per element of the axis).

axis int?

The axis to repeat along, or null.

Returns

NDMatrix

A new matrix that owns its data.

Remarks

One signature (API-parity batch 3): m.repeat(2) binds here, 2 converting to a 0-d array.

Exceptions

ValueError

A negative count, or counts that do not match the axis.

AxisError

axis is out of bounds.

reshape(Shape, char, bool?)

The elements under another shape, folded back onto two axes — NumPy's m.reshape(shape, /, *, order='C', copy=None): m.reshape(6) is the row (1, 6), m.reshape(1, 2, 3) is (2, 3).

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

Parameters

shape Shape

The requested dimensions; one may be -1 (inferred). An int, a tuple, an int[] / long[], a C# collection expression or a Shape. NumPy's name (it was newShape until API-parity batch 9).

order char

'C', 'F' or 'A': the index order the elements are read and placed in.

copy bool?

NumPy's copy keyword (API-parity batch 7): null copies only when needed, true always copies, false raises Unable to avoid creating a copy while reshaping. when no view can express the reshape — reshape(Shape, char, bool?)'s modes, the result wrapped as a matrix.

Returns

NDMatrix

A view when the layout allows it, otherwise a copy.

Remarks

Since API-parity batch 9 this and the loose integers (reshape(params long[]), reshape(params ReadOnlySpan<long>)) are the matrix method's spellings, as on NDArray: the (Shape) and (int[]) forms went (an int[] converts to Shape).

Exceptions

IncorrectShapeException

The requested size differs from the matrix's size.

ValueError

More than two requested dimensions are longer than 1, 'K', or the refusal of copy false.

reshape(params long[])

The matrix under NumPy's loose integers (m.reshape(2, 3)) when they arrive as a C# long[]; see reshape(Shape, char, bool?).

public NDMatrix reshape(params long[] shape)

Parameters

shape long[]

The requested dimensions; one may be -1.

Returns

NDMatrix

A view when the layout allows it, otherwise a copy, wrapped as a matrix.

Exceptions

IncorrectShapeException

The requested size differs from the matrix's size.

ValueError

More than two requested dimensions are longer than 1.

reshape(params ReadOnlySpan<long>)

The matrix under NumPy's loose integers (m.reshape(2, 3)) as C# 13 passes them (a span on the caller's stack); added in API-parity batch 9 so the matrix has NDArray's spellings.

public NDMatrix reshape(params ReadOnlySpan<long> shape)

Parameters

shape ReadOnlySpan<long>

The requested dimensions; one may be -1.

Returns

NDMatrix

A view when the layout allows it, otherwise a copy, wrapped as a matrix.

Exceptions

IncorrectShapeException

The requested size differs from the matrix's size.

ValueError

More than two requested dimensions are longer than 1.

round()

The elements rounded to the nearest integer (half to even), as a matrix (NumPy's m.round()).

public NDMatrix round()

Returns

NDMatrix

A matrix: a copy that owns its data for an integer or complex matrix, a view of the computed array for a float one. A bool matrix gives float16, as NumPy's rint does.

round(int, NDArray)

The elements rounded to decimals places (NumPy's m.round(decimals, out)). The CLASS of the result depends on the route NumPy's PyArray_Round takes, so the static type is NDArray.

public NDArray round(int decimals, NDArray @out = null)

Parameters

decimals int

The number of decimal places; negative rounds left of the point.

out NDArray

An array to store into, or null.

Returns

NDArray

out when given. Otherwise: a MATRIX that owns its data for a complex matrix (NumPy copies the matrix and rounds the two parts in place) and for an integer matrix with decimals >= 0 (a copy); a MATRIX viewing the computed array for decimals 0 of a float or bool matrix (the rint ufunc); a plain ARRAY for every other case (NumPy computes those into an array it allocates itself).

Exceptions

ValueError

out is read-only or misshapen.

InvalidCastException

The result cannot be cast to out's dtype.

squeeze(NDAxis?)

NumPy's matrix.squeeze(axis=None). A matrix cannot lose an axis, so a squeezed row stays a row and a squeezed COLUMN becomes a row (1, N).

public NDMatrix squeeze(NDAxis? axis = null)

Parameters

axis NDAxis?

The axis to remove, a tuple of axes (each of length 1; checked in order, NumPy's PyArray_ConvertMultiAxis), or null for every axis of length 1.

Returns

NDMatrix

This matrix ITSELF when it has no axis of length 1 and axis is null (as NumPy); otherwise a view.

Remarks

The axis is an NDAxis since API-parity batch 4 (2026-11-12), as squeeze(NDAxis?)'s; an int? argument converts.

Exceptions

AxisError

An axis is out of bounds.

ValueError

An axis longer than 1 is named (cannot select an axis to squeeze out which has size not equal to one), or a tuple names an axis twice (duplicate value in 'axis').

std(int, DType, NDMatrix, int)

NumPy's matrix.std(axis, dtype, out, ddof) for a given axis: the standard deviations as a matrix that keeps the reduced axis with length 1.

public NDMatrix std(int axis, DType dtype = null, NDMatrix @out = null, int ddof = 0)

Parameters

axis int

The axis to compute along.

dtype DType

The dtype of the computation, or null for NumPy's default.

out NDMatrix

A FLOAT or complex matrix of the result's shape to store into, or null.

ddof int

Delta degrees of freedom.

Returns

NDMatrix

The standard deviations; out itself when it is given.

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape.

TypeError

out or dtype is an integer or bool dtype: NumPy's Cannot cast ufunc 'sqrt' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'.

std(NDAxis?, DType, NDArray, int)

NumPy's matrix.std(axis=None, dtype=None, out=None, ddof=0); a scalar without an axis.

public NDArray std(NDAxis? axis = null, DType dtype = null, NDArray @out = null, int ddof = 0)

Parameters

axis NDAxis?

The axis, or null for the standard deviation of every element. A tuple reduces the axes it names together and keeps them with length 1, as every axis but None does (the (1, 1) matrix for (0, 1), the whole matrix for ()).

dtype DType

The dtype of the computation, or null for NumPy's default.

out NDArray

A float or complex matrix of the kept shape, or null.

ddof int

Delta degrees of freedom.

Returns

NDArray

A 0-d array when axis is null; otherwise the matrix.

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape.

TypeError

An integer or bool out or dtype: NumPy takes the square root in place under the same_kind rule, which refuses the float root for an integer array (Cannot cast ufunc 'sqrt' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'). With out this is raised AFTER the variance was stored, so out holds the variance then. It is raised for axis: null too: a matrix reduction is always the array form (file header), where np.std of a plain array returns a truncated scalar.

AttributeError

out is a plain (non-matrix) array: NumPy's reduction stores into it, then _collapse does not exist on it ('numpy.ndarray' object has no attribute '_collapse').

sum(int, DType, NDMatrix)

NumPy's matrix.sum(axis, dtype, out) for a given axis: the sums as a matrix that keeps the reduced axis with length 1 ((1, N) for axis 0, (M, 1) for axis 1 or -1).

public NDMatrix sum(int axis, DType dtype = null, NDMatrix @out = null)

Parameters

axis int

The axis to sum along (0, 1, -1 or -2).

dtype DType

The dtype the sum is computed in, or null for NumPy's default (integers narrower than 64 bits and bool accumulate in int64 / uint64).

out NDMatrix

A matrix of the result's shape to store into, or null. Without dtype the sum is computed in promote_types(out.dtype, this.dtype) and stored with an unsafe cast: an int8 matrix into an int8 out wraps, into a bool out it stores whether the int8 sum is non-zero.

Returns

NDMatrix

The sums; out itself when it is given.

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape (NumPy's reduction texts).

sum(NDAxis?, DType, NDArray)

NumPy's matrix.sum(axis=None, dtype=None, out=None). Without an axis the result is the sum of all elements as a scalar.

public NDArray sum(NDAxis? axis = null, DType dtype = null, NDArray @out = null)

Parameters

axis NDAxis?

The axis, or null to sum every element. A tuple reduces the axes it names together and keeps them with length 1, as every axis but None does (the (1, 1) matrix for (0, 1), the whole matrix for ()).

dtype DType

The dtype the sum is computed in, or null for NumPy's default.

out NDArray

A matrix of the kept shape ((1, 1) without an axis), or null.

Returns

NDArray

A 0-d array (the scalar) when axis is null; otherwise the matrix of sum(int, DType, NDMatrix) as an NDArray reference.

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape.

AttributeError

out is a plain (non-matrix) array: NumPy's reduction stores into it, then _collapse does not exist on it ('numpy.ndarray' object has no attribute '_collapse').

swapaxes(int, int)

The matrix with two axes exchanged (NumPy's m.swapaxes(a, b)).

public NDMatrix swapaxes(int axis1, int axis2)

Parameters

axis1 int

The first axis.

axis2 int

The second axis.

Returns

NDMatrix

A view.

Exceptions

AxisError

An axis is out of bounds.

take(NDArray, int?, string)

Elements selected by index along an axis, as a matrix (NumPy's m.take(indices, axis, mode)). Without an axis the matrix is read flat and the result is a row.

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

Parameters

indices NDArray

The indices; a C# integer selects one element (a (1, 1) result).

axis int?

The axis, or null to index the flattened matrix.

mode string

"raise", "wrap" or "clip" for an index out of bounds.

Returns

NDMatrix

A new matrix that owns its data.

Exceptions

IndexError

An index is out of bounds under "raise". Without an axis the text names axis 1 (index 12 is out of bounds for axis 1 with size 12): NumPy ravels the matrix to its (1, size) row first and takes along that row.

AxisError

axis is out of bounds.

ArgumentException

An index array of a non-integer dtype, or an unknown mode.

to_device(string, object)

Array-API device transfer: only "cpu" exists, and the matrix itself is returned.

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

Parameters

device string

Must be "cpu".

stream object

Must be null.

Returns

NDMatrix

This matrix.

Exceptions

ArgumentNullException

device is null.

ValueError

A stream, then another device: to_device(string, object)'s NumPy texts.

trace(int, int, int, DType)

The sum of the diagonal as a (1, 1) matrix (NumPy's m.trace(); np.trace(m) is a scalar).

public NDMatrix trace(int offset = 0, int axis1 = 0, int axis2 = 1, DType dtype = null)

Parameters

offset int

The diagonal's offset.

axis1 int

The first axis of the plane.

axis2 int

The second axis of the plane.

dtype DType

The dtype of the sum, or null for NumPy's default.

Returns

NDMatrix

A new (1, 1) matrix.

Exceptions

AxisError

An axis is out of bounds.

ArgumentException

The two axes are the same.

transpose(params int[])

The matrix with its axes permuted (NumPy's m.transpose(*axes)); without an argument the transpose.

public NDMatrix transpose(params int[] axes)

Parameters

axes int[]

NumPy's *axes: the permutation as separate integers (m.transpose(1, 0)) or one array ({1, 0} or {0, 1}); no argument, an empty array or null reverses the axes.

Returns

NDMatrix

A view.

Remarks

One member, NumPy's call shapes: params makes m.transpose(1, 0) compile (the former transpose(int[] premute = null) refused it). It hides transpose(params int[]), whose parameter is the same array; the empty array reads as the no-argument call, as there.

Exceptions

ValueError

The permutation does not have one entry per axis (axes don't match array) or repeats an axis.

AxisError

An axis is out of bounds.

var(int, DType, NDMatrix, int)

NumPy's matrix.var(axis, dtype, out, ddof) for a given axis: the variances as a matrix that keeps the reduced axis with length 1.

public NDMatrix var(int axis, DType dtype = null, NDMatrix @out = null, int ddof = 0)

Parameters

axis int

The axis to compute along.

dtype DType

The dtype of the computation, or null: float64 for an integer or bool matrix, the matrix's dtype for a float one.

out NDMatrix

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

ddof int

Delta degrees of freedom: the divisor is N - ddof.

Returns

NDMatrix

The variances; out itself when it is given.

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape.

var(NDAxis?, DType, NDArray, int)

NumPy's matrix.var(axis=None, dtype=None, out=None, ddof=0); a scalar without an axis.

public NDArray var(NDAxis? axis = null, DType dtype = null, NDArray @out = null, int ddof = 0)

Parameters

axis NDAxis?

The axis, or null for the variance of every element. A tuple reduces the axes it names together and keeps them with length 1, as every axis but None does (the (1, 1) matrix for (0, 1), the whole matrix for ()).

dtype DType

The dtype of the computation, or null for NumPy's default.

out NDArray

A matrix of the kept shape, or null.

ddof int

Delta degrees of freedom.

Returns

NDArray

A 0-d array when axis is null; otherwise the matrix.

Remarks

With out NumPy hands it to the LAST sum only (the sum of the squared deviations): the mean and the deviations are computed as without it, that sum runs in promote_types(out.dtype, deviation dtype) unless dtype is given, it is stored into out with an unsafe cast, and out is then divided in place by max(N - ddof, 0).

Exceptions

AxisError

axis is out of bounds.

ValueError

out is read-only or does not have the result's shape.

AttributeError

out is a plain (non-matrix) array: NumPy's reduction stores into it, then _collapse does not exist on it ('numpy.ndarray' object has no attribute '_collapse').

view(DType)

A new matrix object over the same memory (NumPy's m.view()), optionally reading the bytes as another dtype.

public NDMatrix view(DType dtype = null)

Parameters

dtype DType

The dtype to read the bytes as, or null to keep it. A dtype of another size changes the number of columns.

Returns

NDMatrix

A view; writes reach this matrix.

Exceptions

ArgumentException

The new item size does not divide the last axis.

InvalidOperationException

A dtype of another size over a non-contiguous last axis.

view(DType, Type)

NumPy's m.view(dtype, type): a view of this matrix as the array class type, its bytes read as dtype.

public NDArray view(DType dtype, Type type)

Parameters

dtype DType

The dtype to read the bytes as, or null to keep it.

type Type

The array class, or null for this matrix's own class.

Returns

NDArray

A view of the class asked for.

Exceptions

ValueError

type is not an array class, the class's finalize rule refuses the dtype, or an itemsize error.

NotSupportedException

An array class with no NumPy counterpart.

view(Type)

NumPy's m.view(type): a view of this matrix as the array class type (typeof(NDArray) is the plain 2-D array), or — when type is not an array class — read as the dtype that CLR type names.

public NDArray view(Type type)

Parameters

type Type

The array class, or a CLR element type.

Returns

NDArray

A view of the class asked for; NDArray is its static type.

Remarks

Declared here because the matrix's own view(DType) would otherwise take a Type argument through its implicit conversion to DType.

Exceptions

ValueError

The class's finalize rule refuses this matrix's dtype, or an itemsize error.

NotSupportedException

An array class with no NumPy counterpart.

Operators

operator +(NDArray, NDMatrix)

Elementwise addition with broadcasting, returned as a matrix (NumPy's matrix + x). The dtype follows the array operator of the same name.

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

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator +(NDMatrix, NDArray)

Elementwise addition with broadcasting, returned as a matrix (NumPy's matrix + x). The dtype follows the array operator of the same name.

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

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator +(NDMatrix, NDMatrix)

Elementwise addition with broadcasting, returned as a matrix (NumPy's matrix + x). The dtype follows the array operator of the same name.

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

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator +(NDMatrix, object)

Elementwise addition with broadcasting, returned as a matrix (NumPy's matrix + x). The dtype follows the array operator of the same name.

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

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator +(object, NDMatrix)

Elementwise addition with broadcasting, returned as a matrix (NumPy's matrix + x). The dtype follows the array operator of the same name.

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

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator &(NDArray, NDMatrix)

Elementwise AND with broadcasting, returned as a matrix (NumPy's matrix & x; logical for bool, bitwise for integers).

public static NDMatrix operator &(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator &(NDMatrix, NDArray)

Elementwise AND with broadcasting, returned as a matrix (NumPy's matrix & x; logical for bool, bitwise for integers).

public static NDMatrix operator &(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator &(NDMatrix, NDMatrix)

Elementwise AND with broadcasting, returned as a matrix (NumPy's matrix & x; logical for bool, bitwise for integers).

public static NDMatrix operator &(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator &(NDMatrix, object)

Elementwise AND with broadcasting, returned as a matrix (NumPy's matrix & x; logical for bool, bitwise for integers).

public static NDMatrix operator &(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator &(object, NDMatrix)

Elementwise AND with broadcasting, returned as a matrix (NumPy's matrix & x; logical for bool, bitwise for integers).

public static NDMatrix operator &(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator |(NDArray, NDMatrix)

Elementwise OR with broadcasting, returned as a matrix (NumPy's matrix | x).

public static NDMatrix operator |(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator |(NDMatrix, NDArray)

Elementwise OR with broadcasting, returned as a matrix (NumPy's matrix | x).

public static NDMatrix operator |(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator |(NDMatrix, NDMatrix)

Elementwise OR with broadcasting, returned as a matrix (NumPy's matrix | x).

public static NDMatrix operator |(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator |(NDMatrix, object)

Elementwise OR with broadcasting, returned as a matrix (NumPy's matrix | x).

public static NDMatrix operator |(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator |(object, NDMatrix)

Elementwise OR with broadcasting, returned as a matrix (NumPy's matrix | x).

public static NDMatrix operator |(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator /(NDArray, NDMatrix)

Elementwise TRUE division with broadcasting, returned as a matrix (NumPy's matrix / x). Integer operands give float64. It is not a multiplication by an inverse: use m * x.I for that.

public static NDMatrix operator /(NDArray left, NDMatrix right)

Parameters

left NDArray

The dividend.

right NDMatrix

The divisor.

Returns

NDMatrix

The quotient as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator /(NDMatrix, NDArray)

Elementwise TRUE division with broadcasting, returned as a matrix (NumPy's matrix / x). Integer operands give float64. It is not a multiplication by an inverse: use m * x.I for that.

public static NDMatrix operator /(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The dividend.

right NDArray

The divisor.

Returns

NDMatrix

The quotient as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator /(NDMatrix, NDMatrix)

Elementwise TRUE division with broadcasting, returned as a matrix (NumPy's matrix / x). Integer operands give float64. It is not a multiplication by an inverse: use m * x.I for that.

public static NDMatrix operator /(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The dividend.

right NDMatrix

The divisor.

Returns

NDMatrix

The quotient as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator /(NDMatrix, object)

Elementwise TRUE division with broadcasting, returned as a matrix (NumPy's matrix / x). Integer operands give float64. It is not a multiplication by an inverse: use m * x.I for that.

public static NDMatrix operator /(NDMatrix left, object right)

Parameters

left NDMatrix

The dividend.

right object

The divisor.

Returns

NDMatrix

The quotient as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator /(object, NDMatrix)

Elementwise TRUE division with broadcasting, returned as a matrix (NumPy's matrix / x). Integer operands give float64. It is not a multiplication by an inverse: use m * x.I for that.

public static NDMatrix operator /(object left, NDMatrix right)

Parameters

left object

The dividend.

right NDMatrix

The divisor.

Returns

NDMatrix

The quotient as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ==(NDArray, NDMatrix)

Elementwise equality with broadcasting as a BOOL MATRIX (NumPy's matrix == x). It is not a reference or a whole-matrix test: use is null for a null check, Equals(object) or np.array_equal for "all elements equal".

public static NDMatrix operator ==(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array). A comparison with null is a 0-d bool.

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ==(NDMatrix, NDArray)

Elementwise equality with broadcasting as a BOOL MATRIX (NumPy's matrix == x). It is not a reference or a whole-matrix test: use is null for a null check, Equals(object) or np.array_equal for "all elements equal".

public static NDMatrix operator ==(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array). A comparison with null is a 0-d bool.

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ==(NDMatrix, NDMatrix)

Elementwise equality with broadcasting as a BOOL MATRIX (NumPy's matrix == x). It is not a reference or a whole-matrix test: use is null for a null check, Equals(object) or np.array_equal for "all elements equal".

public static NDMatrix operator ==(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array). A comparison with null is a 0-d bool.

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ==(NDMatrix, object)

Elementwise equality with broadcasting as a BOOL MATRIX (NumPy's matrix == x). It is not a reference or a whole-matrix test: use is null for a null check, Equals(object) or np.array_equal for "all elements equal".

public static NDMatrix operator ==(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array). A comparison with null is a 0-d bool.

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ==(object, NDMatrix)

Elementwise equality with broadcasting as a BOOL MATRIX (NumPy's matrix == x). It is not a reference or a whole-matrix test: use is null for a null check, Equals(object) or np.array_equal for "all elements equal".

public static NDMatrix operator ==(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array). A comparison with null is a 0-d bool.

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ^(NDArray, NDMatrix)

Elementwise XOR with broadcasting, returned as a matrix (NumPy's matrix ^ x). It is NOT a power: Python's ** is __pow__(int).

public static NDMatrix operator ^(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ^(NDMatrix, NDArray)

Elementwise XOR with broadcasting, returned as a matrix (NumPy's matrix ^ x). It is NOT a power: Python's ** is __pow__(int).

public static NDMatrix operator ^(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ^(NDMatrix, NDMatrix)

Elementwise XOR with broadcasting, returned as a matrix (NumPy's matrix ^ x). It is NOT a power: Python's ** is __pow__(int).

public static NDMatrix operator ^(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ^(NDMatrix, object)

Elementwise XOR with broadcasting, returned as a matrix (NumPy's matrix ^ x). It is NOT a power: Python's ** is __pow__(int).

public static NDMatrix operator ^(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator ^(object, NDMatrix)

Elementwise XOR with broadcasting, returned as a matrix (NumPy's matrix ^ x). It is NOT a power: Python's ** is __pow__(int).

public static NDMatrix operator ^(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >(NDArray, NDMatrix)

Elementwise > with broadcasting as a bool matrix (NumPy's matrix > x). The result indexes a matrix directly: m[m > 5].

public static NDMatrix operator >(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >(NDMatrix, NDArray)

Elementwise > with broadcasting as a bool matrix (NumPy's matrix > x). The result indexes a matrix directly: m[m > 5].

public static NDMatrix operator >(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >(NDMatrix, NDMatrix)

Elementwise > with broadcasting as a bool matrix (NumPy's matrix > x). The result indexes a matrix directly: m[m > 5].

public static NDMatrix operator >(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >(NDMatrix, object)

Elementwise > with broadcasting as a bool matrix (NumPy's matrix > x). The result indexes a matrix directly: m[m > 5].

public static NDMatrix operator >(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >(object, NDMatrix)

Elementwise > with broadcasting as a bool matrix (NumPy's matrix > x). The result indexes a matrix directly: m[m > 5].

public static NDMatrix operator >(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >=(NDArray, NDMatrix)

Elementwise >= with broadcasting as a bool matrix (NumPy's matrix >= x).

public static NDMatrix operator >=(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >=(NDMatrix, NDArray)

Elementwise >= with broadcasting as a bool matrix (NumPy's matrix >= x).

public static NDMatrix operator >=(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >=(NDMatrix, NDMatrix)

Elementwise >= with broadcasting as a bool matrix (NumPy's matrix >= x).

public static NDMatrix operator >=(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >=(NDMatrix, object)

Elementwise >= with broadcasting as a bool matrix (NumPy's matrix >= x).

public static NDMatrix operator >=(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >=(object, NDMatrix)

Elementwise >= with broadcasting as a bool matrix (NumPy's matrix >= x).

public static NDMatrix operator >=(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

implicit operator NDMatrix(bool)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(bool value)

Parameters

value bool

The value.

Returns

NDMatrix

implicit operator NDMatrix(byte)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(byte value)

Parameters

value byte

The value.

Returns

NDMatrix

implicit operator NDMatrix(char)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(char value)

Parameters

value char

The value.

Returns

NDMatrix

implicit operator NDMatrix(decimal)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(decimal value)

Parameters

value decimal

The value.

Returns

NDMatrix

implicit operator NDMatrix(double)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(double value)

Parameters

value double

The value.

Returns

NDMatrix

implicit operator NDMatrix(Half)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(Half value)

Parameters

value Half

The value.

Returns

NDMatrix

implicit operator NDMatrix(short)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(short value)

Parameters

value short

The value.

Returns

NDMatrix

implicit operator NDMatrix(int)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(int value)

Parameters

value int

The value.

Returns

NDMatrix

implicit operator NDMatrix(long)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(long value)

Parameters

value long

The value.

Returns

NDMatrix

implicit operator NDMatrix(Complex)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(Complex value)

Parameters

value Complex

The value.

Returns

NDMatrix

implicit operator NDMatrix(sbyte)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(sbyte value)

Parameters

value sbyte

The value.

Returns

NDMatrix

implicit operator NDMatrix(float)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(float value)

Parameters

value float

The value.

Returns

NDMatrix

implicit operator NDMatrix(ushort)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(ushort value)

Parameters

value ushort

The value.

Returns

NDMatrix

implicit operator NDMatrix(uint)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(uint value)

Parameters

value uint

The value.

Returns

NDMatrix

implicit operator NDMatrix(ulong)

A C# bool as a 0-d matrix scalar (NumPy's Python bool operand of a matrix expression). It is NOT np.matrix(value), which is (1, 1).

public static implicit operator NDMatrix(ulong value)

Parameters

value ulong

The value.

Returns

NDMatrix

operator !=(NDArray, NDMatrix)

Elementwise inequality with broadcasting as a bool matrix (NumPy's matrix != x).

public static NDMatrix operator !=(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator !=(NDMatrix, NDArray)

Elementwise inequality with broadcasting as a bool matrix (NumPy's matrix != x).

public static NDMatrix operator !=(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator !=(NDMatrix, NDMatrix)

Elementwise inequality with broadcasting as a bool matrix (NumPy's matrix != x).

public static NDMatrix operator !=(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator !=(NDMatrix, object)

Elementwise inequality with broadcasting as a bool matrix (NumPy's matrix != x).

public static NDMatrix operator !=(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator !=(object, NDMatrix)

Elementwise inequality with broadcasting as a bool matrix (NumPy's matrix != x).

public static NDMatrix operator !=(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <<(NDMatrix, NDArray)

Elementwise left shift with broadcasting, returned as a matrix (NumPy's matrix << x). C# requires the left operand of a shift operator to be the declaring type, so there is no (array, matrix) form: write np.asmatrix(np.left_shift(a, m)).

public static NDMatrix operator <<(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The values.

right NDArray

The shift counts.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <<(NDMatrix, NDMatrix)

Elementwise left shift with broadcasting, returned as a matrix (NumPy's matrix << x). C# requires the left operand of a shift operator to be the declaring type, so there is no (array, matrix) form: write np.asmatrix(np.left_shift(a, m)).

public static NDMatrix operator <<(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The values.

right NDMatrix

The shift counts.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <<(NDMatrix, object)

Elementwise left shift with broadcasting, returned as a matrix (NumPy's matrix << x). C# requires the left operand of a shift operator to be the declaring type, so there is no (array, matrix) form: write np.asmatrix(np.left_shift(a, m)).

public static NDMatrix operator <<(NDMatrix left, object right)

Parameters

left NDMatrix

The values.

right object

The shift counts.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <(NDArray, NDMatrix)

Elementwise < with broadcasting as a bool matrix (NumPy's matrix < x).

public static NDMatrix operator <(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <(NDMatrix, NDArray)

Elementwise < with broadcasting as a bool matrix (NumPy's matrix < x).

public static NDMatrix operator <(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <(NDMatrix, NDMatrix)

Elementwise < with broadcasting as a bool matrix (NumPy's matrix < x).

public static NDMatrix operator <(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <(NDMatrix, object)

Elementwise < with broadcasting as a bool matrix (NumPy's matrix < x).

public static NDMatrix operator <(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <(object, NDMatrix)

Elementwise < with broadcasting as a bool matrix (NumPy's matrix < x).

public static NDMatrix operator <(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <=(NDArray, NDMatrix)

Elementwise <= with broadcasting as a bool matrix (NumPy's matrix <= x).

public static NDMatrix operator <=(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <=(NDMatrix, NDArray)

Elementwise <= with broadcasting as a bool matrix (NumPy's matrix <= x).

public static NDMatrix operator <=(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <=(NDMatrix, NDMatrix)

Elementwise <= with broadcasting as a bool matrix (NumPy's matrix <= x).

public static NDMatrix operator <=(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <=(NDMatrix, object)

Elementwise <= with broadcasting as a bool matrix (NumPy's matrix <= x).

public static NDMatrix operator <=(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator <=(object, NDMatrix)

Elementwise <= with broadcasting as a bool matrix (NumPy's matrix <= x).

public static NDMatrix operator <=(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A bool matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator !(NDMatrix)

Elementwise logical NOT as a bool matrix (NumSharp's !array, NumPy's np.logical_not).

public static NDMatrix operator !(NDMatrix operand)

Parameters

operand NDMatrix

The matrix.

Returns

NDMatrix

A bool matrix (a view of the computed array).

operator %(NDArray, NDMatrix)

Elementwise remainder with broadcasting, returned as a matrix (NumPy's matrix % x; the result takes the divisor's sign).

public static NDMatrix operator %(NDArray left, NDMatrix right)

Parameters

left NDArray

The dividend.

right NDMatrix

The divisor.

Returns

NDMatrix

The remainder as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator %(NDMatrix, NDArray)

Elementwise remainder with broadcasting, returned as a matrix (NumPy's matrix % x; the result takes the divisor's sign).

public static NDMatrix operator %(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The dividend.

right NDArray

The divisor.

Returns

NDMatrix

The remainder as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator %(NDMatrix, NDMatrix)

Elementwise remainder with broadcasting, returned as a matrix (NumPy's matrix % x; the result takes the divisor's sign).

public static NDMatrix operator %(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The dividend.

right NDMatrix

The divisor.

Returns

NDMatrix

The remainder as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator %(NDMatrix, object)

Elementwise remainder with broadcasting, returned as a matrix (NumPy's matrix % x; the result takes the divisor's sign).

public static NDMatrix operator %(NDMatrix left, object right)

Parameters

left NDMatrix

The dividend.

right object

The divisor.

Returns

NDMatrix

The remainder as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator %(object, NDMatrix)

Elementwise remainder with broadcasting, returned as a matrix (NumPy's matrix % x; the result takes the divisor's sign).

public static NDMatrix operator %(object left, NDMatrix right)

Parameters

left object

The dividend.

right NDMatrix

The divisor.

Returns

NDMatrix

The remainder as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator *(NDArray, NDMatrix)

NumPy's ndarray * matrix (matrix.rmul): np.dot(left, right) with the array as it is, so a 1-d left of length M times an (M, K) matrix is a (1, K) row.

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

Parameters

left NDArray

The array; 0-d scales.

right NDMatrix

The matrix.

Returns

NDMatrix

The product as a new matrix.

Exceptions

ArgumentNullException

An operand is null.

ArgumentException

The inner dimensions differ.

ValueError

The product has more than two axes longer than 1.

operator *(NDMatrix, NDArray)

NumPy's matrix * ndarray: np.dot(left, asmatrix(right)). A 1-d right becomes a ROW (1, N) first, so the product only exists when the matrix has one column.

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

Parameters

left NDMatrix

The matrix.

right NDArray

The array; 0-d scales.

Returns

NDMatrix

The product as a new matrix.

Exceptions

ArgumentNullException

An operand is null.

ArgumentException

The inner dimensions differ.

ValueError

right has more than two axes longer than 1.

operator *(NDMatrix, NDMatrix)

NumPy's matrix * matrix: the MATRIX product (np.dot), not the elementwise one. A 0-d operand (a C# number) scales. For the elementwise product use np.multiply(a, b).

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

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

A new matrix of shape (left rows, right columns) in the promoted dtype.

Exceptions

ArgumentNullException

An operand is null.

ArgumentException

The inner dimensions differ.

ValueError

An array operand cannot be seen as a matrix.

operator *(NDMatrix, object)

NumPy's matrix * other for a list, a tuple, a C# array or a boxed number; the operand is converted as matrix(object, DType, bool) converts its data.

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

Parameters

left NDMatrix

The matrix.

right object

The other operand.

Returns

NDMatrix

The product as a new matrix.

Exceptions

ArgumentNullException

An operand is null.

ArgumentException

The inner dimensions differ.

ValueError

The operand is ragged or cannot be seen as a matrix.

NotSupportedException

The operand holds strings or other objects.

operator *(object, NDMatrix)

NumPy's other * matrix for a list, a tuple, a C# array or a boxed number.

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

Parameters

left object

The other operand.

right NDMatrix

The matrix.

Returns

NDMatrix

The product as a new matrix.

Exceptions

ArgumentNullException

An operand is null.

ArgumentException

The inner dimensions differ.

ValueError

The operand is ragged, or the product cannot be a matrix.

NotSupportedException

The operand holds strings or other objects.

operator ~(NDMatrix)

Elementwise bitwise NOT, returned as a matrix (NumPy's ~matrix; logical NOT for bool).

public static NDMatrix operator ~(NDMatrix operand)

Parameters

operand NDMatrix

The matrix.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

operator >>(NDMatrix, NDArray)

Elementwise right shift with broadcasting, returned as a matrix (NumPy's matrix >> x; arithmetic for signed integers).

public static NDMatrix operator >>(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The values.

right NDArray

The shift counts.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >>(NDMatrix, NDMatrix)

Elementwise right shift with broadcasting, returned as a matrix (NumPy's matrix >> x; arithmetic for signed integers).

public static NDMatrix operator >>(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The values.

right NDMatrix

The shift counts.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator >>(NDMatrix, object)

Elementwise right shift with broadcasting, returned as a matrix (NumPy's matrix >> x; arithmetic for signed integers).

public static NDMatrix operator >>(NDMatrix left, object right)

Parameters

left NDMatrix

The values.

right object

The shift counts.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator -(NDArray, NDMatrix)

Elementwise subtraction with broadcasting, returned as a matrix (NumPy's matrix - x).

public static NDMatrix operator -(NDArray left, NDMatrix right)

Parameters

left NDArray

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator -(NDMatrix, NDArray)

Elementwise subtraction with broadcasting, returned as a matrix (NumPy's matrix - x).

public static NDMatrix operator -(NDMatrix left, NDArray right)

Parameters

left NDMatrix

The left operand.

right NDArray

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator -(NDMatrix, NDMatrix)

Elementwise subtraction with broadcasting, returned as a matrix (NumPy's matrix - x).

public static NDMatrix operator -(NDMatrix left, NDMatrix right)

Parameters

left NDMatrix

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator -(NDMatrix, object)

Elementwise subtraction with broadcasting, returned as a matrix (NumPy's matrix - x).

public static NDMatrix operator -(NDMatrix left, object right)

Parameters

left NDMatrix

The left operand.

right object

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator -(object, NDMatrix)

Elementwise subtraction with broadcasting, returned as a matrix (NumPy's matrix - x).

public static NDMatrix operator -(object left, NDMatrix right)

Parameters

left object

The left operand.

right NDMatrix

The right operand.

Returns

NDMatrix

The result as a matrix (a view of the computed array).

Exceptions

IncorrectShapeException

The operands do not broadcast.

ValueError

The broadcast result has more than two axes longer than 1.

operator -(NDMatrix)

Elementwise negation, returned as a matrix (NumPy's -matrix).

public static NDMatrix operator -(NDMatrix operand)

Parameters

operand NDMatrix

The matrix.

Returns

NDMatrix

The negated matrix (a view of the computed array).

operator +(NDMatrix)

NumPy's +matrix: the np.positive ufunc, a copy returned as a matrix.

public static NDMatrix operator +(NDMatrix operand)

Parameters

operand NDMatrix

The matrix.

Returns

NDMatrix

A new matrix with the same elements (a view of the computed array).

Exceptions

TypeError

The matrix is bool: np.positive has no bool loop, as in NumPy (ufunc 'positive' did not contain a loop with signature matching types ...).

See Also