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

decompose_matrixdecompose_matrixdecompose_matrixDecomposeMatrixDecomposeMatrix (Operator)

Name

decompose_matrixdecompose_matrixdecompose_matrixDecomposeMatrixDecomposeMatrix — Decompose a matrix.

Signature

decompose_matrix( : : MatrixID, MatrixType : Matrix1ID, Matrix2ID)

Herror decompose_matrix(const Hlong MatrixID, const char* MatrixType, Hlong* Matrix1ID, Hlong* Matrix2ID)

Herror T_decompose_matrix(const Htuple MatrixID, const Htuple MatrixType, Htuple* Matrix1ID, Htuple* Matrix2ID)

Herror decompose_matrix(const HTuple& MatrixID, const HTuple& MatrixType, Hlong* Matrix1ID, Hlong* Matrix2ID)

HMatrix HMatrix::DecomposeMatrix(const HTuple& MatrixType, HMatrix* Matrix2ID) const

void HOperatorSetX.DecomposeMatrix(
[in] VARIANT MatrixID, [in] VARIANT MatrixType, [out] VARIANT* Matrix1ID, [out] VARIANT* Matrix2ID)

IHMatrixX* HMatrixX.DecomposeMatrix(
[in] BSTR MatrixType, [out] IHMatrixX*Matrix2ID)

static void HOperatorSet.DecomposeMatrix(HTuple matrixID, HTuple matrixType, out HTuple matrix1ID, out HTuple matrix2ID)

HMatrix HMatrix.DecomposeMatrix(string matrixType, out HMatrix matrix2ID)

Description

The operator decompose_matrixdecompose_matrixdecompose_matrixDecomposeMatrixDecomposeMatrix decomposes the square input MatrixMatrixMatrixMatrixmatrix given by the matrix handle MatrixIDMatrixIDMatrixIDMatrixIDmatrixID. The results are stored in two generated matrices Matrix1Matrix1Matrix1Matrix1matrix1 and Matrix2Matrix2Matrix2Matrix2matrix2. The operator returns the matrix handles Matrix1IDMatrix1IDMatrix1IDMatrix1IDmatrix1ID and Matrix2IDMatrix2IDMatrix2IDMatrix2IDmatrix2ID. Access to the elements of the matrices is possible e.g. with the operator get_full_matrixget_full_matrixget_full_matrixGetFullMatrixGetFullMatrix.

The type of the input MatrixMatrixMatrixMatrixmatrix can be selected via the parameter MatrixTypeMatrixTypeMatrixTypeMatrixTypematrixType. The following values are supported: 'general'"general""general""general""general" for general, 'symmetric'"symmetric""symmetric""symmetric""symmetric" for symmetric, 'positive_definite'"positive_definite""positive_definite""positive_definite""positive_definite" for symmetric positive definite, and 'tridiagonal'"tridiagonal""tridiagonal""tridiagonal""tridiagonal" for tridiagonal matrices.

The decomposition MatrixTypeMatrixTypeMatrixTypeMatrixTypematrixType = 'general'"general""general""general""general" or 'tridiagonal'"tridiagonal""tridiagonal""tridiagonal""tridiagonal" is a LU factorization (Lower/Upper) with the form

  MatrixMatrixMatrixMatrixmatrix = Matrix1Matrix1Matrix1Matrix1matrix1 * Matrix2Matrix2Matrix2Matrix2matrix2

The output Matrix1Matrix1Matrix1Matrix1matrix1 is a lower triangular matrix with unit diagonal elements and interchanged rows. The output Matrix2Matrix2Matrix2Matrix2matrix2 is an upper triangular matrix.

Example for a factorization of a general matrix:


           /   5.0   -3.0    1.0  \
  Matrix = |   0.0    2.0   -1.0  |    ->
           \  -5.0   -1.0    5.0  /

            /    1     0    0  \             /  5.0  -3.0   1.0  \
  Matrix1 = |   0.0  -0.5   1  |   Matrix2 = |   0   -4.0   6.0  |
            \  -1.0    1    0  /             \   0     0    2.0  /

Example for a factorization of a tridiagonal matrix:


           /  -8.0  -8.0   0.0   0.0  \
           |  -8.0   6.0  -4.0   0.0  |
  Matrix = |   0.0   7.0  -2.0   7.0  |    ->
           \   0.0   0.0   5.0  -3.0  /

            /   1    0    0   0  \               / -8.0   -8.0   0.0   0.0  \
            |  1.0   1    0   0  |               |   0    14.0  -4.0   0.0  |
  Matrix1 = |  0.0  0.5  0.0  1  |     Matrix2 = |   0      0    5.0  -3.0  |
            \  0.0  0.0   1   0  /               \   0      0     0    7.0  /

For MatrixTypeMatrixTypeMatrixTypeMatrixTypematrixType = 'symmetric'"symmetric""symmetric""symmetric""symmetric" the factorization is a UDU^T decomposition (Upper/Diagonal/Upper) with the form

  MatrixMatrixMatrixMatrixmatrix = Matrix1Matrix1Matrix1Matrix1matrix1 * Matrix2Matrix2Matrix2Matrix2matrix2 *
                     Matrix1Matrix1Matrix1Matrix1matrix1^T.

