データ構造 | 関数
行列演算

データ構造

struct  mist::matrix_style
 行列計算をする際の入力となる行列の形式 [詳細]

関数

template<class T , class Allocator >
bool mist::multiply (const matrix< T, Allocator > &a, const matrix< T, Allocator > &b, matrix< T, Allocator > &c, bool a_is_transpose, bool b_is_transpose, typename matrix< T, Allocator >::value_type alpha, typename matrix< T, Allocator >::value_type beta)
 行列×行列の演算を行う
template<class T , class Allocator >
bool mist::multiply (const matrix< T, Allocator > &a, const matrix< T, Allocator > &b, matrix< T, Allocator > &c, bool a_is_transpose=false, bool b_is_transpose=false)
 行列×行列の演算を行う
template<class T1 , class T2 , class Allocator1 , class Allocator2 >
void mist::permutation_matrix (const matrix< T1, Allocator1 > &pivot, matrix< T2, Allocator2 > &out)
 LU分解などで得られるピボット配列からピボット行列を作成
template<class T , class Allocator >
const matrix< T, Allocator >
::value_type 
mist::trace (const matrix< T, Allocator > &a)
 トレースの計算(対角成分の和)
template<class T , class Allocator >
const matrix< T, Allocator >
::value_type 
mist::det (const matrix< T, Allocator > &a, matrix_style::style style=matrix_style::ge)
 行列式の計算
template<class T , class Allocator >
const matrix< T, Allocator > & mist::solve (const matrix< T, Allocator > &a, matrix< T, Allocator > &b, matrix_style::style style=matrix_style::ge)
 行列の連立一次方程式を解く関数
template<class T , class Allocator1 , class Allocator2 >
const matrix< T, Allocator1 > mist::lu_factorization (const matrix< T, Allocator1 > &a, matrix< __clapack__::integer, Allocator2 > &pivot, matrix_style::style style=matrix_style::ge)
 行列のLU分解を行う
template<class T , class Allocator >
bool mist::lu_factorization (const matrix< T, Allocator > &a, matrix< T, Allocator > &L, matrix< T, Allocator > &U, matrix< T, Allocator > &pivot, matrix_style::style style=matrix_style::ge)
 行列のLU分解を行う
template<class T , class Allocator >
const matrix< T, Allocator > mist::lu_factorization (const matrix< T, Allocator > &a, matrix_style::style style=matrix_style::ge)
 行列のLU分解を行う
template<class T , class Allocator >
const matrix< T, Allocator > mist::cholesky_factorization (const matrix< T, Allocator > &a, matrix_style::style style=matrix_style::sy)
 対称行列のコレスキー分解を行う
template<class T , class Allocator >
void mist::qr_factorization (const matrix< T, Allocator > &a, matrix< T, Allocator > &Q, matrix< T, Allocator > &R, matrix_style::style style=matrix_style::ge)
 行列のQR分解を行う
template<class T , class Allocator >
matrix< T, Allocator > mist::inverse (const matrix< T, Allocator > &a, matrix_style::style style=matrix_style::ge)
 行列の逆行列をLU分解を用いて計算する
template<class T , class Allocator >
const matrix< T, Allocator > & mist::eigen (const matrix< T, Allocator > &a, matrix< T, Allocator > &eigen_value, matrix< T, Allocator > &eigen_vector, matrix_style::style style=matrix_style::ge)
 行列の固有値・固有ベクトルを計算する
template<class T1 , class T2 , class Allocator1 , class Allocator2 >
const matrix< T2, Allocator2 > & mist::svd (const matrix< T1, Allocator1 > &a, matrix< T1, Allocator1 > &u, matrix< T2, Allocator2 > &s, matrix< T1, Allocator1 > &vt, matrix_style::style style=matrix_style::ge)
 行列の特異値分解を計算する
template<class T1 , class T2 , class Allocator1 , class Allocator2 >
const matrix< T2, Allocator2 > & mist::svd (const matrix< T1, Allocator1 > &a, matrix< T2, Allocator2 > &s, matrix< T1, Allocator1 > &vt, matrix_style::style style=matrix_style::ge)
 行列の特異値分解を計算する

