get_diagonal_matrixT_get_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrix (Operator)

Name

get_diagonal_matrixT_get_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrix — 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)

Description

The operator get_diagonal_matrixget_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrixGetDiagonalMatrix generates a new matrix VectorVectorVectorVectorvector and copies the diagonal elements of the MatrixMatrixMatrixMatrixmatrix to this new matrix. The MatrixMatrixMatrixMatrixmatrix is defined by the matrix handle MatrixIDMatrixIDMatrixIDMatrixIDmatrixID. The matrix VectorVectorVectorVectorvector has one column and n rows, where n = number of diagonal elements. The operator returns the matrix handle VectorIDVectorIDVectorIDVectorIDvectorID of the matrix VectorVectorVectorVectorvector. Access to the elements of the matrix is possible e.g. with the operator get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrix.

If DiagonalDiagonalDiagonalDiagonaldiagonal = 0, the output of the VectorVectorVectorVectorvector is the main diagonal of the MatrixMatrixMatrixMatrixmatrix.

Example:

If DiagonalDiagonalDiagonalDiagonaldiagonal is positive, the output VectorVectorVectorVectorvector is the DiagonalDiagonalDiagonalDiagonaldiagonal-th super-diagonal of the MatrixMatrixMatrixMatrixmatrix.

Example:

If DiagonalDiagonalDiagonalDiagonaldiagonal is negative, the DiagonalDiagonalDiagonalDiagonaldiagonal-th sub-diagonal of the MatrixMatrixMatrixMatrixmatrix is copied.

Example:

Execution Information

Parameters

MatrixIDMatrixIDMatrixIDMatrixIDmatrixID (input_control)  matrix HMatrix, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle of the input matrix.

DiagonalDiagonalDiagonalDiagonaldiagonal (input_control)  integer HTupleHTupleHtuple (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

VectorIDVectorIDVectorIDVectorIDvectorID (output_control)  matrix HMatrix, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle containing the diagonal elements.

Result

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

Possible Predecessors

create_matrixcreate_matrixCreateMatrixCreateMatrixCreateMatrix

Possible Successors

get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrix, get_value_matrixget_value_matrixGetValueMatrixGetValueMatrixGetValueMatrix

See also

set_diagonal_matrixset_diagonal_matrixSetDiagonalMatrixSetDiagonalMatrixSetDiagonalMatrix

Module

Foundation