クラス GMathLib::GMatrix

#include <GMatrix.h>

GMathLib::GMatrixに対する継承グラフ

Inheritance graph
[凡例]
GMathLib::GMatrixのコラボレーション図

Collaboration graph
[凡例]

すべてのメンバ一覧

Public メソッド

 GMatrix ()
 GMatrix (int mrow, int mcolumn, double *p_data=0)
 GMatrix (std::string obj_name, int mrow, int mcolumn, double *p_data=0)
virtual ~GMatrix ()
 GMatrix (const GMatrix &obj)
virtual int Copy (const GMatrix &obj)
virtual int Fill (double a)
int Add (const GMatrix &a, const GMatrix &b)
int Sub (const GMatrix &a, const GMatrix &b)
int Multi (const GMatrix &a, const GMatrix &b)
void Scalar_Product (double sc)
int Row () const
int Column () const
double * GetData ()
double GetElement (int row_no, int column_no) const
double Get (int row_no, int column_no) const
void SetElement (int row_no, int column_no, double value)
void Set (int row_no, int column_no, double value)
virtual std::string ToString ()
void Print ()
void Print (int turn_down, bool scientific_format=false)
void Vectorize ()
virtual int Reshape (int new_row, int new_column)
double & operator() (int i, int j)
GMatrix operator= (const GMatrix &a)
GMatrix operator+ (const GMatrix &a)
GMatrix operator- (const GMatrix &a)
GMatrix operator* (const GMatrix &a)

Protected メソッド

void allocate_initialize (int mrow, int mcolumn, double *p_data=0)

Protected 変数

double * p_data

Private 変数

int row
int column
bool internal_new_flag

フレンド

GMatrix operator* (double k, const GMatrix &a)
GMatrix operator* (const GMatrix &a, double k)


説明

行列データを表現し, 管理するクラス GMathLib で用いる行列データを表現するためのクラス. 行列データの管理, 行列の基本的な演算などを提供する.

GMatrix.h18 行で定義されています。


コンストラクタとデストラクタ

GMatrix::GMatrix (  ) 

デフォルトコンストラクタ

参照:
GMatrix(int, int, double*)

GMatrix.cpp14 行で定義されています。

参照先 GMathLib::GObject::Class_Name().

GMathLib::GMatrix::GMatrix ( int  mrow,
int  mcolumn,
double *  p_data = 0 
) [inline]

コンストラクタ 行列サイズを指定し、行列データをセットする. または, その行列サイズ分のメモリを確保する. 第 3 引数に double 型のベクトル配列のポインタを与えることで, 行列データをセットする. その際, 行列の形は第 1, 2 引数で与えた行列サイズによって決まる. もし第 3 引数の double 型ポインタが 0 ならば,指定された行列サイズに合わせてメモリを自動確保する. この自動確保されたメモリは, オブジェクトが破棄されるときに自動解放される. 前者の方法でセットされた行列データのメモリは,オブジェクトが破棄されるときに自動的には解放されない ので注意が必要である.

参照:
GMatrix()

~GMatrix()

引数:
mrow 行列の行数
mcolumn 行列の列数 
p_data 行列要素を表す 1 次元配列データ

GMatrix.h43 行で定義されています。

参照先 allocate_initialize(), と p_data.

GMathLib::GMatrix::GMatrix ( std::string  obj_name,
int  mrow,
int  mcolumn,
double *  p_data = 0 
) [inline]

コンストラクタ オブジェクトの名前, 行列サイズを指定し, 行列データをセットする. またはその行列サイズ分のメモリを確保する. 第 1 引数でオブジェクトの名前を指定する他は, GMatrix(int, int, double*)と同じ動作をする.

参照:
GMatrix(int, int, double*)

~GMatrix()

引数:
obj_name オブジェクトの名前
mrow 行列の行数
mcolumn 行列の列数 
p_data 行列要素を表す 1 次元配列データ

GMatrix.h60 行で定義されています。

参照先 allocate_initialize(), GMathLib::GObject::Object_Name(), と p_data.

GMatrix::~GMatrix (  )  [virtual]

デストラクタ コンストラクタで自動確保した行列データのメモリはオブジェクトが廃棄されるときに自動解放される. 一方で,外部でメモリを確保され, 行列オブジェクトにセットされた行列データについては, その行列データのメモリ解放の責任は持たない.

