Go to the documentation of this file.00001 #ifndef __NEW_MAT_TEMPORARY_H__
00002 #define __NEW_MAT_TEMPORARY_H__
00003
00004 #include "myexcept.h"
00005
00006
00007
00010 class MultipliedMatrix : public BaseMatrix
00011 {
00012 protected:
00013
00014
00015 union { const BaseMatrix* bm1; GeneralMatrix* gm1; };
00016
00017 union { const BaseMatrix* bm2; GeneralMatrix* gm2; };
00018 MultipliedMatrix(const BaseMatrix* bm1x, const BaseMatrix* bm2x)
00019 : bm1(bm1x),bm2(bm2x) {}
00020 int search(const BaseMatrix*) const;
00021 friend class BaseMatrix;
00022 friend class GeneralMatrix;
00023 friend class GenericMatrix;
00024 public:
00025 MultipliedMatrix() : BaseMatrix(), bm1(0), bm2(0) {}
00026 ~MultipliedMatrix() {}
00027 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00028 MatrixBandWidth bandwidth() const;
00029 NEW_DELETE(MultipliedMatrix)
00030 };
00031
00034 class AddedMatrix : public MultipliedMatrix
00035 {
00036 protected:
00037 AddedMatrix(const BaseMatrix* bm1x, const BaseMatrix* bm2x)
00038 : MultipliedMatrix(bm1x,bm2x) {}
00039
00040 friend class BaseMatrix;
00041 friend class GeneralMatrix;
00042 friend class GenericMatrix;
00043 public:
00044 AddedMatrix() : MultipliedMatrix() {}
00045 ~AddedMatrix() {}
00046 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00047 MatrixBandWidth bandwidth() const;
00048 NEW_DELETE(AddedMatrix)
00049 };
00050
00053 class SPMatrix : public AddedMatrix
00054 {
00055 protected:
00056 SPMatrix(const BaseMatrix* bm1x, const BaseMatrix* bm2x)
00057 : AddedMatrix(bm1x,bm2x) {}
00058
00059 friend class BaseMatrix;
00060 friend class GeneralMatrix;
00061 friend class GenericMatrix;
00062 public:
00063 SPMatrix() : AddedMatrix() {}
00064 ~SPMatrix() {}
00065 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00066 MatrixBandWidth bandwidth() const;
00067
00068 friend SPMatrix SP(const BaseMatrix&, const BaseMatrix&);
00069
00070 NEW_DELETE(SPMatrix)
00071 };
00072
00075 class KPMatrix : public MultipliedMatrix
00076 {
00077 protected:
00078 KPMatrix(const BaseMatrix* bm1x, const BaseMatrix* bm2x)
00079 : MultipliedMatrix(bm1x,bm2x) {}
00080
00081 friend class BaseMatrix;
00082 friend class GeneralMatrix;
00083 friend class GenericMatrix;
00084 public:
00085 KPMatrix() : MultipliedMatrix() {}
00086 ~KPMatrix() {}
00087 MatrixBandWidth bandwidth() const;
00088 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00089 friend KPMatrix KP(const BaseMatrix&, const BaseMatrix&);
00090 NEW_DELETE(KPMatrix)
00091 };
00092
00095 class ConcatenatedMatrix : public MultipliedMatrix
00096 {
00097 protected:
00098 ConcatenatedMatrix(const BaseMatrix* bm1x, const BaseMatrix* bm2x)
00099 : MultipliedMatrix(bm1x,bm2x) {}
00100
00101 friend class BaseMatrix;
00102 friend class GeneralMatrix;
00103 friend class GenericMatrix;
00104 public:
00105 ConcatenatedMatrix() : MultipliedMatrix() {}
00106 ~ConcatenatedMatrix() {}
00107 MatrixBandWidth bandwidth() const;
00108 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00109 NEW_DELETE(ConcatenatedMatrix)
00110 };
00111
00114 class StackedMatrix : public ConcatenatedMatrix
00115 {
00116 protected:
00117 StackedMatrix(const BaseMatrix* bm1x, const BaseMatrix* bm2x)
00118 : ConcatenatedMatrix(bm1x,bm2x) {}
00119
00120 friend class BaseMatrix;
00121 friend class GeneralMatrix;
00122 friend class GenericMatrix;
00123 public:
00124 StackedMatrix() :ConcatenatedMatrix() {}
00125 ~StackedMatrix() {}
00126 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00127 NEW_DELETE(StackedMatrix)
00128 };
00129
00132 class SolvedMatrix : public MultipliedMatrix
00133 {
00134 SolvedMatrix(const BaseMatrix* bm1x, const BaseMatrix* bm2x)
00135 : MultipliedMatrix(bm1x,bm2x) {}
00136 friend class BaseMatrix;
00137 friend class InvertedMatrix;
00138 public:
00139 SolvedMatrix() : MultipliedMatrix() {}
00140 ~SolvedMatrix() {}
00141 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00142 MatrixBandWidth bandwidth() const;
00143 NEW_DELETE(SolvedMatrix)
00144 };
00145
00148 class SubtractedMatrix : public AddedMatrix
00149 {
00150 SubtractedMatrix(const BaseMatrix* bm1x, const BaseMatrix* bm2x)
00151 : AddedMatrix(bm1x,bm2x) {}
00152 friend class BaseMatrix;
00153 friend class GeneralMatrix;
00154 friend class GenericMatrix;
00155 public:
00156 SubtractedMatrix() : AddedMatrix() {}
00157 ~SubtractedMatrix() {}
00158 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00159 NEW_DELETE(SubtractedMatrix)
00160 };
00161
00164 class ShiftedMatrix : public BaseMatrix
00165 {
00166 protected:
00167 union { const BaseMatrix* bm; GeneralMatrix* gm; };
00168 Real f;
00169 ShiftedMatrix(const BaseMatrix* bmx, Real fx) : bm(bmx),f(fx) {}
00170 int search(const BaseMatrix*) const;
00171 friend class BaseMatrix;
00172 friend class GeneralMatrix;
00173 friend class GenericMatrix;
00174 public:
00175 ShiftedMatrix() : BaseMatrix(), bm(0) {}
00176 ~ShiftedMatrix() {}
00177 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00178 friend ShiftedMatrix operator+(Real f, const BaseMatrix& BM);
00179 NEW_DELETE(ShiftedMatrix)
00180 };
00181
00184 class NegShiftedMatrix : public ShiftedMatrix
00185 {
00186 protected:
00187 NegShiftedMatrix(Real fx, const BaseMatrix* bmx) : ShiftedMatrix(bmx,fx) {}
00188 friend class BaseMatrix;
00189 friend class GeneralMatrix;
00190 friend class GenericMatrix;
00191 public:
00192 NegShiftedMatrix() : ShiftedMatrix() {}
00193 ~NegShiftedMatrix() {}
00194 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00195 friend NegShiftedMatrix operator-(Real, const BaseMatrix&);
00196 NEW_DELETE(NegShiftedMatrix)
00197 };
00198
00201 class ScaledMatrix : public ShiftedMatrix
00202 {
00203 ScaledMatrix(const BaseMatrix* bmx, Real fx) : ShiftedMatrix(bmx,fx) {}
00204 friend class BaseMatrix;
00205 friend class GeneralMatrix;
00206 friend class GenericMatrix;
00207 public:
00208 ScaledMatrix() : ShiftedMatrix() {}
00209 ~ScaledMatrix() {}
00210 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00211 MatrixBandWidth bandwidth() const;
00212 friend ScaledMatrix operator*(Real f, const BaseMatrix& BM);
00213 NEW_DELETE(ScaledMatrix)
00214 };
00215
00218 class NegatedMatrix : public BaseMatrix
00219 {
00220 protected:
00221 union { const BaseMatrix* bm; GeneralMatrix* gm; };
00222 NegatedMatrix(const BaseMatrix* bmx) : bm(bmx) {}
00223 int search(const BaseMatrix*) const;
00224 private:
00225 friend class BaseMatrix;
00226 public:
00227 NegatedMatrix() : BaseMatrix(), bm(0) {}
00228 ~NegatedMatrix() {}
00229 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00230 MatrixBandWidth bandwidth() const;
00231 NEW_DELETE(NegatedMatrix)
00232 };
00233
00236 class TransposedMatrix : public NegatedMatrix
00237 {
00238 TransposedMatrix(const BaseMatrix* bmx) : NegatedMatrix(bmx) {}
00239 friend class BaseMatrix;
00240 public:
00241 TransposedMatrix() : NegatedMatrix() {}
00242 ~TransposedMatrix() {}
00243 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00244 MatrixBandWidth bandwidth() const;
00245 NEW_DELETE(TransposedMatrix)
00246 };
00247
00250 class ReversedMatrix : public NegatedMatrix
00251 {
00252 ReversedMatrix(const BaseMatrix* bmx) : NegatedMatrix(bmx) {}
00253 friend class BaseMatrix;
00254 public:
00255 ReversedMatrix() : NegatedMatrix() {}
00256 ~ReversedMatrix() {}
00257 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00258 NEW_DELETE(ReversedMatrix)
00259 };
00260
00263 class InvertedMatrix : public NegatedMatrix
00264 {
00265 InvertedMatrix(const BaseMatrix* bmx) : NegatedMatrix(bmx) {}
00266 public:
00267 InvertedMatrix() : NegatedMatrix() {}
00268 ~InvertedMatrix() {}
00269 SolvedMatrix operator*(const BaseMatrix&) const;
00270 ScaledMatrix operator*(Real t) const { return BaseMatrix::operator*(t); }
00271 friend class BaseMatrix;
00272 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00273 MatrixBandWidth bandwidth() const;
00274 NEW_DELETE(InvertedMatrix)
00275 };
00276
00279 class RowedMatrix : public NegatedMatrix
00280 {
00281 RowedMatrix(const BaseMatrix* bmx) : NegatedMatrix(bmx) {}
00282 friend class BaseMatrix;
00283 public:
00284 RowedMatrix() : NegatedMatrix() {}
00285 ~RowedMatrix() {}
00286 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00287 MatrixBandWidth bandwidth() const;
00288 NEW_DELETE(RowedMatrix)
00289 };
00290
00293 class ColedMatrix : public NegatedMatrix
00294 {
00295 ColedMatrix(const BaseMatrix* bmx) : NegatedMatrix(bmx) {}
00296 friend class BaseMatrix;
00297 public:
00298 ColedMatrix() : NegatedMatrix() {}
00299 ~ColedMatrix() {}
00300 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00301 MatrixBandWidth bandwidth() const;
00302 NEW_DELETE(ColedMatrix)
00303 };
00304
00307 class DiagedMatrix : public NegatedMatrix
00308 {
00309 DiagedMatrix(const BaseMatrix* bmx) : NegatedMatrix(bmx) {}
00310 friend class BaseMatrix;
00311 public:
00312 DiagedMatrix() : NegatedMatrix() {}
00313 ~DiagedMatrix() {}
00314 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00315 MatrixBandWidth bandwidth() const;
00316 NEW_DELETE(DiagedMatrix)
00317 };
00318
00321 class MatedMatrix : public NegatedMatrix
00322 {
00323 int nr, nc;
00324 MatedMatrix(const BaseMatrix* bmx, int nrx, int ncx)
00325 : NegatedMatrix(bmx), nr(nrx), nc(ncx) {}
00326 friend class BaseMatrix;
00327 public:
00328 MatedMatrix() : NegatedMatrix() {}
00329 ~MatedMatrix() {}
00330 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00331 MatrixBandWidth bandwidth() const;
00332 NEW_DELETE(MatedMatrix)
00333 };
00334
00337 class ReturnMatrix : public BaseMatrix
00338 {
00339 GeneralMatrix* gm;
00340 int search(const BaseMatrix*) const;
00341 public:
00342 ReturnMatrix() : BaseMatrix(), gm(0) {}
00343 ~ReturnMatrix() {}
00344 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00345 friend class BaseMatrix;
00346 ReturnMatrix(const ReturnMatrix& tm) : BaseMatrix(), gm(tm.gm) {}
00347 ReturnMatrix(const GeneralMatrix* gmx) : gm((GeneralMatrix*&)gmx) {}
00348
00349 MatrixBandWidth bandwidth() const;
00350 NEW_DELETE(ReturnMatrix)
00351 };
00352
00353
00354 #endif
00355