FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
GenMatrix.h
説明を見る。
1 /****************************************************************************
2  *
3  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
4  *
5  * Redistribution and use in source and binary forms,
6  * with or without modification, are permitted provided that the
7  * following conditions are met:
8  *
9  * - Redistributions of source code must retain the above
10  * copyright notice, this list of conditions and the
11  * following disclaimer.
12  *
13  * - Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the
15  * following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * - Neither the name of the copyright holders nor the names
19  * of its contributors may be used to endorse or promote
20  * products derived from this software without specific
21  * prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  ****************************************************************************/
37 /****************************************************************************
38  *
39  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
40  *
41  * 本ソフトウェアおよびソースコードのライセンスは、基本的に
42  * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。
43  *
44  * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、
45  * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。
46  *
47  * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、
48  * および下記免責条項を含めること。
49  *
50  * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の
51  * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を
52  * 含めること。
53  *
54  * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の
55  * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または
56  * コントリビューターの名前を使用してはならない。
57  *
58  * 本ソフトウェアは、著作権者およびコントリビューターによって「現
59  * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、
60  * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ
61  * に限定されない、いかなる保証もないものとします。著作権者もコン
62  * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを
63  * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その
64  * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可
65  * 能性を知らされていたとしても、本ソフトウェアの使用によって発生
66  * した(代替品または代用サービスの調達、使用の喪失、データの喪失、
67  * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、
68  * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に
69  * ついて、一切責任を負わないものとします。
70  *
71  ****************************************************************************/
72 #ifndef __FK_GEN_MATRIX_HEADER__
73 #define __FK_GEN_MATRIX_HEADER__
74 
75 #include <FK/GenVector.h>
76 #include <FK/Matrix.h>
77 
79 
88 class fk_GenMatrix {
89 
90  friend class fk_GenVector;
91 
92  private:
93  std::vector<double> m;
94  std::vector<double>::size_type deg;
95 
96  void MultVec(fk_GenVector &, const fk_GenVector &) const;
97  void MakeIdentMatrix(void);
98  void MakeZeroMatrix(void);
99  bool MatrixInverse(void);
100 
101  public:
102 
104 
108  fk_GenMatrix(int deg = 0);
109 
111  fk_GenMatrix(const fk_GenMatrix &);
112 
114 
115 
117 
125  fk_GenMatrix operator !(void) const;
127 
129 
130 
132 
145  bool operator ==(const fk_GenMatrix &) const;
146 
148 
161  bool operator !=(const fk_GenMatrix &) const;
162 
164 
166 
169 
171 
184 
186 
199 
201 
220 
222 
223 
230  void init(bool initFlg = true);
231 
232  // 次数設定 (直前の値は保持)
234 
239  void setDeg(int deg);
240 
242 
246  int getDeg(void) const;
247 
249 
255  void set(int row, int col, double value);
256 
258 
264  double get(int row, int col) const;
265 
267 
274  bool inverse(void);
275 
277 
280  void negate(void);
281 
282 
284 
290  bool isRegular(void) const;
291 
293 
300  bool isSingular(void) const;
301 
302 #ifndef FK_DOXYGEN_USER_PROCESS
303 
304  void Print(std::string = "") const;
305 
306 #endif
307 
309 
310  friend fk_GenVector operator *(const fk_GenMatrix &, const fk_GenVector &);
311  friend fk_GenMatrix operator +(const fk_GenMatrix &, const fk_GenMatrix &);
312  friend fk_GenMatrix operator -(const fk_GenMatrix &, const fk_GenMatrix &);
313  friend fk_GenMatrix operator *(const fk_GenMatrix &, const fk_GenMatrix &);
315 };
316 
318 
319 // fk_GenVector との積演算
321 
334 
336 
349 
350 // 差演算子
352 
365 
367 
382 
383 
384 #endif // !__FK_GEN_MATRIX_HEADER__
int getDeg(void) const
次元数取得関数
void init(bool initFlg=true)
初期化関数
friend fk_GenMatrix operator-(const fk_GenMatrix &, const fk_GenMatrix &)
行列差二項演算子
fk_GenMatrix operator-(const fk_GenMatrix &, const fk_GenMatrix &)
行列差二項演算子
fk_GenMatrix(int deg=0)
コンストラクタ
bool inverse(void)
逆行列化関数
bool operator!=(const fk_GenMatrix &) const
異値比較演算子
fk_GenVector operator*(const fk_GenMatrix &, const fk_GenVector &)
ベクトル変換二項演算子
任意次元正方行列を管理するクラス
Definition: GenMatrix.h:88
bool isSingular(void) const
特異判定関数
friend fk_GenVector operator*(const fk_GenMatrix &, const fk_GenVector &)
ベクトル変換二項演算子
fk_GenMatrix operator+(const fk_GenMatrix &, const fk_GenMatrix &)
行列和二項演算子
fk_GenMatrix & operator=(const fk_GenMatrix &)
単純代入演算子
fk_GenMatrix operator!(void) const
逆行列取得演算子
void set(int row, int col, double value)
成分値設定関数
fk_GenMatrix & operator+=(const fk_GenMatrix &)
行列和代入演算子
fk_GenMatrix & operator*=(const fk_GenMatrix &)
行列積代入演算子
bool isRegular(void) const
正則判定関数
任意次元ベクトルを管理するクラス
Definition: GenVector.h:90
bool operator==(const fk_GenMatrix &) const
同値比較演算子
void negate(void)
転置化関数
void setDeg(int deg)
次元数設定関数
friend fk_GenMatrix operator+(const fk_GenMatrix &, const fk_GenMatrix &)
行列和二項演算子
fk_GenMatrix & operator-=(const fk_GenMatrix &)
行列差代入演算子