Skip to content

orthogonal_decompose_matrixOrthogonalDecomposeMatrixOrthogonalDecomposeMatrixorthogonal_decompose_matrixT_orthogonal_decompose_matrix๐Ÿ”—

Short description๐Ÿ”—

orthogonal_decompose_matrixOrthogonalDecomposeMatrixOrthogonalDecomposeMatrixorthogonal_decompose_matrixT_orthogonal_decompose_matrix โ€” Perform an orthogonal decomposition of a matrix.

Signature๐Ÿ”—

orthogonal_decompose_matrix( matrix MatrixID, string DecompositionType, string OutputMatricesType, string ComputeOrthogonal, out matrix MatrixOrthogonalID, out matrix MatrixTriangularID )void OrthogonalDecomposeMatrix( const HTuple& MatrixID, const HTuple& DecompositionType, const HTuple& OutputMatricesType, const HTuple& ComputeOrthogonal, HTuple* MatrixOrthogonalID, HTuple* MatrixTriangularID )static void HOperatorSet.OrthogonalDecomposeMatrix( HTuple matrixID, HTuple decompositionType, HTuple outputMatricesType, HTuple computeOrthogonal, out HTuple matrixOrthogonalID, out HTuple matrixTriangularID )def orthogonal_decompose_matrix( matrix_id: HHandle, decomposition_type: str, output_matrices_type: str, compute_orthogonal: str ) -> Tuple[HHandle, HHandle]

Herror T_orthogonal_decompose_matrix( const Htuple MatrixID, const Htuple DecompositionType, const Htuple OutputMatricesType, const Htuple ComputeOrthogonal, Htuple* MatrixOrthogonalID, Htuple* MatrixTriangularID )

HMatrix HMatrix::OrthogonalDecomposeMatrix( const HString& DecompositionType, const HString& OutputMatricesType, const HString& ComputeOrthogonal, HMatrix* MatrixTriangularID ) const

HMatrix HMatrix::OrthogonalDecomposeMatrix( const char* DecompositionType, const char* OutputMatricesType, const char* ComputeOrthogonal, HMatrix* MatrixTriangularID ) const

HMatrix HMatrix::OrthogonalDecomposeMatrix( const wchar_t* DecompositionType, const wchar_t* OutputMatricesType, const wchar_t* ComputeOrthogonal, HMatrix* MatrixTriangularID ) const (Windows only)

HMatrix HMatrix.OrthogonalDecomposeMatrix( string decompositionType, string outputMatricesType, string computeOrthogonal, out HMatrix matrixTriangularID )

Description๐Ÿ”—

The operator orthogonal_decompose_matrixOrthogonalDecomposeMatrix decomposes the Matrix defined by the matrix handle MatrixIDmatrixIDmatrix_id. The results are stored in the two generated matrices MatrixOrthogonal and MatrixTriangular. The operator returns the matrix handles MatrixOrthogonalIDmatrixOrthogonalIDmatrix_orthogonal_id and MatrixTriangularIDmatrixTriangularIDmatrix_triangular_id of these two matrices. Access to the elements of the matrices is possible e.g., with the operator get_full_matrixGetFullMatrix.

For OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'full'"full" all results of the decomposition are stored in the matrices MatrixOrthogonal and MatrixTriangular. For OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'reduced'"reduced" only a part of result elements of the matrices MatrixOrthogonal and MatrixTriangular are stored. Therefore the sizes of these matrices are smaller than for OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'full'"full".

For the parameter ComputeOrthogonalcomputeOrthogonalcompute_orthogonal = 'true'"true" both output matrices are computed. For the ComputeOrthogonalcomputeOrthogonalcompute_orthogonal = 'false'"false" only the matrix MatrixTriangular is computed. Thus, the runtime of the operation takes fewer time.

