Skip to content

solve_matrixSolveMatrixSolveMatrixsolve_matrixT_solve_matrix🔗

説明🔗

solve_matrixSolveMatrixSolveMatrixsolve_matrixT_solve_matrix — 連立方程式の解を計算する。

書式🔗

solve_matrix( matrix MatrixLHSID, string MatrixLHSType, real Epsilon, matrix MatrixRHSID, out matrix MatrixResultID )void SolveMatrix( const HTuple& MatrixLHSID, const HTuple& MatrixLHSType, const HTuple& Epsilon, const HTuple& MatrixRHSID, HTuple* MatrixResultID )static void HOperatorSet.SolveMatrix( HTuple matrixLHSID, HTuple matrixLHSType, HTuple epsilon, HTuple matrixRHSID, out HTuple matrixResultID )def solve_matrix( matrix_lhsid: HHandle, matrix_lhstype: str, epsilon: float, matrix_rhsid: HHandle ) -> HHandle

Herror T_solve_matrix( const Htuple MatrixLHSID, const Htuple MatrixLHSType, const Htuple Epsilon, const Htuple MatrixRHSID, Htuple* MatrixResultID )

HMatrix HMatrix::SolveMatrix( const HString& MatrixLHSType, double Epsilon, const HMatrix& MatrixRHSID ) const

HMatrix HMatrix::SolveMatrix( const char* MatrixLHSType, double Epsilon, const HMatrix& MatrixRHSID ) const

HMatrix HMatrix::SolveMatrix( const wchar_t* MatrixLHSType, double Epsilon, const HMatrix& MatrixRHSID ) const (Windows only)

HMatrix HMatrix.SolveMatrix( string matrixLHSType, double epsilon, HMatrix matrixRHSID )

説明🔗

オペレーター solve_matrixSolveMatrix は連立一次方程式または線形最小二 乗問題の解を計算します。入力行列 MatrixLHS と MatrixRHS は、行列ハンドル MatrixLHSIDmatrixLHSIDmatrix_lhsid と MatrixRHSIDmatrixRHSIDmatrix_rhsid により定義されます。 MatrixLHS と MatrixRHS の行数は同じでなければ なりません。オペレーターは行列 MatrixResult の行列ハンド ル MatrixResultIDmatrixResultIDmatrix_result_id を返します。行列の要素には、オペレー ター get_full_matrixGetFullMatrix などを使用してアクセスできます。

連立一次方程式の場合、次の式を解きます。

\[\begin{eqnarray*} \texttt{MatrixLHS} \quad \cdot \quad \texttt{MatrixResult} \quad = \quad \texttt{MatrixRHS} \end{eqnarray*}\]

従って、行列 MatrixLHS は正方行列でなければならず、パ ラメーター Epsilonepsilonepsilon は 0 でなければなりません。行列 MatrixLHS の種類は、パラメーター MatrixLHSTypematrixLHSTypematrix_lhstype を使用して選択できます。次の値をサポート しています。一般:'general'"general"、対称:'symmetric'"symmetric" 、三重対角:'tridiagonal'"tridiagonal"、対称正値: 'positive_definite'"positive_definite"、上三角: 'upper_triangular'"upper_triangular"、置換上三角: 'permuted_upper_triangular'"permuted_upper_triangular"、下三角: 'lower_triangular'"lower_triangular"、置換下三角行列: 'permuted_lower_triangular'"permuted_lower_triangular"。

例:

MatrixLHSTypematrixLHSTypematrix_lhstype = 'positive_definite'"positive_definite", Epsilonepsilonepsilon = 00

\[\begin{eqnarray*} \texttt{MatrixLHS} = \left[ \begin{array}{rrr} 6.0 & 5.0 & 3.0 \\ 5.0 & 7.0 & 3.0 \\ 3.0 & 3.0 & 4.0 \end{array} \right] \qquad \texttt{MatrixRHS} = \left[ \begin{array}{rr} -1.0 & 6.0 \\ 3.0 & -3.0 \\ 5.0 & 4.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixResult} = \left[ \begin{array}{rr} -2.0 & 3.0 \\ 1.0 & -3.0 \\ 2.0 & 1.0 \end{array} \right] \end{eqnarray*}\]

線形最小二乗問題または、Epsilonepsilonepsilon が 0 でなければ、行列 MatrixLHS は正方行列である必要はありません。線形最小二乗 問題は、行列 MatrixLHS の特異値分解(SVD)を使用し、以下 の式を最小化することによって解かれます。

\[\begin{eqnarray*} ||\,\texttt{MatrixRHS} \quad - \quad \texttt{MatrixLHS} \quad \cdot \quad \texttt{MatrixResult}\,||. \end{eqnarray*}\]

Epsilon \(\times\) 最大特異値よりも小さい特異値はすべて 0 に 設定されます。この値はゼロ除算を回避するために内分されません。 また、行列 MatrixLHS はランク落ちしている場合もありま す。行列のタイプは MatrixLHSTypematrixLHSTypematrix_lhstype = 'general'"general" を 指定し選択されなければなりません。

例:

MatrixLHSTypematrixLHSTypematrix_lhstype = 'general'"general", Epsilonepsilonepsilon = 2.2204e-162.2204e-16

\[\begin{eqnarray*} \texttt{MatrixLHS} = \left[ \begin{array}{rrrr} 6.0 & 5.0 & 3.0 \\ 3.0 & 7.0 & -3.0 \\ 5.0 & 12.0 & 4.0 \\ 5.0 & 4.0 & 12.0 \\ 4.0 & 6.0 & 8.0 \end{array} \right] \qquad \texttt{MatrixRHS} = \left[ \begin{array}{r} 29.0 \\ 10.0 \\ 35.0 \\ 43.0 \\ 25.0 \end{array} \right] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{MatrixResult} = \left[ \begin{array}{r} 3.4914 \\ 0.7114 \\ 1.6213 \end{array} \right] \end{eqnarray*}\]

備考 : 使用データタイプ(double)の浮動小数点表示の相対精度は Epsilonepsilonepsilon = 2.2204e-16 です。

注意🔗

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

実行情報🔗

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

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

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

パラメーター🔗

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

左側の入力行列の行列ハンドル

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

左側の入力行列のタイプ

初期値: 'general'"general"
値のリスト: 'general', 'lower_triangular', 'permuted_lower_triangular', 'permuted_upper_triangular', 'positive_definite', 'symmetric', 'tridiagonal', 'upper_triangular'"general", "lower_triangular", "permuted_lower_triangular", "permuted_upper_triangular", "positive_definite", "symmetric", "tridiagonal", "upper_triangular"

Epsilonepsilonepsilon (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

あまりに小さな特異値を 0 とみなすためのしきい値

初期値: 0.00.0
推奨値: 0.0, 2.2204e-160.0, 2.2204e-16

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

右側の入力行列の行列ハンドル

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

解を持つ新しい行列ハンドル

結果🔗

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

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

組み合わせ

前処理の候補

create_matrixCreateMatrix

後処理の候補

get_full_matrixGetFullMatrix, get_value_matrixGetValueMatrix

参考文献🔗

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