Matrix.CreateFromArray<T> Method

Constructs a new matrix of the specified dimensions using the specified values array.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3
C#
public static DenseMatrix<T> CreateFromArray<T>(
	int rowCount,
	int columnCount,
	T[] values,
	MatrixElementOrder elementOrder,
	bool createView = false,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

rowCount  Int32
The number of rows.
columnCount  Int32
The number of columns.
values  T[]
An array of values that contain the elements of the matrix in column-major order.
elementOrder  MatrixElementOrder
A MatrixElementOrder value that specifies the order in which the matrix elements are stored in the storage array values.
createView  Boolean  (Optional)
If true, the array referenced by values is used directly for element storage without being copied. Any changes to the elements of this matrix will also affect the original array, and vice versa. If false, the elements are copied from values to a new array.
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

Return Value

DenseMatrix<T>
A DenseMatrix<T>.

Exceptions

ArgumentNullException

values is null.

ArgumentOutOfRangeException

rowCount is less than zero.

-or-

columnCount is less than zero.

See Also