参照:
GMatrix(int, int, double*)

GMatrix.cpp21 行で定義されています。

参照先 internal_new_flag, と p_data.

GMatrix::GMatrix ( const GMatrix obj  ) 

コピースコントラクタ

GMatrix.cpp29 行で定義されています。

参照先 column, internal_new_flag, p_data, と row.


関数

int GMatrix::Copy ( const GMatrix obj  )  [virtual]

GMatrix オブジェクトが保持している行列データを, 他の行列オブジェクトへ完全にコピーするための関数. コピーしたい行列オブジェクトの行列サイズが, コピー元の行列オブジェクトと同じ場合はメモリが, 新たに再確保されることはない. 一方, 異なる場合には必要な行列サイズに合わせてメモリを再確保する. その際に不要になったメモリは, そのメモリが GMatrix クラス内で自動確保されたものならば自動的に解放するが, そうでない場合は自動的には解放されない.

参照:
GMatrix(const GMatrix&)
引数:
obj 行列要素をコピーしたいもとの行列オブジェクト
戻り値:
成功すれば0,失敗すれば1を返す

GMatrix.cpp70 行で定義されています。

参照先 column, internal_new_flag, p_data, と row.

参照元 GMathLib::GVector::Copy(), GMathLib::GMatrix_Util::GLU_Composition::LU_Composition(), main(), operator=(), GMathLib::GCIP_Method_Calc2D::Prepair(), GMathLib::GCIP_Method_Calc2D::Proceed_TimeStep(), GMathLib::Util::GMatrixList_Manager::Register_Matrix(), と GMathLib::GCIP_Method_Calc2D::Update_Velocity_Field().

virtual int GMathLib::GMatrix::Fill ( double  a  )  [inline, virtual]

行列要素をすべて同じ値で埋めるための関数.

引数:
a 埋めたい値
戻り値:
成功すれば0,失敗すれば1を返す

GMatrix.h101 行で定義されています。

参照先 column, p_data, row, と Set().

参照元 GMathLib::GCubic_Spline_Interpolation::DoInterpolation(), と GMathLib::GMatrix_Util::GLU_Composition::LU_Composition().

int GMatrix::Add ( const GMatrix a,
const GMatrix b 
)

2項演算関数(加法) 演算に関係する行列オブジェクトは、行列演算において適切な行列サイズに設定されていなければならない.

引数:
a 演算したい行列オブジェクト1
b 演算したい行列オブジェクト2
戻り値:
成功すれば0,失敗すれば1を返す

GMatrix.cpp123 行で定義されています。

参照先 GMathLib::GObject::Class_Name(), column, Column(), Get(), GMathLib::IO::GError_Output::Puts(), row, Row(), と Set().

参照元 operator+().

int GMatrix::Sub ( const GMatrix a,
const GMatrix b 
)

2項演算関数(減法) 演算に関係する行列オブジェクトは、行列演算において適切な行列サイズに設定されていなければならない.

引数:
a 演算したい行列オブジェクト1
b 演算したい行列オブジェクト2
戻り値:
成功すれば0,失敗すれば1を返す

GMatrix.cpp150 行で定義されています。

参照先 GMathLib::GObject::Class_Name(), column, Column(), Get(), GMathLib::IO::GError_Output::Puts(), row, Row(), と Set().

参照元 operator-().

int GMatrix::Multi ( const GMatrix a,
const GMatrix b 
)

2項演算関数(行列の積) 演算に関係する行列オブジェクトは、行列演算において適切な行列サイズに設定されていなければならない.

引数:
a 演算したい行列オブジェクト1
b 演算したい行列オブジェクト2
戻り値:
成功すれば0,失敗すれば1を返す

GMatrix.cpp175 行で定義されています。

参照先 GMathLib::GObject::Class_Name(), Column(), Get(), GMathLib::IO::GError_Output::Puts(), Row(), と Set().

参照元 operator*(), と GMathLib::GLinear_Homo_Eq::S_LU_Partial_Pivot().

void GMathLib::GMatrix::Scalar_Product ( double  sc  )  [inline]

関数を呼び出した行列オブジェクトに対し,引数の値でスカラー積を取る関数

引数:
sc スカラー積をとる時に使うスカラー値

GMatrix.h150 行で定義されています。

