Matrix.Wrap Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0

Overload List

Wrap<T>(Array2D<T>, Int32, Int32, MatrixElementOrder, ArrayMutability, Boolean) Creates a new DenseMatrix<T> by wrapping an existing Array2D<T> without copying.
Wrap<T>(T[], Int32, Int32, MatrixElementOrder, ArrayMutability, Boolean) Creates a new DenseMatrix<T> by wrapping an existing one-dimensional array without copying.
Wrap<T>(Memory2D<T>, Int32, Int32, MatrixElementOrder, ArrayMutability, Boolean) Creates a new DenseMatrix<T> by wrapping an existing Memory2D<T> without copying.
Wrap<T>(T[], Int32, Int32, Int32, Int32, MatrixElementOrder, ArrayMutability, Boolean) Creates a new DenseMatrix<T> by wrapping an existing one-dimensional array without copying, with specified offset and leading dimension.

Wrap<T>(Array2D<T>, Int32, Int32, MatrixElementOrder, ArrayMutability, Boolean)

Creates a new DenseMatrix<T> by wrapping an existing Array2D<T> without copying.
C#
public static DenseMatrix<T> Wrap<T>(
	Array2D<T> source,
	int rowCount,
	int columnCount,
	MatrixElementOrder elementOrder = MatrixElementOrder.ColumnMajor,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  Array2D<T>
An Array2D<T> to wrap.
rowCount  Int32
The number of rows in the matrix.
columnCount  Int32
The number of columns in the matrix.
elementOrder  MatrixElementOrder  (Optional)
A MatrixElementOrder value that indicates whether rows or columns are stored contiguously.
mutability  ArrayMutability  (Optional)
Specifies how the matrix's values may be changed. The default is mutable values.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the matrix should check for the presence of missing values. The default is false.

Type Parameters

T
The element type of the matrix.

Return Value

DenseMatrix<T>
A new DenseMatrix<T> that wraps the source storage.

Remarks

Changes to the matrix will affect the original storage, and vice versa.

Exceptions

ArgumentNullExceptionsource is null.
ArgumentOutOfRangeExceptionrowCount or columnCount is less than zero.

Wrap<T>(T[], Int32, Int32, MatrixElementOrder, ArrayMutability, Boolean)

Creates a new DenseMatrix<T> by wrapping an existing one-dimensional array without copying.
C#
public static DenseMatrix<T> Wrap<T>(
	T[] source,
	int rowCount,
	int columnCount,
	MatrixElementOrder elementOrder = MatrixElementOrder.ColumnMajor,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  T[]
A one-dimensional array to wrap.
rowCount  Int32
The number of rows in the matrix.
columnCount  Int32
The number of columns in the matrix.
elementOrder  MatrixElementOrder  (Optional)
A MatrixElementOrder value that specifies the order in which the matrix elements are stored in source.
mutability  ArrayMutability  (Optional)
Specifies how the matrix's values may be changed. The default is mutable values.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the matrix should check for the presence of missing values. The default is false.

Type Parameters

T
The element type of the matrix.

Return Value

DenseMatrix<T>
A new DenseMatrix<T> that wraps the source array.

Remarks

Changes to the matrix will affect the original array, and vice versa.

Exceptions

ArgumentNullExceptionsource is null.
ArgumentOutOfRangeExceptionrowCount or columnCount is less than zero.

Wrap<T>(Memory2D<T>, Int32, Int32, MatrixElementOrder, ArrayMutability, Boolean)

Creates a new DenseMatrix<T> by wrapping an existing Memory2D<T> without copying.
C#
public static DenseMatrix<T> Wrap<T>(
	Memory2D<T> source,
	int rowCount,
	int columnCount,
	MatrixElementOrder elementOrder = MatrixElementOrder.ColumnMajor,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  Memory2D<T>
A Memory2D<T> to wrap.
rowCount  Int32
The number of rows in the matrix.
columnCount  Int32
The number of columns in the matrix.
elementOrder  MatrixElementOrder  (Optional)
A MatrixElementOrder value that indicates whether rows or columns are stored contiguously.
mutability  ArrayMutability  (Optional)
Specifies how the matrix's values may be changed. The default is mutable values.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the matrix should check for the presence of missing values. The default is false.

Type Parameters

T
The element type of the matrix.

Return Value

DenseMatrix<T>
A new DenseMatrix<T> that wraps the source storage.

Remarks

Changes to the matrix will affect the original storage, and vice versa.

Exceptions

ArgumentNullExceptionsource is null.
ArgumentOutOfRangeExceptionrowCount or columnCount is less than zero.

Wrap<T>(T[], Int32, Int32, Int32, Int32, MatrixElementOrder, ArrayMutability, Boolean)

Creates a new DenseMatrix<T> by wrapping an existing one-dimensional array without copying, with specified offset and leading dimension.
C#
public static DenseMatrix<T> Wrap<T>(
	T[] source,
	int rowCount,
	int columnCount,
	int offset,
	int leadingDimension,
	MatrixElementOrder elementOrder,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  T[]
A one-dimensional array to wrap.
rowCount  Int32
The number of rows in the matrix.
columnCount  Int32
The number of columns in the matrix.
offset  Int32
Offset of the first element of the matrix in source.
leadingDimension  Int32
Distance between the first element of each row or column.
elementOrder  MatrixElementOrder
A MatrixElementOrder value that indicates whether rows or columns are stored contiguously.
mutability  ArrayMutability  (Optional)
Specifies how the matrix's values may be changed. The default is mutable values.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the matrix should check for the presence of missing values. The default is false.

Type Parameters

T
The element type of the matrix.

Return Value

DenseMatrix<T>
A new DenseMatrix<T> that wraps the source array.

Remarks

Changes to the matrix will affect the original array, and vice versa.

Exceptions

ArgumentNullExceptionsource is null.
ArgumentOutOfRangeExceptionrowCount or columnCount is less than zero.

See Also