HALCON Reference Manual 10.0.2
Table of Contents / Matrix / Access ClassesClassesClasses | | | Operators

get_diagonal_matrixget_diagonal_matrixget_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrix (Operator)

Name

get_diagonal_matrixget_diagonal_matrixget_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrix — Get the diagonal elements of a matrix.

Signature

get_diagonal_matrix( : : MatrixID, Diagonal : VectorID)

Herror get_diagonal_matrix(const Hlong MatrixID, const Hlong Diagonal, Hlong* VectorID)

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

Herror get_diagonal_matrix(const HTuple& MatrixID, const HTuple& Diagonal, Hlong* VectorID)

HMatrix HMatrix::GetDiagonalMatrix(const HTuple& Diagonal) const

void HOperatorSetX.GetDiagonalMatrix(
[in] VARIANT MatrixID, [in] VARIANT Diagonal, [out] VARIANT* VectorID)

IHMatrixX* HMatrixX.GetDiagonalMatrix([in] Hlong Diagonal)

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

HMatrix HMatrix.GetDiagonalMatrix(int diagonal)

Description

The operator get_diagonal_matrixget_diagonal_matrixget_diagonal_matrixGetDiagonalMatrixGetDiagonalMatrix 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_matrixget_full_matrixGetFullMatrixGetFullMatrix.

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

Example:


           /   3.0   1.0  -2.0  \
  Matrix = |  -5.0   7.0   2.0  |      Diagonal = 0
           \  -9.0  -4.0   1.0  /

                /  3.0  \
  ->   Vector = |  7.0  |
                \  1.0  /

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

Example:


           /   3.0   1.0  -2.0   1.0  \
  Matrix = |  -5.0   7.0   2.0   6.0  |      Diagonal = 2
           \  -9.0  -4.0   1.0  -1.0  /

                / -2.0  \
  ->   Vector = \  6.0  /

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

Example:


           /   3.0   1.0  -2.0   1.0  \
  Matrix = |  -5.0   7.0   2.0   6.0  |    Diagonal = - 1
           \  -9.0  -4.0   1.0  -1.0  /

                / -5.0  \
  ->   Vector = \ -4.0  /

Parallelization

Parameters

MatrixIDMatrixIDMatrixIDMatrixIDmatrixID (input_control)  matrix HMatrix, HTupleHMatrix, HTupleHMatrixX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Matrix handle of the input matrix.

DiagonalDiagonalDiagonalDiagonaldiagonal (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (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, HTupleHMatrix, HTupleHMatrixX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Matrix handle containing the diagonal elements.

Result

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

Possible Predecessors

create_matrixcreate_matrixcreate_matrixCreateMatrixCreateMatrix

Possible Successors

get_full_matrixget_full_matrixget_full_matrixGetFullMatrixGetFullMatrix, get_value_matrixget_value_matrixget_value_matrixGetValueMatrixGetValueMatrix

See also

set_diagonal_matrixset_diagonal_matrixset_diagonal_matrixSetDiagonalMatrixSetDiagonalMatrix

Module

Foundation


Table of Contents / Matrix / Access ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH