ILNumerics - Technical Application Development
Assembly: ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.5.0.0 (5.5.7503.3146)
Depending on the shape of A a matrix or a vector with the elements on the specified diagonal of A.
The type of the Array returned will be the same as the type of A.
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
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: RetArrayTDepending on the shape of A a matrix or a vector with the elements on the specified diagonal of A.
Exceptions
Exception | Condition |
---|---|
ArgumentException | If abs(d) addresses a non-existing diagonal. |
Remarks
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