get_diagonal_matrixT_get_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrixget_diagonal_matrix (Operator)

Name

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_matrixGetDiagonalMatrixGetDiagonalMatrixGetDiagonalMatrixget_diagonal_matrix generates a new matrix VectorVectorVectorVectorvectorvector and copies the diagonal elements of the MatrixMatrixMatrixMatrixmatrixmatrix to this new matrix. The MatrixMatrixMatrixMatrixmatrixmatrix is defined by the matrix handle MatrixIDMatrixIDMatrixIDMatrixIDmatrixIDmatrix_id. The matrix VectorVectorVectorVectorvectorvector has one column and n rows, where n = number of diagonal elements. The operator returns the matrix handle VectorIDVectorIDVectorIDVectorIDvectorIDvector_id of the matrix VectorVectorVectorVectorvectorvector. Access to the elements of the matrix is possible e.g. with the operator get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrixget_full_matrix.

If DiagonalDiagonalDiagonalDiagonaldiagonaldiagonal = 0, the output of the VectorVectorVectorVectorvectorvector is the main diagonal of the MatrixMatrixMatrixMatrixmatrixmatrix.

Example:

If DiagonalDiagonalDiagonalDiagonaldiagonaldiagonal is positive, the output VectorVectorVectorVectorvectorvector is the DiagonalDiagonalDiagonalDiagonaldiagonaldiagonal-th super-diagonal of the MatrixMatrixMatrixMatrixmatrixmatrix.

Example:

If DiagonalDiagonalDiagonalDiagonaldiagonaldiagonal is negative, the DiagonalDiagonalDiagonalDiagonaldiagonaldiagonal-th sub-diagonal of the MatrixMatrixMatrixMatrixmatrixmatrix is copied.

Example:

Execution Information

Parameters

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

Matrix handle of the input matrix.

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

Number of the desired diagonal.

Default value: 0

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

VectorIDVectorIDVectorIDVectorIDvectorIDvector_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_matrixGetDiagonalMatrixGetDiagonalMatrixGetDiagonalMatrixget_diagonal_matrix returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Possible Predecessors

create_matrixcreate_matrixCreateMatrixCreateMatrixCreateMatrixcreate_matrix

Possible Successors

get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrixget_full_matrix, get_value_matrixget_value_matrixGetValueMatrixGetValueMatrixGetValueMatrixget_value_matrix

See also

set_diagonal_matrixset_diagonal_matrixSetDiagonalMatrixSetDiagonalMatrixSetDiagonalMatrixset_diagonal_matrix

Module

Foundation