| 
    JunkBox_Lib++ (for Windows) 1.10.1
    
   | 
 
#include "matrix.h"
Go to the source code of this file.
imatrix add_imatrix(imatrix a, imatrix b)
マトリックスの足し算. 整数マトリックス a, bを足し算して,結果の整数マトリックスを返す.
| a | 足されるマトリックス. | 
| b | 足すマトリックス. | 
Definition at line 594 of file matrix.cpp.
References make_imatrix(), imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.

matrix add_matrix(matrix a, matrix b)
マトリックスの足し算. 実数マトリックス a, bを足し算して,結果の実数マトリックスを返す.
| a | 足されるマトリックス. | 
| b | 足すマトリックス. | 
Definition at line 567 of file matrix.cpp.
References make_matrix(), matrix::mx, matrix::n, matrix::r, and matrix::sz.

void copy_imatrix(imatrix src, imatrix dst)
整数マトリックスのコピー.srcの内容を dstへコピーする.
マトリックス全体のサイズが合わない場合は何もしない.
全体のサイズが合っていればコピーする.
| src | コピー元マトリックス. | 
| dst | コピー先マトリックス. | 
Definition at line 545 of file matrix.cpp.
References imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.
void copy_matrix(matrix src, matrix dst)
マトリックスのコピー.srcの内容を dstへコピーする.
マトリックス全体のサイズが合わない場合は何もしない.
全体のサイズが合っていればコピーする.
| src | コピー元マトリックス. | 
| dst | コピー先マトリックス. | 
Definition at line 523 of file matrix.cpp.
References matrix::mx, matrix::n, matrix::r, and matrix::sz.
matrix decompQR(matrix xx, imatrix col)
2次元行列 xxのQR分解を行い,R行列を返す.
xx = Q・R
| xx | QR分解を行う2次元行列. | 
| col | メモリを確保し,初期化しておく.Qの基底ベクトルが入る. | 
Definition at line 869 of file matrix.cpp.
References free_matrix(), make_matrix(), imatrix::mx, matrix::mx, Mx, matrix::n, matrix::r, imatrix::sz, matrix::sz, and Vt.
Referenced by minimum2().


vector ex_vector(vector a, vector b)
ベクトルの外積. 実数ベクトル a,b の外積ベクトルを計算し,それを返す.
| a | 外積を計算するベクトル. | 
| b | 外積を計算するベクトル. | 
Definition at line 167 of file matrix.cpp.
ivector f2ivector(vector a)
実数ベクトル a から整数ベクトルをつくり出し,それを返す. 各要素は四捨五入される.
| a | 変換する実数ベクトル. | 
Definition at line 125 of file matrix.cpp.
References ivector::n, ivector::x, vector::x, ivector::y, vector::y, ivector::z, and vector::z.
| void free_imatrix | ( | imatrix * | a | ) | 
整数マトリックスのバッファ部を開放する.
| a | 開放するバッファ部を持った整数マトリックスへのポインタ. | 
Definition at line 425 of file matrix.cpp.
References imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.
Referenced by minimum2().

| void free_matrix | ( | matrix * | a | ) | 
マトリックスのバッファ部を開放をする.
| a | 開放するバッファ部を持ったマトリックスへのポインタ. | 
Definition at line 408 of file matrix.cpp.
References matrix::mx, matrix::n, matrix::r, and matrix::sz.
Referenced by decompQR(), and minimum2().