参照先 column, Get(), row, と Set().

int GMathLib::GMatrix::Row (  )  const [inline]

int GMathLib::GMatrix::Column (  )  const [inline]

double* GMathLib::GMatrix::GetData (  )  [inline]

行列オブジェクトが保持している行列データの配列ポインタを取得する関数

戻り値:
行列要素を保持している double 型の配列のポインタ

GMatrix.h177 行で定義されています。

参照先 p_data.

参照元 GMathLib::GCIP_Method_Calc1D::Prepair().

double GMathLib::GMatrix::GetElement ( int  row_no,
int  column_no 
) const [inline]

行列要素の値を取得するための関数

引数:
row_no 取得したい行列要素の行数
column_no 取得したい行列要素の列数
戻り値:
指定された行列要素の値

GMatrix.h186 行で定義されています。

参照先 column, と p_data.

参照元 GMathLib::GVector::Get(), と Get().

double GMathLib::GMatrix::Get ( int  row_no,
int  column_no 
) const [inline]

GetElement と同じ動作をする関数.

引数:
row_no 取得したい行列要素の行数
column_no 取得したい行列要素の列数
戻り値:
指定された行列要素の値

GMatrix.h196 行で定義されています。

参照先 GetElement().

参照元 Add(), GMathLib::GCIP_Method_Calc2D::Get_PhysData(), GMathLib::GMatrix_Util::GLU_Composition::LU_Composition(), Multi(), Print(), Scalar_Product(), と Sub().

void GMathLib::GMatrix::SetElement ( int  row_no,
int  column_no,
double  value 
) [inline]

行列要素の値を設定するための関数

引数:
row_no 設定したい行列要素の行のインデックス
column_no 設定したい行列要素の列のインデックス
value 設定する行列要素の値

GMatrix.h207 行で定義されています。

参照先 column, と p_data.

参照元 GMathLib::GMatrix_Util::Identity_Matrix(), GMathLib::GVector::Set(), と Set().

void GMathLib::GMatrix::Set ( int  row_no,
int  column_no,
double  value 
) [inline]

SetElement と同じ動作をする関数.

引数:
row_no 設定したい行列要素の行のインデックス
column_no 設定したい行列要素の列のインデックス
value 設定する行列要素の値

GMatrix.h218 行で定義されています。

参照先 SetElement().

参照元 Add(), GMathLib::GCIP_Method_Calc2D::calc_advect_phase_2D(), GMathLib::GCubic_Spline_Interpolation::DoInterpolation(), Fill(), GMathLib::GMatrix_Util::GLU_Composition::LU_Composition(), Multi(), GMathLib::GCIP_Method_Calc2D::Prepair(), Scalar_Product(), と Sub().

virtual std::string GMathLib::GMatrix::ToString (  )  [inline, virtual]

クラスのインスタンスの説明テキスト文字列を生成する関数.

GMathLib::GObjectを再定義しています。

GMatrix.h222 行で定義されています。

参照先 Column(), Row(), と GMathLib::GObject::ToString().

参照元 Print().

void GMathLib::GMatrix::Print (  )  [inline]

行列要素をコンソールに表示するための関数 標準出力を通して行列要素を成形して表示する.強制的な折り返しは行わない.

参照:
Print(int, bool)

GMatrix.h243 行で定義されています。

参照元 main().

void GMatrix::Print ( int  turn_down,
bool  scientific_format = false 
)

行列要素をコンソールに表示するための関数 標準出力を通して行列要素を成形して表示する. 強制的に折り返したい列のインデックスや数値の表示法を指定できる.強制的に折り返したくな場合は -1 を指定する.

引数:
turn_down 強制的に折り返しを行いたい列のインデックス 数値を科学表記法で表示するかのフラグ.デフォルトはfalse
行列データをコンソールに出力する関数

GMatrix.cpp294 行で定義されています。

参照先 GMathLib::GObject::Class_Name(), column, Get(), row, ToString(), と GMathLib::IO::GStd_Output::Write().

void GMathLib::GMatrix::Vectorize (  )  [inline]

行列オブジェクトを(列)ベクトル化する関数 実際のところ行列データ自体に影響を与えない.単に列数が,1として取り扱われるようになるだけである.

GMatrix.h262 行で定義されています。

参照先 column, と row.

int GMatrix::Reshape ( int  new_row,
int  new_column 
) [virtual]

