GeneralMatrix.h
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         // declarable matrix types
00006 {
00007    virtual GeneralMatrix* Image() const;        // copy of matrix
00008 protected:
00009    int tag_val;                                 // shows whether can reuse
00010    int nrows_val, ncols_val;                    // dimensions
00011    int storage;                                 // total store required
00012    Real* store;                                 // point to store (0=not set)
00013    GeneralMatrix();                             // initialise with no store
00014    GeneralMatrix(ArrayLengthSpecifier);         // constructor getting store
00015    void Add(GeneralMatrix*, Real);              // sum of GM and Real
00016    void Add(Real);                              // add Real to this
00017    void NegAdd(GeneralMatrix*, Real);           // Real - GM
00018    void NegAdd(Real);                           // this = this - Real
00019    void Multiply(GeneralMatrix*, Real);         // product of GM and Real
00020    void Multiply(Real);                         // multiply this by Real
00021    void Negate(GeneralMatrix*);                 // change sign
00022    void Negate();                               // change sign
00023    void ReverseElements();                      // internal reverse of elements
00024    void ReverseElements(GeneralMatrix*);        // reverse order of elements
00025    void operator=(Real);                        // set matrix to constant
00026    Real* GetStore();                            // get store or copy
00027    GeneralMatrix* BorrowStore(GeneralMatrix*, MatrixType);
00028                                                 // temporarily access store
00029    void GetMatrix(const GeneralMatrix*);        // used by = and initialise
00030    void Eq(const BaseMatrix&, MatrixType);      // used by =
00031    void Eq(const GeneralMatrix&);               // version with no conversion
00032    void Eq(const BaseMatrix&, MatrixType, bool);// used by <<
00033    void Eq2(const BaseMatrix&, MatrixType);     // cut down version of Eq
00034    int search(const BaseMatrix*) const;
00035    virtual GeneralMatrix* Transpose(TransposedMatrix*, MatrixType);
00036    void CheckConversion(const BaseMatrix&);     // check conversion OK
00037    void resize(int, int, int);                  // change dimensions
00038    virtual short SimpleAddOK(const GeneralMatrix*) { return 0; }
00039              // see bandmat.cpp for explanation
00040    virtual void MiniCleanUp()
00041       { store = 0; storage = 0; nrows_val = 0; ncols_val = 0; tag_val = -1;}
00042              // CleanUp when the data array has already been deleted
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);                // swap values
00048 public:
00049    GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp);
00050    virtual MatrixType type() const = 0;         // type of a matrix
00051    MatrixType Type() const { return type(); }
00052    int Nrows() const { return nrows_val; }      // get dimensions
00053    int Ncols() const { return ncols_val; }
00054    int Storage() const { return storage; }
00055    Real* Store() const { return store; }
00056    // updated names
00057    int nrows() const { return nrows_val; }      // get dimensions
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();                    // delete store if set
00064    void tDelete();                              // delete if tag_val permits
00065    bool reuse();                                // true if tag_val allows reuse
00066    void protect() { tag_val=-1; }               // cannot delete or reuse
00067    void Protect() { tag_val=-1; }               // cannot delete or reuse
00068    int tag() const { return tag_val; }
00069    int Tag() const { return tag_val; }
00070    bool is_zero() const;                        // test matrix has all zeros
00071    bool IsZero() const { return is_zero(); }    // test matrix has all zeros
00072    void Release() { tag_val=1; }                // del store after next use
00073    void Release(int t) { tag_val=t; }           // del store after t accesses
00074    void ReleaseAndDelete() { tag_val=0; }       // delete matrix after use
00075    void release() { tag_val=1; }                // del store after next use
00076    void release(int t) { tag_val=t; }           // del store after t accesses
00077    void release_and_delete() { tag_val=0; }     // delete matrix after use
00078    void operator<<(const double*);              // assignment from an array
00079    void operator<<(const float*);               // assignment from an array
00080    void operator<<(const int*);                 // assignment from an array
00081    void operator<<(const BaseMatrix& X)
00082       { Eq(X,this->type(),true); }              // = without checking type
00083    void inject(const GeneralMatrix&);           // copy stored els only
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();         // for solving
00095    virtual void Solver(MatrixColX&, const MatrixColX&) {}
00096    virtual void GetRow(MatrixRowCol&) = 0;      // Get matrix row
00097    virtual void RestoreRow(MatrixRowCol&) {}    // Restore matrix row
00098    virtual void NextRow(MatrixRowCol&);         // Go to next row
00099    virtual void GetCol(MatrixRowCol&) = 0;      // Get matrix col
00100    virtual void GetCol(MatrixColX&) = 0;        // Get matrix col
00101    virtual void RestoreCol(MatrixRowCol&) {}    // Restore matrix col
00102    virtual void RestoreCol(MatrixColX&) {}      // Restore matrix col
00103    virtual void NextCol(MatrixRowCol&);         // Go to next col
00104    virtual void NextCol(MatrixColX&);           // Go to next col
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                                                 // same type, same values
00123    void CheckStore() const;                     // check store is non-zero
00124    virtual void SetParameters(const GeneralMatrix*) {}
00125                                                 // set parameters in GetMatrix
00126    operator ReturnMatrix() const;               // for building a ReturnMatrix
00127    ReturnMatrix for_return() const;
00128    ReturnMatrix ForReturn() const;
00129    //virtual bool SameStorageType(const GeneralMatrix& A) const;
00130    //virtual void ReSizeForAdd(const GeneralMatrix& A, const GeneralMatrix& B);
00131    //virtual void ReSizeForSP(const GeneralMatrix& A, const GeneralMatrix& B);
00132    virtual void resize(const GeneralMatrix& A);
00133    virtual void ReSize(const GeneralMatrix& A) { resize(A); }
00134    MatrixInput operator<<(double);                // for loading a list
00135    MatrixInput operator<<(float);                // for loading a list
00136    MatrixInput operator<<(int f);
00137 //   ReturnMatrix Reverse() const;                // reverse order of elements
00138    void cleanup();                              // to clear store
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 


lo
Author(s): U. Klank
autogenerated on Mon Oct 6 2014 10:44:13