Matrix.Identity<T> Method

Creates an identity matrix of the specified dimension.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
C#
public static Matrix<T> Identity<T>(
	int dimension,
	MatrixStructure structure = MatrixStructure.General
)

Parameters

dimension  Int32
The number of rows and columns in the identity matrix.
structure  MatrixStructure  (Optional)
Optional. A MatrixStructure value that specifies the structure of the matrix. The default is a full, dense matrix.

Type Parameters

T
The element type of the matrix.

Return Value

Matrix<T>
A matrix with dimension rows and columns that has ones on the main diagonal and is zero everywhere else.

Exceptions

ArgumentOutOfRangeExceptiondimension is less than or equal to zero.

See Also