ILNumerics Ultimate VS

ILMathdiagT Method

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Diagonal matrix or diagonal from matrix.

[ILNumerics Computing Engine]

Namespace:  ILNumerics
Assembly:  ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax

public static RetArray<T> diag<T>(
	BaseArray<T> A,
	int d = 0
)

Parameters

A
Type: ILNumericsBaseArrayT
Input matrix or vector.
d (Optional)
Type: SystemInt32
[Optional] Index of diagonal to extract/ to create. Default: 0.

Type Parameters

T

Return Value

Type: RetArrayT
Depending on the shape of A a matrix or a vector with the elements on the specified diagonal of A.
Exceptions

ExceptionCondition
ArgumentExceptionIf abs(d) addresses a non-existing diagonal.
Remarks

The type of the Array returned will be the same as the type of A.

If A is a matrix, diag(A) returns the elements on the d's diagonal as column vector.

If A is vector, a square matrix of size [A.Length - abs(d), A.Length - abs(d)] will be created, having the elements of the d's diagonal of A.

0 for d means: the main diagonal, d > 0 is above the main diagonal, d smaller 0 means below the main diagonal. d must lay in the range of existing rows / columns of A.

In general the equality diag(diag(A))==A holds true on a vector or a matrix A.

[ILNumerics Computing Engine]

See Also

Reference