説明

次のヘッダをインクルードする
#include <mist/numeric.h>

関数

template<class T , class Allocator >
const matrix< T, Allocator > mist::cholesky_factorization ( const matrix< T, Allocator > &  a,
matrix_style::style  style = matrix_style::sy 
)

対称行列のコレスキー分解を行う

引数
[in]a… 入力対称行列
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
コレスキー分解された結果
template<class T , class Allocator >
const matrix< T, Allocator >::value_type mist::det ( const matrix< T, Allocator > &  a,
matrix_style::style  style = matrix_style::ge 
)
inline

行列式の計算

\[ \left| {\bf A} \right| = \left| \begin{array}{ccccc} a_{11} & \cdots & a_{1j} & \cdots & a_{1n} \\ a_{21} & \cdots & a_{2j} & \cdots & a_{2n} \\ \vdots & \cdots & \vdots & \cdots & \vdots \\ a_{n1} & \cdots & a_{nj} & \cdots & a_{nn} \end{array} \right| = \sum^{n}_{j=1}{ \left( -1 \right)^{j+1} a_{1j} \left| \begin{array}{cccccc} a_{21} & \cdots & a_{2,j-1} & a_{2,j+1} & \cdots & a_{2n} \\ \vdots & \cdots & \vdots & \vdots & \cdots & \vdots \\ a_{n1} & \cdots & a_{n,j-1} & a_{n,j+1} & \cdots & a_{nn} \end{array} \right| } \]

引数
[in]a… 入力行列
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
$\left| {\bf A} \right|$

参照先 mist::matrix< T, Allocator >::cols(), mist::array< T, Allocator >::empty(), mist::lu_factorization(), mist::matrix< T, Allocator >::rows(), と mist::array< T, Allocator >::size().

template<class T , class Allocator >
const matrix< T, Allocator >& mist::eigen ( const matrix< T, Allocator > &  a,
matrix< T, Allocator > &  eigen_value,
matrix< T, Allocator > &  eigen_vector,
matrix_style::style  style = matrix_style::ge 
)

行列の固有値・固有ベクトルを計算する

\[ {\bf A}\mbox{\boldmath x} = \lambda\mbox{\boldmath x} \]

計算結果は,_DESCENDING_ORDER_EIGEN_VALUE_ の値によって,固有値が昇順・降順のどちらかで並ぶように変換される

引数
[in]a… 入力行列 ${\bf A}$
[out]eigen_value… 固有値が昇順・降順のどちらかで入ったベクトル $\lambda$
[out]eigen_vector… 固有値の昇順・降順のどちらかに対応し,左から固有ベクトルが並んだ行列 $\mbox{\boldmath x}$
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
固有値が並んだベクトル(eigen_valueと同じ) $\lambda$

参照先 mist::matrix< T, Allocator >::rows(), と mist::array< T, Allocator >::size().

参照元 compute_fundamental_matrix().

template<class T , class Allocator >
matrix< T, Allocator > mist::inverse ( const matrix< T, Allocator > &  a,
matrix_style::style  style = matrix_style::ge 
)

行列の逆行列をLU分解を用いて計算する

正方行列で無い場合は,特異値分解を用いて一般化逆行列を計算する

\[ {\bf A}^{-1} \]

引数
[in]a… 入力行列
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
逆行列 $ {\bf A}^{-1} $

参照先 mist::matrix< T, Allocator >::cols(), mist::matrix< T, Allocator >::rows(), と mist::svd().

参照元 mist::Tsai::calibration(), mist::nearest::transform(), mist::linear::transform(), と mist::cubic::transform().

template<class T , class Allocator1 , class Allocator2 >
const matrix< T, Allocator1 > mist::lu_factorization ( const matrix< T, Allocator1 > &  a,
matrix< __clapack__::integer, Allocator2 > &  pivot,
matrix_style::style  style = matrix_style::ge 
)

行列のLU分解を行う

