Matrix.Copy From Diagonal Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.5.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.5.0
Overload List
| Copy | Creates a new DiagonalMatrix<T> with specified diagonal values. |
| Copy | Returns a copy of the diagonal part of a matrix. |
| Copy | Returns a copy of the diagonal part of a matrix with explicit dimensions. |
CopyFromDiagonal<T>(Vector<T>)
Creates a new DiagonalMatrix<T> with specified diagonal values.
public static DiagonalMatrix<T> CopyFromDiagonal<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. |
CopyFromDiagonal<T>(Matrix<T>, ArrayMutability)
Returns a copy of the diagonal part of a matrix.
public static Matrix<T> CopyFromDiagonal<T>(
Matrix<T> source,
ArrayMutability mutability = ArrayMutability.MutableValues
)
Parameters
- source Matrix<T>
- The source matrix.
- mutability ArrayMutability (Optional)
- The desired mutability of the copy. The default is MutableValues.
Type Parameters
- T
- The element type of the matrix.
Return Value
Matrix<T>A new matrix containing the diagonal elements of source; all off-diagonal elements are zero. In Professional edition this may be a DiagonalMatrix<T>.
Exceptions
| Argument | source is null. |
CopyFromDiagonal<T>(Matrix<T>, Int32, Int32, ArrayMutability)
Returns a copy of the diagonal part of a matrix with explicit dimensions.
public static Matrix<T> CopyFromDiagonal<T>(
Matrix<T> source,
int rowCount,
int columnCount,
ArrayMutability mutability = ArrayMutability.MutableValues
)
Parameters
- source Matrix<T>
- The source matrix.
- rowCount Int32
- The number of rows of the copy. Must be between 0 and the row count of source (inclusive).
- columnCount Int32
- The number of columns of the copy. Must be between 0 and the column count of source (inclusive).
- mutability ArrayMutability (Optional)
- The desired mutability of the copy. The default is MutableValues.
Type Parameters
- T
- The element type of the matrix.
Return Value
Matrix<T>A new rowCount×columnCount matrix containing the diagonal elements of the leading submatrix of source; all off-diagonal elements are zero.
Exceptions
| Argument | source is null. |
| Argument | rowCount is less than 0 or greater than the row count of source. -or- columnCount is less than 0 or greater than the column count of source. |