Matrix.CreateDiagonal Method

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

CreateDiagonal<T>(Int32) Constructs a new diagonal matrix.
CreateDiagonal<T>(Vector<T>) Constructs a new diagonal matrix.
CreateDiagonal<T>(Int32, Int32) Constructs a new diagonal matrix.
CreateDiagonal<T>(Int32, Int32, Vector<T>) Constructs a new diagonal matrix.

CreateDiagonal<T>(Int32)

Constructs a new diagonal matrix.
C#
public static DiagonalMatrix<T> CreateDiagonal<T>(
	int rowCount
)

Parameters

rowCount  Int32
The number of rows and columns of the matrix.

Type Parameters

T

Return Value

DiagonalMatrix<T>
A diagonal matrix.

Remarks

Use this constructor to create a square diagonal matrix with nonzero elements on its main diagonal. The elements on the diagonal are initially set to zero.

CreateDiagonal<T>(Vector<T>)

Constructs a new diagonal matrix.
C#
public static DiagonalMatrix<T> CreateDiagonal<T>(
	Vector<T> values
)

Parameters

values  Vector<T>
A vector containing the diagonal elements of the matrix.

Type Parameters

T

Return Value

DiagonalMatrix<T>
A diagonal matrix.

Remarks

Use this constructor to create a square diagonal matrix with diagonal elements specified by values. The number of rows and columns of the matrix equals the length of values.

Exceptions

ArgumentNullExceptionvalues is null.

CreateDiagonal<T>(Int32, Int32)

Constructs a new diagonal matrix.
C#
public static DiagonalMatrix<T> CreateDiagonal<T>(
	int rowCount,
	int columnCount
)

Parameters

rowCount  Int32
The number of rows of the matrix.
columnCount  Int32
The number of columns.

Type Parameters

T

Return Value

DiagonalMatrix<T>
A diagonal matrix.

Remarks

Use this constructor to create a square diagonal matrix with nonzero elements on its main diagonal. The elements on the diagonal are initially set to zero.

CreateDiagonal<T>(Int32, Int32, Vector<T>)

Constructs a new diagonal matrix.
C#
public static DiagonalMatrix<T> CreateDiagonal<T>(
	int rowCount,
	int columnCount,
	Vector<T> values
)

Parameters

rowCount  Int32
The number of rows.
columnCount  Int32
The number of columns.
values  Vector<T>
A vector containing the diagonal elements of the matrix.

Type Parameters

T

Return Value

DiagonalMatrix<T>
A diagonal matrix.

Remarks

Use this constructor to create a square diagonal matrix with diagonal elements specified by values. The number of rows and columns of the matrix equals the length of values.

Exceptions

ArgumentNullExceptionvalues is null.

See Also