| int * get_imatrix | ( | imatrix | mtx, | 
| ... ) | 
int* get_imatrix(imatrix mtx, ...)
Matrix の要素を返す.次元数に制限はない.インデックスは1から数える(0からではない).
Definition at line 488 of file matrix.cpp.
References imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.
| double * get_matrix | ( | matrix | mtx, | 
| ... ) | 
double* get_matrix(matrix mtx, ...)
Matrix の要素を返す.次元数に制限はない.インデックスは1から数える(0からではない).
Definition at line 449 of file matrix.cpp.
References matrix::mx, matrix::n, matrix::r, and matrix::sz.
vector i2vector(ivector a)
整数ベクトル a から実数ベクトルをつくり出し,それを返す.
| a | 変換する整数ベクトル. | 
Definition at line 145 of file matrix.cpp.
References vector::n, ivector::x, vector::x, ivector::y, vector::y, ivector::z, and vector::z.
matrix invrU_matrix(matrix x)
2次元の上三角行列 xの逆行列を求める.
| x | 操作対象行列(上三角行列). | 
Definition at line 1045 of file matrix.cpp.
References make_matrix(), matrix::mx, Mx, matrix::n, matrix::r, and matrix::sz.
Referenced by minimum2().


| imatrix make_imatrix | ( | int | n, | 
| int * | sz ) | 
imatrix make_imatrix(int n, int* sz)
任意(n)次元の整数マトリックスのバッファ部をつくり出す. 要素自体は 0に初期化される.
| n | マトリックスの次元数. | 
| sz | sz[0]〜sz[n-1]: 各次元の要素数. | 
Definition at line 371 of file matrix.cpp.
References imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.
Referenced by add_imatrix(), minimum2(), mlt_imatrix(), and sub_imatrix().

| imatrix make_imatrix1 | ( | int | n | ) | 
imatrix make_imatrix1(int n)
1次元の整数行列のバッファ部をつくり出す. 要素自体は 0に初期化される.
| n | 1次元行列の大きさ. | 
Definition at line 222 of file matrix.cpp.
References imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.
| imatrix make_imatrix2 | ( | int | n, | 
| int | m ) | 
imatrix make_imatrix2(int n, int m)
2次元の整数行列のバッファ部をつくり出す. 要素自体は 0に初期化される.
| n | 2次元行列の行の数. | 
| m | 2次元行列の列の数. | 
Definition at line 294 of file matrix.cpp.
References imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.
| matrix make_matrix | ( | int | n, | 
| int * | sz ) | 
matrix make_matrix(int n, int* sz)
任意(n)次元の実数マトリックスのバッファ部をつくり出す. 要素自体は 0.0に初期化される.
| n | マトリックスの次元数. | 
| sz | sz[0]〜sz[n-1]: 各次元の要素数. | 
Definition at line 331 of file matrix.cpp.
References matrix::mx, matrix::n, matrix::r, and matrix::sz.
Referenced by add_matrix(), decompQR(), invrU_matrix(), minimum2(), mlt_matrix(), sub_matrix(), and trans_matrix().

| matrix make_matrix1 | ( | int | n | ) | 
matrix make_matrix1(int n)
1次元の実数行列のバッファ部をつくり出す. 要素自体は 0.0に初期化される.
| n | 1次元行列の大きさ. | 
Definition at line 188 of file matrix.cpp.
References matrix::mx, matrix::n, matrix::r, and matrix::sz.
| matrix make_matrix2 | ( | int | n, | 
| int | m ) | 
matrix make_matrix2(int n, int m)
2次元の実数行列のバッファ部をつくり出す. 要素自体は 0.0に初期化される.
| n | 2次元行列の行の数. | 
| m | 2次元行列の列の数. | 
Definition at line 257 of file matrix.cpp.
References matrix::mx, matrix::n, matrix::r, and matrix::sz.
matrix minimum2(matrix y, matrix x)
最小2乗法で方程式の近似解を解き,結果を返す. ただし, x,yは2次元行列のみ.
| y | 連立方程式の結果の行列 (例を見よ) | 
| x | 連立方程式の変数の行列 (例を見よ) | 
Definition at line 967 of file matrix.cpp.
References decompQR(), free_imatrix(), free_matrix(), invrU_matrix(), make_imatrix(), make_matrix(), mlt_matrix(), imatrix::mx, matrix::mx, matrix::n, matrix::r, matrix::sz, and trans_matrix().

