home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / LIBMAT.ZIP / MATDEC.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-16  |  2.7 KB  |  90 lines

  1. /**************************************************/
  2. /*    matdec.hpp header for matDec family         */
  3. /**************************************************/
  4.  
  5.  
  6. /**************************************************/
  7. /*            MatClass Source File                */
  8. /*       Copyright of C. R. Birchenhall           */
  9. /*       University of Manchester, UK.            */
  10. /*   MatClass is freeware. This file should be    */
  11. /* made freely available to users of any software */
  12. /* whose creation is wholly or partly dependent   */
  13. /*                on this file.                   */
  14. /**************************************************/
  15.  
  16. #ifndef MATRIX_H
  17. #include "matrix.hpp"
  18. #endif
  19.  
  20. #ifndef MATDEC_H
  21.  
  22. #define MATDEC_H
  23.  
  24. class matDec : public matObject
  25. {
  26.    protected :
  27.  
  28.       enum matDecStatus {
  29.          ASSIGNED    = 1,
  30.          DECOMPOSED  = 2,
  31.          DETERMINED  = 4,
  32.          CONDITION   = 8
  33.       } ;
  34.  
  35.       INDEX      status ;
  36.       matError   error ;
  37.       matrix     m ;
  38.       REAL       tol, det1, det2, condition ;
  39.       charArray  nm ;
  40.  
  41.       INDEX Hager( REAL& est, INDEX iter = 5 ) ;
  42.       void initialValues( void ) ;
  43.       void copyValues( const matDec& md ) ;
  44.  
  45.    public :
  46.  
  47.       matDec( void ) ;
  48.       matDec( const matrix& x ) ;
  49.       matDec( const matDec& md ) ;
  50.       virtual ~matDec( void ) ;
  51.       void operator = ( const matDec& md ) ;
  52.  
  53.       void operator = ( const matrix& x )
  54.          { assign(x) ; }
  55.       matError errorNo( void ) ;
  56.       INDEX ok( char *mName ) ;
  57.       INDEX ok( void ) ;
  58.       char* nameStr( void )  M_CONST ;
  59.       charArray name( char *newName ) ;
  60.       virtual void assign( const matrix& x ) ;
  61.       virtual void capture( matrix& x ) ;
  62.       virtual void clear( void ) ;
  63.       virtual void decompose( void ) ;
  64.       virtual void solve( matrix& b ) ;
  65.       virtual void transSolve( matrix& b ) ;
  66.       virtual void det( REAL& d1, REAL& d2 ) ;
  67.       virtual REAL cond( void ) ;
  68.       virtual void multiSolve( matrix& B ) ;
  69.       virtual void inverse( matrix& inv ) ;
  70.       virtual outFile& info( outFile& f ) M_CONST ;
  71.       outFile& decInfo( outFile& f, const char *decName ) M_CONST ;
  72.       virtual outFile& put( outFile& f ) M_CONST ;
  73.       virtual outFile& print( char* decName, outFile& f ) M_CONST ;
  74.       virtual inFile& get( inFile& f ) ;
  75.       REAL setTol( const REAL r = -1.0 ) ;
  76.  
  77.       void reportDet( outFile& fout = out ) ;
  78.  
  79.       friend outFile& operator << ( outFile& f, matDec& cd )
  80.          { return cd.put(f) ; }
  81.       friend inFile& operator >> ( inFile& f, matDec& cd )
  82.          { return cd.get(f) ; }
  83. } ; // matDec
  84.  
  85. double dfabs( double r ) ;
  86. void dProduct( const matrix& A, REAL& d1, REAL& d2,
  87.            REAL tol, matError& error ) ;
  88.  
  89. #endif
  90.