行列の全要素数は変えずに, 行列の行数と列数を変えるための関数 行列のサイズが変わる場合にはエラーを返して,行列の形は変更されない.

引数:
new_row 設定したい行列の行数
new_column 設定したい行列の列数
戻り値:
成功すれば0,失敗すれば1を返す

GMatrix.cpp106 行で定義されています。

参照先 GMathLib::GObject::Class_Name(), column, GMathLib::IO::GError_Output::Puts(), と row.

参照元 GMathLib::GVector::GVector().

double& GMathLib::GMatrix::operator() ( int  i,
int  j 
) [inline]

添え字演算子の定義

引数:
i 行列の行インデックス
j 行列の列インデックス
戻り値:
行列の(i, j)成分に対応する double 型の参照

GMatrix.h282 行で定義されています。

参照先 column, と p_data.

GMatrix GMatrix::operator= ( const GMatrix a  ) 

代入演算子の定義

GMatrix.cpp208 行で定義されています。

参照先 GMathLib::GObject::Class_Name(), Column(), Copy(), GMathLib::IO::GError_Output::Puts(), と Row().

GMatrix GMatrix::operator+ ( const GMatrix a  ) 

+ 演算子(行列の和)の定義

行列の和の演算子の定義

GMatrix.cpp227 行で定義されています。

参照先 Add(), GMathLib::GObject::Class_Name(), Column(), GMathLib::IO::GError_Output::Puts(), と Row().

GMatrix GMatrix::operator- ( const GMatrix a  ) 

  • 演算子(行列の差)の定義

行列の差の演算子の定義

GMatrix.cpp249 行で定義されています。

参照先 GMathLib::GObject::Class_Name(), Column(), GMathLib::IO::GError_Output::Puts(), Row(), と Sub().

GMatrix GMatrix::operator* ( const GMatrix a  ) 

* 演算子(行列同士の積)の定義

行列同士の積の演算子の定義

GMatrix.cpp272 行で定義されています。

参照先 GMathLib::GObject::Class_Name(), Column(), Multi(), GMathLib::IO::GError_Output::Puts(), と Row().

void GMatrix::allocate_initialize ( int  mrow,
int  mcolumn,
double *  p_data = 0 
) [protected]

コンストラクタから呼び出される行列オブジェクトの領域確保と初期化を行う関数.

引数:
mrow 行列の行数
mcolumn 行列の列数 
p_data 行列要素を表す 1 次元配列データ

GMatrix.cpp48 行で定義されています。

参照先 GMathLib::GObject::Class_Name(), column, internal_new_flag, p_data, と row.

参照元 GMatrix().


フレンドと関連する関数

GMatrix operator* ( double  k,
const GMatrix a 
) [friend]

* 演算子(行列とスカラーの積)の定義

GMatrix.h309 行で定義されています。

GMatrix operator* ( const GMatrix a,
double  k 
) [friend]

* 演算子(行列とスカラーの積)の定義

GMatrix.h321 行で定義されています。


変数

double* GMathLib::GMatrix::p_data [protected]

行列要素を保持するdouble配列のポインタ

GMatrix.h335 行で定義されています。

参照元 allocate_initialize(), Copy(), Fill(), GetData(), GetElement(), GMatrix(), GMathLib::GVector::operator()(), operator()(), SetElement(), と ~GMatrix().

int GMathLib::GMatrix::row [private]

行列の行サイズを保持する変数

GMatrix.h339 行で定義されています。

参照元 Add(), allocate_initialize(), Copy(), Fill(), GMatrix(), Print(), Reshape(), Row(), Scalar_Product(), Sub(), と Vectorize().

行列の列サイズを保持する変数

GMatrix.h340 行で定義されています。

参照元 Add(), allocate_initialize(), Column(), Copy(), Fill(), GetElement(), GMatrix(), operator()(), Print(), Reshape(), Scalar_Product(), SetElement(), Sub(), と Vectorize().

クラス内で行列データ用のメモリを確保したかのフラグ

GMatrix.h341 行で定義されています。

参照元 allocate_initialize(), Copy(), GMatrix(), と ~GMatrix().


このクラスの説明は次のファイルから生成されました:

GMathLibに対してMon Oct 11 17:14:29 2010に生成されました。  doxygen 1.5.6