Skip to content

decompose_matrixDecomposeMatrixDecomposeMatrixdecompose_matrixT_decompose_matrix🔗

説明🔗

decompose_matrixDecomposeMatrixDecomposeMatrixdecompose_matrixT_decompose_matrix — 行列を分解する。

書式🔗

decompose_matrix( matrix MatrixID, string MatrixType, out matrix Matrix1ID, out matrix Matrix2ID )void DecomposeMatrix( const HTuple& MatrixID, const HTuple& MatrixType, HTuple* Matrix1ID, HTuple* Matrix2ID )static void HOperatorSet.DecomposeMatrix( HTuple matrixID, HTuple matrixType, out HTuple matrix1ID, out HTuple matrix2ID )def decompose_matrix( matrix_id: HHandle, matrix_type: str ) -> Tuple[HHandle, HHandle]

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

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

HMatrix HMatrix::DecomposeMatrix( const char* MatrixType, HMatrix* Matrix2ID ) const

HMatrix HMatrix::DecomposeMatrix( const wchar_t* MatrixType, HMatrix* Matrix2ID ) const (Windows only)

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

説明🔗

オペレーター decompose_matrixDecomposeMatrix は行列ハンドル MatrixIDmatrixIDmatrix_id で与えられた入力正方行列 Matrix を分解 します。結果は、生成された 2 つの行列 Matrix1 と Matrix2 に保存されます。オペレーターは行列ハンドル Matrix1IDmatrix1IDmatrix_1id と Matrix2IDmatrix2IDmatrix_2id を返します。行列の要素に は、オペレーター get_full_matrixGetFullMatrix などを使用してアクセスで きます。

入力行列 Matrix の種類は、パラメーター MatrixTypematrixTypematrix_type を使用して選択できます。パラメーターは次の値を サポートします。一般:'general'"general"、対称: 'symmetric'"symmetric"、対称正定値:'positive_definite'"positive_definite"、三 重対角行列:'tridiagonal'"tridiagonal" です。

MatrixTypematrixTypematrix_type = 'general'"general" または 'tridiagonal'"tridiagonal" の分解は、次の式を使用した LU 因数分解(下/ 上)です。

\[\begin{eqnarray*} \texttt{Matrix} \quad = \quad \texttt{Matrix1} \quad \cdot \quad \texttt{Matrix2}. \end{eqnarray*}\]

出力行列 Matrix1 は単位対角要素と交換された行を持つ下三 角行列です。出力行列 Matrix2 は上三角行列です。

一般行列の因数分解の例:

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 5.0 & -3.0 & 1.0 \\ 0.0 & 2.0 & -1.0 \\ -5.0 & -1.0 & 5.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{Matrix1} = \left[ \begin{array}{ccc} 1 & 0 & 0 \\ 0.0 & -0.5 & 1 \\ -1.0 & 1 & 0 \end{array} \right] \qquad \texttt{Matrix2} = \left[ \begin{array}{ccc} 5.0 & -3.0 & 1.0 \\ 0 & -4.0 & 6.0 \\ 0 & 0 & 2.0 \end{array} \right] \end{eqnarray*}\]

三重対角行列の因数分解の例:

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrrr} -8.0 & -8.0 & 0.0 & 0.0 \\ -8.0 & 6.0 & -4.0 & 0.0 \\ 0.0 & 7.0 & -2.0 & 7.0 \\ 0.0 & 0.0 & 5.0 & -3.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{Matrix1} = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 1.0 & 1 & 0 & 0 \\ 0.0 & 0.5 & 0.0 & 1 \\ 0.0 & 0.0 & 1 & 0 \end{array} \right] \qquad \texttt{Matrix2} = \left[ \begin{array}{cccc} -8.0 & -8.0 & 0.0 & 0.0 \\ 0 & 14.0 & -4.0 & 0.0 \\ 0 & 0 & 5.0 & -3.0 \\ 0 & 0 & 0 & 7.0 \end{array} \right] \end{eqnarray*}\]

MatrixTypematrixTypematrix_type = 'symmetric'"symmetric" の場合、因数分解は以下 の式で表される UDU\(^T\) 分解(上/対角/下)です。

\[\begin{eqnarray*} \texttt{Matrix} \quad = \quad \texttt{Matrix1} \quad \cdot \quad \texttt{Matrix2} \quad \cdot \quad \texttt{Matrix1}^T \end{eqnarray*}\]