where the output Matrix1Matrix1Matrix1Matrix1matrix1 is an upper triangular matrix with interchanaged columns. The output matrix Matrix2Matrix2Matrix2Matrix2matrix2 is a symmetric block diagonal matrix with 1 x 1 and 2 x 2 diagonal blocks.

Example for a factorization of a symmetric matrix:


           /   3.0  -2.0   7.0  -1.0  \
           |  -2.0  -2.0   4.0   0.0  |
  Matrix = |   7.0   4.0   8.0   1.0  |    ->
           \  -1.0   0.0   1.0   0.0  /

            /  0    0     1    0.0  \               / 27.0   0    0     0  \
            |  0    1    0.0   2.0  |               |   0  -2.0   0     0  |
  Matrix1 = |  1  -1.0  -1.0 -10.0  |     Matrix2 = |   0    0   3.0  -1.0 |
            \  0    0     0     1   /               \   0    0  -1.0   0.0 /

For MatrixTypeMatrixTypeMatrixTypeMatrixTypematrixType = 'positive_definite'"positive_definite""positive_definite""positive_definite""positive_definite" a Cholesky factorization is computed with the form

  MatrixMatrixMatrixMatrixmatrix = Matrix1Matrix1Matrix1Matrix1matrix1 * Matrix2Matrix2Matrix2Matrix2matrix2

where the output Matrix1Matrix1Matrix1Matrix1matrix1 is a lower triangular matrix and the output matrix Matrix2Matrix2Matrix2Matrix2matrix2 is an upper triangular matrix. Furthermore, the Matrix2Matrix2Matrix2Matrix2matrix2 is the transpose of the matrix Matrix1Matrix1Matrix1Matrix1matrix1.

Example for a factorization of a positive definite matrix:


           /   9.0   12.0   -6.0  \
  Matrix = |  12.0   17.0   -7.0  |    ->
           \  -6.0   -7.0   14.0  /

            /   3.0   0    0   \                /  3.0  4.0  -2.0  \
  Matrix1 = |   4.0  1.0   0   |      Matrix2 = |   0   1.0   1.0  |
            \  -2.0  1.0  3.0  /                \   0    0    3.0  /

It should be noted that in the examples there are differences in the meaning of the values of the output matrices: If a value is shown as an integer number, e.g., 0 or 1, the value of this element is per definition this certain value. If the number is shown as a floating point number, e.g., 0.0 or 1.0, the value is computed by the operator.

Attention

For MatrixTypeMatrixTypeMatrixTypeMatrixTypematrixType = 'symmetric'"symmetric""symmetric""symmetric""symmetric" or 'positive_definite'"positive_definite""positive_definite""positive_definite""positive_definite", the upper triangular part of the input MatrixMatrixMatrixMatrixmatrix must contain the relevant information of the matrix. The strictly lower triangular part of the matrix is not referenced. For MatrixTypeMatrixTypeMatrixTypeMatrixTypematrixType = 'tridiagonal'"tridiagonal""tridiagonal""tridiagonal""tridiagonal", only the main diagonal, the superdiagonal, and the subdiagonal of the input MatrixMatrixMatrixMatrixmatrix are used. The other parts of the matrix are not referenced. If the referenced part of the input MatrixMatrixMatrixMatrixmatrix is not of the specified type, an exception is raised.

Parallelization

Parameters

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

Matrix handle of the input matrix.

MatrixTypeMatrixTypeMatrixTypeMatrixTypematrixType (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Type of the input matrix.

Default value: 'general' "general" "general" "general" "general"

List of values: 'general'"general""general""general""general", 'symmetric'"symmetric""symmetric""symmetric""symmetric", 'positive_definite'"positive_definite""positive_definite""positive_definite""positive_definite", 'tridiagonal'"tridiagonal""tridiagonal""tridiagonal""tridiagonal"

Matrix1IDMatrix1IDMatrix1IDMatrix1IDmatrix1ID (output_control)  matrix HMatrix, HTupleHMatrix, HTupleHMatrixX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Matrix handle with the output matrix 1.

Matrix2IDMatrix2IDMatrix2IDMatrix2IDmatrix2ID (output_control)  matrix HMatrix, HTupleHMatrix, HTupleHMatrixX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Matrix handle with the output matrix 2.

Result

If the parameters are valid, the operator decompose_matrixdecompose_matrixdecompose_matrixDecomposeMatrixDecomposeMatrix 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

Alternatives

orthogonal_decompose_matrixorthogonal_decompose_matrixorthogonal_decompose_matrixOrthogonalDecomposeMatrixOrthogonalDecomposeMatrix, solve_matrixsolve_matrixsolve_matrixSolveMatrixSolveMatrix

References

David Poole: “Linear Algebra: A Modern Introduction”; Thomson; Belmont; 2006.
Gene H. Golub, Charles F. van Loan: “Matrix Computations”; The Johns Hopkins University Press; Baltimore and London; 1996.

Module

Foundation


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