Go to the documentation of this file.00001 #ifndef __NEW_MAT_GENERAL_MATRIX_H__
00002 #define __NEW_MAT_GENERAL_MATRIX_H__
00003
00005 class GeneralMatrix : public BaseMatrix
00006 {
00007 virtual GeneralMatrix* Image() const;
00008 protected:
00009 int tag_val;
00010 int nrows_val, ncols_val;
00011 int storage;
00012 Real* store;
00013 GeneralMatrix();
00014 GeneralMatrix(ArrayLengthSpecifier);
00015 void Add(GeneralMatrix*, Real);
00016 void Add(Real);
00017 void NegAdd(GeneralMatrix*, Real);
00018 void NegAdd(Real);
00019 void Multiply(GeneralMatrix*, Real);
00020 void Multiply(Real);
00021 void Negate(GeneralMatrix*);
00022 void Negate();
00023 void ReverseElements();
00024 void ReverseElements(GeneralMatrix*);
00025 void operator=(Real);
00026 Real* GetStore();
00027 GeneralMatrix* BorrowStore(GeneralMatrix*, MatrixType);
00028
00029 void GetMatrix(const GeneralMatrix*);
00030 void Eq(const BaseMatrix&, MatrixType);
00031 void Eq(const GeneralMatrix&);
00032 void Eq(const BaseMatrix&, MatrixType, bool);
00033 void Eq2(const BaseMatrix&, MatrixType);
00034 int search(const BaseMatrix*) const;
00035 virtual GeneralMatrix* Transpose(TransposedMatrix*, MatrixType);
00036 void CheckConversion(const BaseMatrix&);
00037 void resize(int, int, int);
00038 virtual short SimpleAddOK(const GeneralMatrix*) { return 0; }
00039
00040 virtual void MiniCleanUp()
00041 { store = 0; storage = 0; nrows_val = 0; ncols_val = 0; tag_val = -1;}
00042
00043 void PlusEqual(const GeneralMatrix& gm);
00044 void MinusEqual(const GeneralMatrix& gm);
00045 void PlusEqual(Real f);
00046 void MinusEqual(Real f);
00047 void swap(GeneralMatrix& gm);
00048 public:
00049 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00050 virtual MatrixType type() const = 0;
00051 MatrixType Type() const { return type(); }
00052 int Nrows() const { return nrows_val; }
00053 int Ncols() const { return ncols_val; }
00054 int Storage() const { return storage; }
00055 Real* Store() const { return store; }
00056
00057 int nrows() const { return nrows_val; }
00058 int ncols() const { return ncols_val; }
00059 int size() const { return storage; }
00060 Real* data() { return store; }
00061 const Real* data() const { return store; }
00062 const Real* const_data() const { return store; }
00063 virtual ~GeneralMatrix();
00064 void tDelete();
00065 bool reuse();
00066 void protect() { tag_val=-1; }
00067 void Protect() { tag_val=-1; }
00068 int tag() const { return tag_val; }
00069 int Tag() const { return tag_val; }
00070 bool is_zero() const;
00071 bool IsZero() const { return is_zero(); }
00072 void Release() { tag_val=1; }
00073 void Release(int t) { tag_val=t; }
00074 void ReleaseAndDelete() { tag_val=0; }
00075 void release() { tag_val=1; }
00076 void release(int t) { tag_val=t; }
00077 void release_and_delete() { tag_val=0; }
00078 void operator<<(const double*);
00079 void operator<<(const float*);
00080 void operator<<(const int*);
00081 void operator<<(const BaseMatrix& X)
00082 { Eq(X,this->type(),true); }
00083 void inject(const GeneralMatrix&);
00084 void Inject(const GeneralMatrix& GM) { inject(GM); }
00085 void operator+=(const BaseMatrix&);
00086 void operator-=(const BaseMatrix&);
00087 void operator*=(const BaseMatrix&);
00088 void operator|=(const BaseMatrix&);
00089 void operator&=(const BaseMatrix&);
00090 void operator+=(Real);
00091 void operator-=(Real r) { operator+=(-r); }
00092 void operator*=(Real);
00093 void operator/=(Real r) { operator*=(1.0/r); }
00094 virtual GeneralMatrix* MakeSolver();
00095 virtual void Solver(MatrixColX&, const MatrixColX&) {}
00096 virtual void GetRow(MatrixRowCol&) = 0;
00097 virtual void RestoreRow(MatrixRowCol&) {}
00098 virtual void NextRow(MatrixRowCol&);
00099 virtual void GetCol(MatrixRowCol&) = 0;
00100 virtual void GetCol(MatrixColX&) = 0;
00101 virtual void RestoreCol(MatrixRowCol&) {}
00102 virtual void RestoreCol(MatrixColX&) {}
00103 virtual void NextCol(MatrixRowCol&);
00104 virtual void NextCol(MatrixColX&);
00105 Real sum_square() const;
00106 Real sum_absolute_value() const;
00107 Real sum() const;
00108 Real maximum_absolute_value1(int& i) const;
00109 Real minimum_absolute_value1(int& i) const;
00110 Real maximum1(int& i) const;
00111 Real minimum1(int& i) const;
00112 Real maximum_absolute_value() const;
00113 Real maximum_absolute_value2(int& i, int& j) const;
00114 Real minimum_absolute_value() const;
00115 Real minimum_absolute_value2(int& i, int& j) const;
00116 Real maximum() const;
00117 Real maximum2(int& i, int& j) const;
00118 Real minimum() const;
00119 Real minimum2(int& i, int& j) const;
00120 LogAndSign log_determinant() const;
00121 virtual bool IsEqual(const GeneralMatrix&) const;
00122
00123 void CheckStore() const;
00124 virtual void SetParameters(const GeneralMatrix*) {}
00125
00126 operator ReturnMatrix() const;
00127 ReturnMatrix for_return() const;
00128 ReturnMatrix ForReturn() const;
00129
00130
00131
00132 virtual void resize(const GeneralMatrix& A);
00133 virtual void ReSize(const GeneralMatrix& A) { resize(A); }
00134 MatrixInput operator<<(double);
00135 MatrixInput operator<<(float);
00136 MatrixInput operator<<(int f);
00137
00138 void cleanup();
00139
00140 friend class Matrix;
00141 friend class SquareMatrix;
00142 friend class nricMatrix;
00143 friend class SymmetricMatrix;
00144 friend class UpperTriangularMatrix;
00145 friend class LowerTriangularMatrix;
00146 friend class DiagonalMatrix;
00147 friend class CroutMatrix;
00148 friend class RowVector;
00149 friend class ColumnVector;
00150 friend class BandMatrix;
00151 friend class LowerBandMatrix;
00152 friend class UpperBandMatrix;
00153 friend class SymmetricBandMatrix;
00154 friend class BaseMatrix;
00155 friend class AddedMatrix;
00156 friend class MultipliedMatrix;
00157 friend class SubtractedMatrix;
00158 friend class SPMatrix;
00159 friend class KPMatrix;
00160 friend class ConcatenatedMatrix;
00161 friend class StackedMatrix;
00162 friend class SolvedMatrix;
00163 friend class ShiftedMatrix;
00164 friend class NegShiftedMatrix;
00165 friend class ScaledMatrix;
00166 friend class TransposedMatrix;
00167 friend class ReversedMatrix;
00168 friend class NegatedMatrix;
00169 friend class InvertedMatrix;
00170 friend class RowedMatrix;
00171 friend class ColedMatrix;
00172 friend class DiagedMatrix;
00173 friend class MatedMatrix;
00174 friend class GetSubMatrix;
00175 friend class ReturnMatrix;
00176 friend class LinearEquationSolver;
00177 friend class GenericMatrix;
00178 NEW_DELETE(GeneralMatrix)
00179 };
00180
00181 #endif
00182