The type of the Matrix can be selected via the parameter DecompositionTypedecompositionTypedecomposition_type. For DecompositionTypedecompositionTypedecomposition_type = 'qr'"qr" a QR decomposition (Quadratic/Right) or for DecompositionTypedecompositionTypedecomposition_type = 'ql'"ql" a QL decomposition (Quadratic/Left) is computed. The decomposition is written as

\[\begin{eqnarray*} \texttt{Matrix} \quad = \quad \texttt{MatrixOrthogonal} \quad \cdot \quad \texttt{MatrixTriangular}. \end{eqnarray*}\]

Example:

DecompositionTypedecompositionTypedecomposition_type = 'qr'"qr", OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'full'"full"

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 6.0 & -3.0 & 4.0 \\ 5.0 & 5.0 & -2.0 \\ -3.0 & 12.0 & 5.0 \\ 3.0 & 4.0 & 7.0 \\ 7.0 & 5.0 & 3.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixOrthogonal} &=& \left[ \begin{array}{rrrrr} -0.5303 & 0.2613 & -0.4277 & -0.5566 & -0.3972 \\ -0.4419 & -0.2920 & -0.6383 & 0.1727 & -0.5312 \\ 0.2652 & -0.8443 & -0.2059 & -0.3961 & -0.1326 \\ -0.2652 & -0.2432 & -0.6008 & 0.7000 & -0.1400 \\ -0.6187 & -0.2729 & 0.0799 & -0.1160 & 0.7231 \end{array} \right]\\ \texttt{MatrixTriangular} &=& \left[ \begin{array}{rrr} -11.3137 & -1.5910 & -3.6239 \\ 0 & -14.7129 & -5.1135 \\ 0 & 0 & -7.9824 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array} \right] \end{eqnarray*}\]

Example:

DecompositionTypedecompositionTypedecomposition_type = 'qr'"qr", OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'reduced'"reduced"

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 6.0 & -3.0 & 4.0 \\ 5.0 & 5.0 & -2.0 \\ -3.0 & 12.0 & 5.0 \\ 3.0 & 4.0 & 7.0 \\ 7.0 & 5.0 & 3.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixOrthogonal} &=& \left[ \begin{array}{rrr} -0.5303 & 0.2613 & -0.4277 \\ -0.4419 & -0.2920 & -0.6383 \\ 0.2652 & -0.8443 & -0.2059 \\ -0.2652 & -0.2432 & -0.6008 \\ -0.6187 & -0.2729 & 0.0799 \end{array} \right]\\ \texttt{MatrixTriangular} &=& \left[ \begin{array}{rrr} -11.3137 & -1.5910 & -3.6239 \\ 0 & -14.7129 & -5.1135 \\ 0 & 0 & -7.9824 \end{array} \right] \end{eqnarray*}\]

Example:

DecompositionTypedecompositionTypedecomposition_type = 'ql'"ql", OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'full'"full"

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 6.0 & -3.0 & 4.0 \\ 5.0 & 5.0 & -2.0 \\ -3.0 & 12.0 & 5.0 \\ 3.0 & 4.0 & 7.0 \\ 7.0 & 5.0 & 3.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixOrthogonal} &=& \left[ \begin{array}{rrrrr} 0.6806 & 0.0657 & 0.3659 & -0.4932 & -0.3941 \\ 0.1161 & 0.5464 & 0.6091 & 0.5274 & 0.1971 \\ 0.4093 & -0.0832 & -0.4046 & 0.6474 & -0.4927 \\ -0.5362 & 0.4713 & 0.0072 & -0.1208 & -0.6897 \\ -0.2611 & -0.6842 & 0.5757 & 0.2119 & -0.2956 \end{array} \right]\\ \texttt{MatrixTriangular} &=& \left[ \begin{array}{rrr} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 10.5059 & 0 & 0 \\ -1.1429 & 12.4620 & 0 \\ -4.0399 & -7.9812 & -10.1489 \end{array} \right] \end{eqnarray*}\]

Example:

DecompositionTypedecompositionTypedecomposition_type = 'ql'"ql", OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'reduced'"reduced"

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 6.0 & -3.0 & 4.0 \\ 5.0 & 5.0 & -2.0 \\ -3.0 & 12.0 & 5.0 \\ 3.0 & 4.0 & 7.0 \\ 7.0 & 5.0 & 3.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixOrthogonal} &=& \left[ \begin{array}{rrrrr} 0.3659 & -0.4932 & -0.3941 \\ 0.6091 & 0.5274 & 0.1971 \\ -0.4046 & 0.6474 & -0.4927 \\ 0.0072 & -0.1208 & -0.6897 \\ 0.5757 & 0.2119 & -0.2956 \end{array} \right]\\ \texttt{MatrixTriangular} &=& \left[ \begin{array}{rrr} 10.5059 & 0 & 0 \\ -1.1429 & 12.4620 & 0 \\ -4.0399 & -7.9812 & -10.1489 \end{array} \right] \end{eqnarray*}\]

For DecompositionTypedecompositionTypedecomposition_type = 'rq'"rq" a RQ decomposition (Right/Quadratic) or for DecompositionTypedecompositionTypedecomposition_type = 'lq'"lq" a LQ decomposition (Left/Quadratic) is computed. The decomposition is written as

\[\begin{eqnarray*} \texttt{Matrix} \quad = \quad \texttt{MatrixTriangular} \quad \cdot \quad \texttt{MatrixOrthogonal}. \end{eqnarray*}\]

Example:

DecompositionTypedecompositionTypedecomposition_type = 'rq'"rq", OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'full'"full"

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrrrr} 6.0 & 5.0 & -3.0 & 3.0 & 7.0 \\ -3.0 & 5.0 & 12.0 & 4.0 & 5.0 \\ 4.0 & -2.0 & 5.0 & 7.0 & 3.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixOrthogonal} &=& \left[ \begin{array}{rrrrr} 0.6806 & 0.1161 & 0.4093 & -0.5362 & -0.2611 \\ 0.0657 & 0.5464 & -0.0832 & 0.4713 & -0.6842 \\ 0.3659 & 0.6091 & -0.4046 & 0.0072 & 0.5757 \\ -0.4932 & 0.5274 & 0.6474 & -0.1208 & 0.2119 \\ -0.3941 & 0.1971 & -0.4927 & -0.6897 & -0.2956 \end{array} \right]\\ \texttt{MatrixTriangular} &=& \left[ \begin{array}{rrrrr} 0 \qquad & \qquad 0 \qquad & \qquad 10.5059 & -1.1429 & -4.0399 \\ 0 \qquad & \qquad 0 \qquad & \qquad 0 & 12.4620 & -7.9812 \\ 0 \qquad & \qquad 0 \qquad & \qquad 0 & 0 & -10.1489 \end{array} \right] \end{eqnarray*}\]

Example:

DecompositionTypedecompositionTypedecomposition_type = 'rq'"rq", OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'reduced'"reduced"

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrrrr} 6.0 & 5.0 & -3.0 & 3.0 & 7.0 \\ -3.0 & 5.0 & 12.0 & 4.0 & 5.0 \\ 4.0 & -2.0 & 5.0 & 7.0 & 3.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixOrthogonal} &=& \left[ \begin{array}{rrrrr} 0.3659 & 0.6091 & -0.4046 & 0.0072 & 0.5757 \\ -0.4932 & 0.5274 & 0.6474 & -0.1208 & 0.2119 \\ -0.3941 & 0.1971 & -0.4927 & -0.6897 & -0.2956 \end{array} \right]\\ \texttt{MatrixTriangular} &=& \left[ \begin{array}{rrrrr} 10.5059 & -1.1429 & -4.0399 \\ 0 & 12.4620 & -7.9812 \\ 0 & 0 & -10.1489 \end{array} \right] \end{eqnarray*}\]

Example:

