Operator Reference

get_diagonal_matrixT_get_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrixget_diagonal_matrix (Operator)

get_diagonal_matrixT_get_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrixget_diagonal_matrix — Get the diagonal elements of a matrix.

Signature

get_diagonal_matrix( : : MatrixID, Diagonal : VectorID)

Herror T_get_diagonal_matrix(const Htuple MatrixID, const Htuple Diagonal, Htuple* VectorID)

void GetDiagonalMatrix(const HTuple& MatrixID, const HTuple& Diagonal, HTuple* VectorID)

HMatrix HMatrix::GetDiagonalMatrix(Hlong Diagonal) const

static void HOperatorSet.GetDiagonalMatrix(HTuple matrixID, HTuple diagonal, out HTuple vectorID)

HMatrix HMatrix.GetDiagonalMatrix(int diagonal)

def get_diagonal_matrix(matrix_id: HHandle, diagonal: int) -> HHandle

Description

The operator get_diagonal_matrixget_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrixget_diagonal_matrix generates a new matrix Vector and copies the diagonal elements of the Matrix to this new matrix. The Matrix is defined by the matrix handle MatrixIDMatrixIDMatrixIDmatrixIDmatrix_id. The matrix Vector has one column and n rows, where n = number of diagonal elements. The operator returns the matrix handle VectorIDVectorIDVectorIDvectorIDvector_id of the matrix Vector. Access to the elements of the matrix is possible e.g., with the operator get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixget_full_matrix.

If DiagonalDiagonalDiagonaldiagonaldiagonal = 0, the output of the Vector is the main diagonal of the Matrix.

Example:

DiagonalDiagonalDiagonaldiagonaldiagonal = 0

If DiagonalDiagonalDiagonaldiagonaldiagonal is positive, the output Vector is the DiagonalDiagonalDiagonaldiagonaldiagonal-th super-diagonal of the Matrix.

Example:

DiagonalDiagonalDiagonaldiagonaldiagonal = 2

If DiagonalDiagonalDiagonaldiagonaldiagonal is negative, the DiagonalDiagonalDiagonaldiagonaldiagonal-th sub-diagonal of the Matrix is copied.

Example:

DiagonalDiagonalDiagonaldiagonaldiagonal = -1

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

MatrixIDMatrixIDMatrixIDmatrixIDmatrix_id (input_control)  matrix HMatrix, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle of the input matrix.

DiagonalDiagonalDiagonaldiagonaldiagonal (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of the desired diagonal.

Default: 0

Suggested values: -20, -10, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 10, 20

VectorIDVectorIDVectorIDvectorIDvector_id (output_control)  matrix HMatrix, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle containing the diagonal elements.

Result

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

Possible Predecessors

create_matrixcreate_matrixCreateMatrixCreateMatrixcreate_matrix

Possible Successors

get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixget_full_matrix, get_value_matrixget_value_matrixGetValueMatrixGetValueMatrixget_value_matrix

See also

set_diagonal_matrixset_diagonal_matrixSetDiagonalMatrixSetDiagonalMatrixset_diagonal_matrix

Module

Foundation