Matrix.Get Upper Triangular View Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.9.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.9.0
Overload List
| Get | Returns a view of the upper triangular part of a matrix. |
| Get | Returns a view of the upper triangular part of a matrix with explicit dimensions. |
GetUpperTriangularView<T>(Matrix<T>, MatrixDiagonal, ArrayMutability)
Returns a view of the upper triangular part of a matrix.
public static Matrix<T> GetUpperTriangularView<T>(
Matrix<T> source,
MatrixDiagonal diagonal = MatrixDiagonal.NonUnitDiagonal,
ArrayMutability mutability = ArrayMutability.Inherit
)
Parameters
- source Matrix<T>
- The source matrix.
- diagonal MatrixDiagonal (Optional)
- A MatrixDiagonal value that specifies whether the diagonal elements are taken from the source or implied to be one. The default is NonUnitDiagonal.
- mutability ArrayMutability (Optional)
- The desired mutability of the view. Must not exceed the mutability of source. The default is Inherit.
Type Parameters
- T
- The element type of the matrix.
Return Value
Matrix<T>A matrix that represents the upper triangular part of source. Elements outside the upper triangle read as zero. The concrete view type depends on the source representation.
Remarks
The returned view aliases the storage of source: no copy is made. Writes to elements inside the upper triangle are forwarded to the source; writes outside the triangle throw a ComponentReadOnlyException.
Exceptions
| Argument | source is null. |
| Invalid | mutability is more permissive than the mutability of source. |
GetUpperTriangularView<T>(Matrix<T>, Int32, Int32, MatrixDiagonal, ArrayMutability)
Returns a view of the upper triangular part of a matrix with explicit dimensions.
public static Matrix<T> GetUpperTriangularView<T>(
Matrix<T> source,
int rowCount,
int columnCount,
MatrixDiagonal diagonal = MatrixDiagonal.NonUnitDiagonal,
ArrayMutability mutability = ArrayMutability.Inherit
)
Parameters
- source Matrix<T>
- The source matrix.
- rowCount Int32
- The number of rows of the view. Must be between 0 and the row count of source (inclusive).
- columnCount Int32
- The number of columns of the view. Must be between 0 and the column count of source (inclusive).
- diagonal MatrixDiagonal (Optional)
- A MatrixDiagonal value that specifies whether the diagonal elements are taken from the source or implied to be one. The default is NonUnitDiagonal.
- mutability ArrayMutability (Optional)
- The desired mutability of the view. Must not exceed the mutability of source. The default is Inherit.
Type Parameters
- T
- The element type of the matrix.
Return Value
Matrix<T>A rowCount×columnCount matrix that represents the upper triangular part of the leading submatrix of source. Elements outside the upper triangle read as 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. |