Matrix.Diagonal Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
Overload List
| Diagonal<T>(Vector<T>) | Creates a new DiagonalMatrix<T> with specified diagonal values. |
| Diagonal<T>(Int32, T) | Creates a new square DiagonalMatrix<T> with all diagonal elements set to the same value. |
Diagonal<T>(Vector<T>)
Creates a new DiagonalMatrix<T> with specified diagonal values.
public static DiagonalMatrix<T> Diagonal<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
| Argument | diagonal is null. |
Diagonal<T>(Int32, T)
Creates a new square DiagonalMatrix<T> with all diagonal elements set to the same value.
public static DiagonalMatrix<T> Diagonal<T>(
int dimension,
T value
)
Parameters
- dimension Int32
- The number of rows and columns in the matrix.
- value T
- The value for all diagonal elements.
Type Parameters
- T
- The element type of the matrix.
Return Value
DiagonalMatrix<T>A new DiagonalMatrix<T>.