imatrix mlt_imatrix(imatrix a, imatrix b)
マトリックスのかけ算. 整数マトリックス a, bをかけ算して,結果の整数マトリックスを返す.
| a | かけられるマトリックス. | 
| b | かけるマトリックス. | 
Definition at line 751 of file matrix.cpp.
References make_imatrix(), imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.

matrix mlt_matrix(matrix a, matrix b)
マトリックスのかけ算. 実数マトリックス a, bをかけ算して,結果の実数マトリックスを返す.
| a | かけられるマトリックス. | 
| b | かけるマトリックス. | 
Definition at line 675 of file matrix.cpp.
References make_matrix(), matrix::mx, matrix::n, matrix::r, and matrix::sz.
Referenced by minimum2().


| void print_imatrix | ( | FILE * | fp, | 
| imatrix | a ) | 
void print_imatrix(FILE* fp, imatrix a)
整数マトリックスの要素を標準出力に書き出す.
| fp | 出力先のファイル記述子 | 
| a | プリントするマトリックス. | 
Definition at line 843 of file matrix.cpp.
References imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.
| void print_matrix | ( | FILE * | fp, | 
| matrix | a ) | 
void print_matrix(FILE* fp, matrix a)
実数マトリックスの要素を標準出力に書き出す.
| fp | 出力先のファイル記述子 | 
| a | プリントするマトリックス. | 
Definition at line 824 of file matrix.cpp.
References matrix::mx, matrix::n, matrix::r, and matrix::sz.
| ivector set_ivector | ( | int | x, | 
| int | y, | ||
| int | z ) | 
ivector set_ivector(int x, int y, int z)
整数ベクトルの作成.x方向成分, y方向成分, z方向成分から整数ベクトルを作り,それを返す.
| x | ベクトルの x成分. | 
| y | ベクトルの y成分. | 
| z | ベクトルの z成分. | 
Definition at line 104 of file matrix.cpp.
References ivector::n, ivector::x, ivector::y, and ivector::z.
| vector set_vector | ( | double | x, | 
| double | y, | ||
| double | z ) | 
vector set_vector(double x, double y, double z)
ベクトルの作成.x方向成分, y方向成分, z方向成分から実数ベクトルを作り,それを返す.
| x | ベクトルの x成分. | 
| y | ベクトルの y成分. | 
| z | ベクトルの z成分. | 
Definition at line 82 of file matrix.cpp.
imatrix sub_imatrix(imatrix a, imatrix b)
マトリックスの引き算. 整数マトリックス a, bを引き算して,結果の整数マトリックスを返す.
| a | 引かれるマトリックス. | 
| b | 引くマトリックス. | 
Definition at line 648 of file matrix.cpp.
References make_imatrix(), imatrix::mx, imatrix::n, imatrix::r, and imatrix::sz.

matrix sub_matrix(matrix a, matrix b)
マトリックスの引き算. 実数マトリックス a, bを引き算して,結果の実数マトリックスを返す.
| a | 引かれるマトリックス. | 
| b | 引くマトリックス. | 
Definition at line 621 of file matrix.cpp.
References make_matrix(), matrix::mx, matrix::n, matrix::r, and matrix::sz.

matrix trans_matrix(matrix a)
2次元行列 aの転置行列を返す.
| a | 操作対象行列. | 
Definition at line 1013 of file matrix.cpp.
References make_matrix(), matrix::mx, matrix::n, matrix::r, and matrix::sz.
Referenced by minimum2().


vector unit_ivector(ivector a)
整数ベクトル aの単位ベクトルを返す.返されるベクトルは実数ベクトル.
| a | 対象整数ベクトル. | 
Definition at line 49 of file matrix.cpp.
References EPS, vector::n, ivector::x, vector::x, Xabs, ivector::y, vector::y, ivector::z, and vector::z.
vector unit_vector(vector a)
ベクトル aの単位ベクトルを返す.
| a | 対象ベクトル. | 
Definition at line 18 of file matrix.cpp.
References EPS, vector::n, vector::x, Xabs, vector::y, and vector::z.