Skip to content

get_sub_matrixGetSubMatrixGetSubMatrixget_sub_matrixT_get_sub_matrix🔗

Short description🔗

get_sub_matrixGetSubMatrixGetSubMatrixget_sub_matrixT_get_sub_matrix — Get a sub-matrix of a matrix.

Signature🔗

get_sub_matrix( matrix MatrixID, integer Row, integer Column, integer RowsSub, integer ColumnsSub, out matrix MatrixSubID )void GetSubMatrix( const HTuple& MatrixID, const HTuple& Row, const HTuple& Column, const HTuple& RowsSub, const HTuple& ColumnsSub, HTuple* MatrixSubID )static void HOperatorSet.GetSubMatrix( HTuple matrixID, HTuple row, HTuple column, HTuple rowsSub, HTuple columnsSub, out HTuple matrixSubID )def get_sub_matrix( matrix_id: HHandle, row: int, column: int, rows_sub: int, columns_sub: int ) -> HHandle

Herror T_get_sub_matrix( const Htuple MatrixID, const Htuple Row, const Htuple Column, const Htuple RowsSub, const Htuple ColumnsSub, Htuple* MatrixSubID )

HMatrix HMatrix::GetSubMatrix( Hlong Row, Hlong Column, Hlong RowsSub, Hlong ColumnsSub ) const

HMatrix HMatrix.GetSubMatrix( int row, int column, int rowsSub, int columnsSub )

Description🔗

The operator get_sub_matrixGetSubMatrix generates a new matrix MatrixSub and copies to this matrix a part of the input Matrix defined by the matrix handle MatrixIDmatrixIDmatrix_id. The part of the Matrix is determined by the upper left corner (Rowrowrow,Columncolumncolumn) and the sub-matrix dimensions (RowsSubrowsSubrows_sub, ColumnsSubcolumnsSubcolumns_sub). The operator returns the matrix handle MatrixSubIDmatrixSubIDmatrix_sub_id of the matrix MatrixSub. Access to the elements of the matrix is possible e.g., with the operator get_full_matrixGetFullMatrix.

Example:

Rowrowrow = 00, Columncolumncolumn = 11, RowsSubrowsSubrows_sub = 33, ColumnsSubcolumnsSubcolumns_sub = 22

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrrr} 3.0 & 1.0 & -2.0 & 1.0 \\ -5.0 & 7.0 & 2.0 & 6.0 \\ -9.0 & -4.0 & 1.0 & -1.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \quad \texttt{MatrixSub} = \left[ \begin{array}{rr} 1.0 & -2.0 \\ 7.0 & 2.0 \\ -4.0 & 1.0 \end{array} \right] \end{eqnarray*}\]

Attention🔗

The conditions 0 \(\le\) Rowrowrow \(<\) size of Matrix in row direction, Rowrowrow \(+\) RowsSubrowsSubrows_sub \(\le\) size of Matrix in the row direction, 0 \(\le\) Columncolumncolumn \(<\) size of Matrix in the column direction, and Columncolumncolumn \(+\) ColumnsSubcolumnsSubcolumns_sub \(\le\) size of matrix Matrix in the column direction must be satisfied.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

MatrixIDmatrixIDmatrix_id (input_control) matrix → (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

Matrix handle of the input matrix.

Rowrowrow (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Upper row position of the sub-matrix in the input matrix.

Default: 00
Suggested values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100
Restriction: Row >= 0

Columncolumncolumn (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Left column position of the sub-matrix in the input matrix.

Default: 00
Suggested values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100
Restriction: Column >= 0

RowsSubrowsSubrows_sub (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of rows of the sub-matrix.

Default: 11
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 1001, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100
Restriction: RowsSub >= 1

ColumnsSubcolumnsSubcolumns_sub (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of columns of the sub-matrix.

Default: 11
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 1001, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100
Restriction: ColumnsSub >= 1

MatrixSubIDmatrixSubIDmatrix_sub_id (output_control) matrix → (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

Matrix handle of the sub-matrix.

Result🔗

If the parameters are valid, the operator get_sub_matrixGetSubMatrix returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

create_matrixCreateMatrix

Possible successors

get_full_matrixGetFullMatrix, get_value_matrixGetValueMatrix

See also

set_sub_matrixSetSubMatrix

Module🔗

Foundation