Matrix.WrapDiagonal Method

Definition

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

Overload List

WrapDiagonal<T>(Vector<T>) Creates a new DiagonalMatrix<T> with specified diagonal values.
WrapDiagonal<T>(Int32, Int32, Vector<T>) Constructs a new diagonal matrix.

WrapDiagonal<T>(Vector<T>)

Creates a new DiagonalMatrix<T> with specified diagonal values.
C#
public static DiagonalMatrix<T> WrapDiagonal<T>(
	Vector<T> diagonal
)

Parameters

diagonal  Vector<T>
A vector containing the diagonal values.

Type Parameters

T
The element type of the matrix.

Return Value

DiagonalMatrix<T>
A new DiagonalMatrix<T>.

Exceptions

ArgumentNullExceptiondiagonal is null.

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

Constructs a new diagonal matrix.
C#
public static DiagonalMatrix<T> WrapDiagonal<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

ArgumentNullException

values is null.

See Also