出力行列 Matrix1 は変換された列を持つ上三重対角行列で す。出力行列 Matrix2 は \(1\times 1\) と \(2 \times 2\) 対角ブロックをもつ対称ブロック対角行列です。

対称行列の因数分解の例:

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrrr} 3.0 & -2.0 & 7.0 & -1.0 \\ -2.0 & -2.0 & 4.0 & 0.0 \\ 7.0 & 4.0 & 8.0 & 1.0 \\ -1.0 & 0.0 & 1.0 & 0.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{Matrix1} = \left[ \begin{array}{cccc} 0 & 0 & 1 & 0.0 \\ 0 & 1 & 0.0 & 2.0 \\ 1 & -1.0 & -1.0 & -10.0 \\ 0 & 0 & 0 & 1 \end{array} \right] \qquad \texttt{Matrix2} = \left[ \begin{array}{cccc} 27.0 & 0 & 0 & 0 \\ 0 & -2.0 & 0 & 0 \\ 0 & 0 & 3.0 & -1.0 \\ 0 & 0 & -1.0 & 0.0 \end{array} \right] \end{eqnarray*}\]

MatrixTypematrixTypematrix_type = 'positive_definite'"positive_definite" の場合、 Cholesky の因数分解は以下の式で計算されます。

\[\begin{eqnarray*} \texttt{Matrix} \quad = \quad \texttt{Matrix1} \quad \cdot \quad \texttt{Matrix2}. \end{eqnarray*}\]

出力行列 Matrix1 は下三角行列であり、出力行列 Matrix2 は上三角行列です。 さらに出力行列 Matrix2 は Matrix1 の転置です。

正定値行列の因数分解の例:

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 9.0 & 12.0 & -6.0 \\ 12.0 & 17.0 & -7.0 \\ -6.0 & -7.0 & 14.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{Matrix1} = \left[ \begin{array}{ccc} 3.0 & 0 & 0 \\ 4.0 & 1.0 & 0 \\ -2.0 & 1.0 & 3.0 \end{array} \right] \qquad \texttt{Matrix2} = \left[ \begin{array}{ccc} 3.0 & 4.0 & -2.0 \\ 0 & 1.0 & 1.0 \\ 0 & 0 & 3.0 \end{array} \right] \end{eqnarray*}\]

上記の例において、出力行列のに値はそれぞれ意味があります。つまり、 整数値である場合は、要素の値は 0 や 1 のように表示されます。要素の 値が浮動小数点の場合は、0.0 や 0.1 のように表示され、値はオペレー ターにより計算されます。

注意🔗

MatrixTypematrixTypematrix_type = 'symmetric'"symmetric" または 'positive_definite'"positive_definite" に対して、入力行列 Matrix の上三角部分に行列の関連情報を含める必要があります。 行列の下三角部分は参照されません。 MatrixTypematrixTypematrix_type = 'tridiagonal'"tridiagonal" の場合、入力行列 Matrix の主対角、上対角と下対角のみが使用されます。行列 のその他の部分は参照されません。入力行列 Matrix の参照部 分が指定された種類ではない場合、例外処理が発生します。

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

  • 並列演算処理には未対応

パラメーター🔗

MatrixIDmatrixIDmatrix_id (input_control) matrix → (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

入力行列の行列ハンドル

MatrixTypematrixTypematrix_type (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

入力行列の種類

初期値: 'general'"general"
値のリスト: 'general', 'positive_definite', 'symmetric', 'tridiagonal'"general", "positive_definite", "symmetric", "tridiagonal"

Matrix1IDmatrix1IDmatrix_1id (output_control) matrix → (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

出力行列 1 をもつ行列ハンドル

Matrix2IDmatrix2IDmatrix_2id (output_control) matrix → (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

出力行列 2 をもつ行列ハンドル

結果🔗

パラメーターが有効ならば、オペレーター decompose_matrixDecomposeMatrix は 値 2 (H_MSG_TRUE) を返します。必要に応じて、例外が発生します。

他のオペレーターとの組み合わせ🔗

組み合わせ

前処理の候補

create_matrixCreateMatrix

後処理の候補

get_full_matrixGetFullMatrix, get_value_matrixGetValueMatrix

他の選択候補

orthogonal_decompose_matrixOrthogonalDecomposeMatrix, solve_matrixSolveMatrix

参考文献🔗

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.

モジュール🔗

Foundation