引数
[in]a… 入力行列
[out]pivot… ピボット選択を行った結果を代入するベクトル
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
LU分解された結果

参照元 mist::det(), と mist::lu_factorization().

template<class T , class Allocator >
bool mist::lu_factorization ( const matrix< T, Allocator > &  a,
matrix< T, Allocator > &  L,
matrix< T, Allocator > &  U,
matrix< T, Allocator > &  pivot,
matrix_style::style  style = matrix_style::ge 
)

行列のLU分解を行う

\[ {\bf A} = {\bf P} \; \times \; {\bf L} \; \times \; {\bf U} \]

引数
[in]a… 入力行列 $\mbox{\bf A}$
[out]L… 下三角行列 $\mbox{\bf L}$
[out]U… 上三角行列 $\mbox{\bf U}$
[out]pivot… ピボット選択を行った結果を元に戻す行列 $\mbox{\bf P}$
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
LU分解に成功したかどうか

参照先 mist::matrix< T, Allocator >::cols(), mist::lu_factorization(), mist::permutation_matrix(), mist::matrix< T, Allocator >::resize(), と mist::matrix< T, Allocator >::rows().

template<class T , class Allocator >
const matrix< T, Allocator > mist::lu_factorization ( const matrix< T, Allocator > &  a,
matrix_style::style  style = matrix_style::ge 
)

行列のLU分解を行う

引数
[in]a… 入力行列
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
LU分解された結果

参照先 mist::matrix< T, Allocator >::cols(), と mist::lu_factorization().

template<class T , class Allocator >
bool mist::multiply ( const matrix< T, Allocator > &  a,
const matrix< T, Allocator > &  b,
matrix< T, Allocator > &  c,
bool  a_is_transpose,
bool  b_is_transpose,
typename matrix< T, Allocator >::value_type  alpha,
typename matrix< T, Allocator >::value_type  beta 
)
inline

行列×行列の演算を行う

\[ {\bf C} = \alpha \times {\bf A} \times {\bf B} + \beta \times {\bf C} \]

引数
[in]a… 入力行列 ${\bf A}$
[in]b… 入力行列 ${\bf B}$
[out]c… 計算結果を出力する行列 ${\bf C}$
[in]a_is_transpose… 行列 ${\bf A}$ を転置行列として掛け算する場合は true とする
[in]b_is_transpose… 行列 ${\bf B}$ を転置行列として掛け算する場合は true とする
[in]alpha… 行列演算の和を計算するときの係数
[in]beta… 行列演算の和を計算するときの係数
戻り値
行列の積が正しく計算できたかどうか

参照先 mist::matrix< T, Allocator >::cols(), mist::array< T, Allocator >::empty(), mist::array< T, Allocator >::fill(), mist::matrix< T, Allocator >::resize(), と mist::matrix< T, Allocator >::rows().

参照元 mist::multiply().

template<class T , class Allocator >
bool mist::multiply ( const matrix< T, Allocator > &  a,
const matrix< T, Allocator > &  b,
matrix< T, Allocator > &  c,
bool  a_is_transpose = false,
bool  b_is_transpose = false 
)
inline

行列×行列の演算を行う

\[ {\bf C} = {\bf A} \times {\bf B} \]

引数
[in]a… 入力行列 ${\bf A}$
[in]b… 入力行列 ${\bf B}$
[out]c… 計算結果を出力する行列 ${\bf C}$
[in]a_is_transpose… 行列 ${\bf A}$ を転置行列として掛け算する場合は true とする(デフォルトは false )
[in]b_is_transpose… 行列 ${\bf B}$ を転置行列として掛け算する場合は true とする(デフォルトは false )
戻り値
行列の積が正しく計算できたかどうか

参照先 mist::multiply().

template<class T1 , class T2 , class Allocator1 , class Allocator2 >
void mist::permutation_matrix ( const matrix< T1, Allocator1 > &  pivot,
matrix< T2, Allocator2 > &  out 
)
inline

LU分解などで得られるピボット配列からピボット行列を作成

