Matrix.CopyFromUpperTriangular Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.5.0

Overload List

CopyFromUpperTriangular<T>(Matrix<T>, MatrixDiagonal, ArrayMutability) Returns an independent copy of the upper triangular part of a matrix.
CopyFromUpperTriangular<T>(Matrix<T>, Int32, Int32, MatrixDiagonal, ArrayMutability) Returns an independent copy of the upper triangular part of a matrix with explicit dimensions.
CopyFromUpperTriangular<T>(T[], Int32, Int32, MatrixDiagonal, MatrixElementOrder, ArrayMutability) Creates a new upper TriangularMatrix<T> by copying data from a one-dimensional array.

CopyFromUpperTriangular<T>(Matrix<T>, MatrixDiagonal, ArrayMutability)

Returns an independent copy of the upper triangular part of a matrix.
C#
public static Matrix<T> CopyFromUpperTriangular<T>(
	Matrix<T> source,
	MatrixDiagonal diagonal = MatrixDiagonal.NonUnitDiagonal,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

source  Matrix<T>
The source matrix.
diagonal  MatrixDiagonal  (Optional)
A MatrixDiagonal value that specifies whether the diagonal elements are copied from the source or set to one. The default is NonUnitDiagonal.
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 upper triangular part of source; all elements below the diagonal are zero. In Professional edition this may be a TriangularMatrix<T>.

Exceptions

ArgumentNullException

source is null.

CopyFromUpperTriangular<T>(Matrix<T>, Int32, Int32, MatrixDiagonal, ArrayMutability)

Returns an independent copy of the upper triangular part of a matrix with explicit dimensions.
C#
public static Matrix<T> CopyFromUpperTriangular<T>(
	Matrix<T> source,
	int rowCount,
	int columnCount,
	MatrixDiagonal diagonal = MatrixDiagonal.NonUnitDiagonal,
	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).
diagonal  MatrixDiagonal  (Optional)
A MatrixDiagonal value that specifies whether the diagonal elements are copied from the source or set to one. The default is NonUnitDiagonal.
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 upper triangular part of the leading submatrix of source; all elements below the diagonal are zero.

Exceptions

ArgumentNullException

source is null.

ArgumentOutOfRangeException

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.

CopyFromUpperTriangular<T>(T[], Int32, Int32, MatrixDiagonal, MatrixElementOrder, ArrayMutability)

Creates a new upper TriangularMatrix<T> by copying data from a one-dimensional array.
C#
public static TriangularMatrix<T> CopyFromUpperTriangular<T>(
	T[] source,
	int rowCount,
	int columnCount,
	MatrixDiagonal diagonal = MatrixDiagonal.NonUnitDiagonal,
	MatrixElementOrder elementOrder = MatrixElementOrder.ColumnMajor,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

source  T[]
A one-dimensional array containing the triangular matrix values.
rowCount  Int32
The number of rows in the matrix.
columnCount  Int32
The number of columns in the matrix.
diagonal  MatrixDiagonal  (Optional)
Specifies whether the matrix has a unit diagonal.
elementOrder  MatrixElementOrder  (Optional)
A MatrixElementOrder value that indicates whether the elements in source are stored in column-major or row-major order.
mutability  ArrayMutability  (Optional)
Specifies how the matrix's values may be changed. The default is mutable values.

Type Parameters

T
The element type of the matrix.

Return Value

TriangularMatrix<T>
A new upper TriangularMatrix<T> with copied data.

Exceptions

ArgumentNullExceptionsource is null.

See Also