#include <GMatrix.h>
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) |
GMatrix::GMatrix | ( | ) |
デフォルトコンストラクタ
GMatrix.cpp の 14 行で定義されています。
GMathLib::GMatrix::GMatrix | ( | int | mrow, | |
int | mcolumn, | |||
double * | p_data = 0 | |||
) | [inline] |
コンストラクタ 行列サイズを指定し、行列データをセットする. または, その行列サイズ分のメモリを確保する. 第 3 引数に double 型のベクトル配列のポインタを与えることで, 行列データをセットする. その際, 行列の形は第 1, 2 引数で与えた行列サイズによって決まる. もし第 3 引数の double 型ポインタが 0 ならば,指定された行列サイズに合わせてメモリを自動確保する. この自動確保されたメモリは, オブジェクトが破棄されるときに自動解放される. 前者の方法でセットされた行列データのメモリは,オブジェクトが破棄されるときに自動的には解放されない ので注意が必要である.
mrow | 行列の行数 | |
mcolumn 行列の列数 | ||
p_data 行列要素を表す | 1 次元配列データ |
参照先 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*)と同じ動作をする.
obj_name | オブジェクトの名前 | |
mrow | 行列の行数 | |
mcolumn 行列の列数 | ||
p_data 行列要素を表す | 1 次元配列データ |
参照先 allocate_initialize(), GMathLib::GObject::Object_Name(), と p_data.
GMatrix::~GMatrix | ( | ) | [virtual] |
デストラクタ コンストラクタで自動確保した行列データのメモリはオブジェクトが廃棄されるときに自動解放される. 一方で,外部でメモリを確保され, 行列オブジェクトにセットされた行列データについては, その行列データのメモリ解放の責任は持たない.
GMatrix.cpp の 21 行で定義されています。
参照先 internal_new_flag, と p_data.
GMatrix::GMatrix | ( | const GMatrix & | obj | ) |
int GMatrix::Copy | ( | const GMatrix & | obj | ) | [virtual] |
GMatrix オブジェクトが保持している行列データを, 他の行列オブジェクトへ完全にコピーするための関数. コピーしたい行列オブジェクトの行列サイズが, コピー元の行列オブジェクトと同じ場合はメモリが, 新たに再確保されることはない. 一方, 異なる場合には必要な行列サイズに合わせてメモリを再確保する. その際に不要になったメモリは, そのメモリが GMatrix クラス内で自動確保されたものならば自動的に解放するが, そうでない場合は自動的には解放されない.
obj | 行列要素をコピーしたいもとの行列オブジェクト |
GMatrix.cpp の 70 行で定義されています。
参照先 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 | 埋めたい値 |
参照先 column, p_data, row, と Set().
参照元 GMathLib::GCubic_Spline_Interpolation::DoInterpolation(), と GMathLib::GMatrix_Util::GLU_Composition::LU_Composition().
2項演算関数(加法) 演算に関係する行列オブジェクトは、行列演算において適切な行列サイズに設定されていなければならない.
a | 演算したい行列オブジェクト1 | |
b | 演算したい行列オブジェクト2 |
GMatrix.cpp の 123 行で定義されています。
参照先 GMathLib::GObject::Class_Name(), column, Column(), Get(), GMathLib::IO::GError_Output::Puts(), row, Row(), と Set().
参照元 operator+().
2項演算関数(減法) 演算に関係する行列オブジェクトは、行列演算において適切な行列サイズに設定されていなければならない.
a | 演算したい行列オブジェクト1 | |
b | 演算したい行列オブジェクト2 |
GMatrix.cpp の 150 行で定義されています。
参照先 GMathLib::GObject::Class_Name(), column, Column(), Get(), GMathLib::IO::GError_Output::Puts(), row, Row(), と Set().
参照元 operator-().
2項演算関数(行列の積) 演算に関係する行列オブジェクトは、行列演算において適切な行列サイズに設定されていなければならない.
a | 演算したい行列オブジェクト1 | |
b | 演算したい行列オブジェクト2 |
GMatrix.cpp の 175 行で定義されています。
参照先 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] |
int GMathLib::GMatrix::Row | ( | ) | const [inline] |
行列の行数を返す関数
参照先 row.
参照元 Add(), GMathLib::GLinear_Homo_Eq::check_matrix_size(), GMathLib::GCubic_Spline_Interpolation::DoInterpolation(), GMathLib::GVector::Dot_Product(), GMathLib::GVector::Get(), GMathLib::GMatrix_Util::Identity_Matrix(), GMathLib::GMatrix_Util::GLU_Composition::lu_composition(), GMathLib::GMatrix_Util::GLU_Composition::LU_Composition(), Multi(), operator*(), operator+(), operator-(), operator=(), GMathLib::Util::GMatrixList_Manager::Register_Matrix(), GMathLib::GLinear_Homo_Eq::S_LU_Partial_Pivot(), GMathLib::GVector::Set(), GMathLib::GVector::Shape(), GMathLib::GVector::Size(), Sub(), と ToString().
int GMathLib::GMatrix::Column | ( | ) | const [inline] |
行列の列数を返す関数
参照先 column.
参照元 Add(), GMathLib::GLinear_Homo_Eq::check_matrix_size(), GMathLib::GCubic_Spline_Interpolation::DoInterpolation(), GMathLib::GVector::Dot_Product(), GMathLib::GMatrix_Util::Identity_Matrix(), GMathLib::GMatrix_Util::GLU_Composition::LU_Composition(), Multi(), operator*(), operator+(), operator-(), operator=(), GMathLib::Util::GMatrixList_Manager::Register_Matrix(), GMathLib::GVector::Set(), GMathLib::GVector::Size(), Sub(), と ToString().
double* GMathLib::GMatrix::GetData | ( | ) | [inline] |
double GMathLib::GMatrix::GetElement | ( | int | row_no, | |
int | column_no | |||
) | const [inline] |
double GMathLib::GMatrix::Get | ( | int | row_no, | |
int | column_no | |||
) | const [inline] |
GetElement と同じ動作をする関数.
row_no | 取得したい行列要素の行数 | |
column_no | 取得したい行列要素の列数 |
参照先 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 | 設定する行列要素の値 |
参照元 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 | 設定する行列要素の値 |
参照先 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を再定義しています。
参照先 Column(), Row(), と GMathLib::GObject::ToString().
参照元 Print().
void GMathLib::GMatrix::Print | ( | ) | [inline] |
行列要素をコンソールに表示するための関数 標準出力を通して行列要素を成形して表示する.強制的な折り返しは行わない.
参照元 main().
void GMatrix::Print | ( | int | turn_down, | |
bool | scientific_format = false | |||
) |
行列要素をコンソールに表示するための関数 標準出力を通して行列要素を成形して表示する. 強制的に折り返したい列のインデックスや数値の表示法を指定できる.強制的に折り返したくな場合は -1 を指定する.
turn_down | 強制的に折り返しを行いたい列のインデックス 数値を科学表記法で表示するかのフラグ.デフォルトはfalse |
GMatrix.cpp の 294 行で定義されています。
参照先 GMathLib::GObject::Class_Name(), column, Get(), row, ToString(), と GMathLib::IO::GStd_Output::Write().
void GMathLib::GMatrix::Vectorize | ( | ) | [inline] |
int GMatrix::Reshape | ( | int | new_row, | |
int | new_column | |||
) | [virtual] |
行列の全要素数は変えずに, 行列の行数と列数を変えるための関数 行列のサイズが変わる場合にはエラーを返して,行列の形は変更されない.
new_row | 設定したい行列の行数 | |
new_column | 設定したい行列の列数 |
GMatrix.cpp の 106 行で定義されています。
参照先 GMathLib::GObject::Class_Name(), column, GMathLib::IO::GError_Output::Puts(), と row.
double& GMathLib::GMatrix::operator() | ( | int | i, | |
int | j | |||
) | [inline] |
代入演算子の定義
GMatrix.cpp の 208 行で定義されています。
参照先 GMathLib::GObject::Class_Name(), Column(), Copy(), GMathLib::IO::GError_Output::Puts(), と Row().
+ 演算子(行列の和)の定義
行列の和の演算子の定義
GMatrix.cpp の 227 行で定義されています。
参照先 Add(), GMathLib::GObject::Class_Name(), Column(), GMathLib::IO::GError_Output::Puts(), と Row().
行列の差の演算子の定義
GMatrix.cpp の 249 行で定義されています。
参照先 GMathLib::GObject::Class_Name(), Column(), GMathLib::IO::GError_Output::Puts(), Row(), と Sub().
* 演算子(行列同士の積)の定義
行列同士の積の演算子の定義
GMatrix.cpp の 272 行で定義されています。
参照先 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.cpp の 48 行で定義されています。
参照先 GMathLib::GObject::Class_Name(), column, internal_new_flag, p_data, と row.
参照元 GMatrix().
double* GMathLib::GMatrix::p_data [protected] |
行列要素を保持するdouble配列のポインタ
参照元 allocate_initialize(), Copy(), Fill(), GetData(), GetElement(), GMatrix(), GMathLib::GVector::operator()(), operator()(), SetElement(), と ~GMatrix().
int GMathLib::GMatrix::row [private] |
行列の行サイズを保持する変数
参照元 Add(), allocate_initialize(), Copy(), Fill(), GMatrix(), Print(), Reshape(), Row(), Scalar_Product(), Sub(), と Vectorize().
int GMathLib::GMatrix::column [private] |
行列の列サイズを保持する変数
参照元 Add(), allocate_initialize(), Column(), Copy(), Fill(), GetElement(), GMatrix(), operator()(), Print(), Reshape(), Scalar_Product(), SetElement(), Sub(), と Vectorize().
bool GMathLib::GMatrix::internal_new_flag [private] |
クラス内で行列データ用のメモリを確保したかのフラグ
参照元 allocate_initialize(), Copy(), GMatrix(), と ~GMatrix().