Matrix<T>.GetSubmatrix Method

Definition

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

Overload List

GetSubmatrix(Range, Range) Returns a sub-matrix of this instance.
GetSubmatrix(Range, Range, TransposeOperation) Returns a sub-matrix of this instance.
GetSubmatrix(Int32, Int32, Int32, Int32) Returns a sub-matrix of this instance.
GetSubmatrix(Int32, Int32, Int32, Int32, Int32, Int32, TransposeOperation, Intent) Returns a sub-matrix of this instance.

GetSubmatrix(Range, Range)

Returns a sub-matrix of this instance.
C#
public Matrix<T> GetSubmatrix(
	Range rowRange,
	Range columnRange
)

Parameters

rowRange  Range
A Range value that specifies the range of rows that are to make up the new matrix.
columnRange  Range
A Range value that specifies the range of columns that are to make up the new matrix.

Return Value

Matrix<T>
A Matrix<T> that contains the specified rows and columns.

Remarks

The matrix returned by this method shares its storage with the matrix from which it is derived.

GetSubmatrix(Range, Range, TransposeOperation)

Returns a sub-matrix of this instance.
C#
public Matrix<T> GetSubmatrix(
	Range rowRange,
	Range columnRange,
	TransposeOperation transposeOperation
)

Parameters

rowRange  Range
A Range value that specifies the range of rows that are to make up the new matrix.
columnRange  Range
A Range value that specifies the range of columns that are to make up the new matrix.
transposeOperation  TransposeOperation
A TransposeOperation value that specifies whether or not this view should show the transpose of the matrix.

Return Value

Matrix<T>
A Matrix<T> that contains the specified rows and columns.

Remarks

The matrix returned by this method shares its storage with the matrix from which it is derived.

GetSubmatrix(Int32, Int32, Int32, Int32)

Returns a sub-matrix of this instance.
C#
public Matrix<T> GetSubmatrix(
	int startRow,
	int endRow,
	int startColumn,
	int endColumn
)

Parameters

startRow  Int32
The first row of the sub-matrix.
endRow  Int32
The last row of the sub-matrix.
startColumn  Int32
The first column of the sub-matrix.
endColumn  Int32
The last column of the sub-matrix.

Return Value

Matrix<T>
A Matrix<T> that contains the specified rows and columns.

Remarks

The matrix returned by this method shares its storage with the matrix from which it is derived.

Exceptions

ArgumentOutOfRangeException

startRow is less than zero or greater than or equal to the number of rows.

-or-

endRow or endRow is less than zero or greater than or equal to the number of rows.

-or-

startColumn is less than zero or greater than or equal to the number of columns.

-or-

endColumn or endRow is less than zero or greater than or equal to the number of columns.

GetSubmatrix(Int32, Int32, Int32, Int32, Int32, Int32, TransposeOperation, Intent)

Returns a sub-matrix of this instance.
C#
public virtual Matrix<T> GetSubmatrix(
	int startRow,
	int endRow,
	int rowStride,
	int startColumn,
	int endColumn,
	int columnStride,
	TransposeOperation transposeOperation,
	Intent intent = Intent.Inherit
)

Parameters

startRow  Int32
Index of the first row of the sub-matrix.
endRow  Int32
Index of the last row of the sub-matrix.
rowStride  Int32
The increment for the row index in the original matrix corresponding to an increment of one in the row index of the new matrix.
startColumn  Int32
Index of the first column of the sub-matrix.
endColumn  Int32
Index of the last column of the sub-matrix.
columnStride  Int32
The increment for the column index in the original matrix corresponding to an increment of one in the column index of the new matrix.
transposeOperation  TransposeOperation
A TransposeOperation value that specifies whether or not this view should show the transpose of the matrix.
intent  Intent  (Optional)
An Intent value that specifies the intended use of the sub-matrix.

Return Value

Matrix<T>
A Matrix<T> that contains the specified rows and columns.

Remarks

The matrix returned by this method is a view on the original matrix. This means that any changes to the elements of the return value will cause the corresponding elements in the original matrix to change as well. Use the CloneData() or the ToDenseMatrix() method on the return value to create a matrix which has its own private element storage independent from the original matrix.

Exceptions

ArgumentOutOfRangeException

startRow is less than zero or greater than or equal to the number of rows.

-or-

endRow or endRow is less than zero or greater than or equal to the number of rows.

-or-

startColumn is less than zero or greater than or equal to the number of columns.

-or-

endColumn or endRow is less than zero or greater than or equal to the number of columns.

See Also