引数
[in]pivot… ピボット配列
[out]out… ピボット行列
戻り値
ピボット行列

参照先 mist::array< T, Allocator >::fill(), mist::matrix< T, Allocator >::resize(), と mist::array< T, Allocator >::size().

参照元 mist::lu_factorization().

template<class T , class Allocator >
void mist::qr_factorization ( const matrix< T, Allocator > &  a,
matrix< T, Allocator > &  Q,
matrix< T, Allocator > &  R,
matrix_style::style  style = matrix_style::ge 
)

行列のQR分解を行う

\[ {\bf A} = {\bf Q} \; {\bf R} \]

引数
[in]a… 入力行列
[out]Q… 行列Q
[out]R… 行列R
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
template<class T , class Allocator >
const matrix< T, Allocator >& mist::solve ( const matrix< T, Allocator > &  a,
matrix< T, Allocator > &  b,
matrix_style::style  style = matrix_style::ge 
)
inline

行列の連立一次方程式を解く関数

\[ {\bf A}\mbox{\boldmath x} = \mbox{\boldmath b} \]

引数
[in]a… 行列 ${\bf A}$
[in,out]b… ベクトル $\mbox{\boldmath b}$
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
ベクトル $\mbox{\boldmath x}$
template<class T1 , class T2 , class Allocator1 , class Allocator2 >
const matrix< T2, Allocator2 >& mist::svd ( const matrix< T1, Allocator1 > &  a,
matrix< T1, Allocator1 > &  u,
matrix< T2, Allocator2 > &  s,
matrix< T1, Allocator1 > &  vt,
matrix_style::style  style = matrix_style::ge 
)

行列の特異値分解を計算する

\[ {\bf A} = {\bf U}{\bf \Sigma}{\bf V}^T \]

覚え書き
対角行列の成分は,左上から値の大きい順に並ぶ
引数
[in]a… 入力行列 $ {\bf A} $
[out]u… 列直行行列 $ {\bf U} $
[out]s… 対角行列 $ {\bf \Sigma} $
[out]vt… 直行行列の転置 $ {\bf V}^T $
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
対角行列 $ {\bf \Sigma} $

参照元 compute_epipole(), compute_trifocal_tensor(), factorize_essential_matrix(), mist::homography_matrix(), mist::tensor< M, V, A >::hosvd(), mist::inverse(), mist::svd(), triangulation_dlt(), と trifocal_tensor_to_epipoles().

template<class T1 , class T2 , class Allocator1 , class Allocator2 >
const matrix< T2, Allocator2 >& mist::svd ( const matrix< T1, Allocator1 > &  a,
matrix< T2, Allocator2 > &  s,
matrix< T1, Allocator1 > &  vt,
matrix_style::style  style = matrix_style::ge 
)

行列の特異値分解を計算する

\[ {\bf A} = {\bf U}{\bf \Sigma}{\bf V}^T \]

$ {\bf \Sigma} $ の体格成分と $ {\bf V}^T $ のみを計算する

覚え書き
対角行列の成分は,左上から値の大きい順に並ぶ
引数
[in]a… 入力行列 $ {\bf A} $
[out]s… 対角行列 $ {\bf \Sigma} $ の体格成分のみのベクトル
[out]vt… 直行行列の転置 $ {\bf V}^T $
[in]style… 入力行列の形式(デフォルトは一般行列を指定)
戻り値
対角行列 $ {\bf \Sigma} $

参照先 mist::svd().

template<class T , class Allocator >
const matrix< T, Allocator >::value_type mist::trace ( const matrix< T, Allocator > &  a)
inline

トレースの計算(対角成分の和)

\[ tr\left( {\bf A} \right) = \sum^{n}_{i=1}{ a_{ii} } \]

引数
[in]a… 入力行列
戻り値
$tr\left( {\bf A} \right)$

参照先 mist::matrix< T, Allocator >::cols(), と mist::matrix< T, Allocator >::rows().


Generated on Wed Nov 12 2014 19:44:28 for MIST by doxygen 1.8.1.2