DecompositionTypedecompositionTypedecomposition_type = 'lq'"lq", OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'full'"full"

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrrrr} 6.0 & 5.0 & -3.0 & 3.0 & 7.0 \\ -3.0 & 5.0 & 12.0 & 4.0 & 5.0 \\ 4.0 & -2.0 & 5.0 & 7.0 & 3.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixOrthogonal} &=& \left[ \begin{array}{rrrrr} -0.5303 & -0.4419 & 0.2652 & -0.2652 & -0.6187 \\ 0.2613 & -0.2920 & -0.8443 & -0.2432 & -0.2729 \\ -0.4277 & 0.6383 & -0.2059 & -0.6008 & 0.0799 \\ -0.5566 & 0.1727 & -0.3961 & 0.7000 & -0.1160 \\ -0.3972 & -0.5312 & -0.1326 & -0.1400 & 0.7231 \end{array} \right]\\ \texttt{MatrixTriangular} &=& \left[ \begin{array}{rrrrr} -11.3137 & 0 & 0 & \qquad 0 \qquad & \qquad 0 \\ -1.5910 & -14.7129 & 0 & \qquad 0 \qquad & \qquad 0 \\ -3.6239 & -5.1135 & -7.9824 & \qquad 0 \qquad & \qquad 0 \end{array} \right] \end{eqnarray*}\]

Example:

DecompositionTypedecompositionTypedecomposition_type = 'lq'"lq", OutputMatricesTypeoutputMatricesTypeoutput_matrices_type = 'reduced'"reduced"

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrrrr} 6.0 & 5.0 & -3.0 & 3.0 & 7.0 \\ -3.0 & 5.0 & 12.0 & 4.0 & 5.0 \\ 4.0 & -2.0 & 5.0 & 7.0 & 3.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixOrthogonal} &=& \left[ \begin{array}{rrrrr} -0.5303 & -0.4419 & 0.2652 & -0.2652 & -0.6187 \\ 0.2613 & -0.2920 & -0.8443 & -0.2432 & -0.2729 \\ -0.4277 & 0.6383 & -0.2059 & -0.6008 & 0.0799 \end{array} \right]\\ \texttt{MatrixTriangular} &=& \left[ \begin{array}{rrr} -11.3137 & 0 & 0 \\ -1.5910 & -14.7129 & 0 \\ -3.6239 & -5.1135 & -7.9824 \end{array} \right] \end{eqnarray*}\]

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

Execution information๐Ÿ”—

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๐Ÿ”—

MatrixIDmatrixIDmatrix_id (input_control) matrix โ†’ (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

Matrix handle of the input matrix.

DecompositionTypedecompositionTypedecomposition_type (input_control) string โ†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Method of decomposition.

Default: 'qr'"qr"
List of values: 'lq', 'ql', 'qr', 'rq'"lq", "ql", "qr", "rq"

OutputMatricesTypeoutputMatricesTypeoutput_matrices_type (input_control) string โ†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of output matrices.

Default: 'full'"full"
List of values: 'full', 'reduced'"full", "reduced"

ComputeOrthogonalcomputeOrthogonalcompute_orthogonal (input_control) string โ†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Computation of the orthogonal matrix.

Default: 'true'"true"
List of values: 'false', 'true'"false", "true"

MatrixOrthogonalIDmatrixOrthogonalIDmatrix_orthogonal_id (output_control) matrix โ†’ (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

Matrix handle with the orthogonal part of the decomposed input matrix.

MatrixTriangularIDmatrixTriangularIDmatrix_triangular_id (output_control) matrix โ†’ (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

Matrix handle with the triangular part of the decomposed input matrix.

Result๐Ÿ”—

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

Combinations with other operators๐Ÿ”—

Combinations

Possible predecessors

create_matrixCreateMatrix

Possible successors

get_full_matrixGetFullMatrix, get_value_matrixGetValueMatrix

See also

decompose_matrixDecomposeMatrix, solve_matrixSolveMatrix

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