fast_polynom.h

Go to the documentation of this file.
00001 
00002 #pragma once
00003 
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 
00008 
00009 #include <fstream>
00010 #include <iostream>
00011 #include <assert.h>
00012 
00013 #include "polynomdefs.h"
00014 
00023 using namespace std;
00024 
00025 
00027 
00029 
00043 template <class defs,class TNum>
00044 class fast_polynomXY  
00045 {
00046 private:
00047         short   maxDegree;
00048         const short     maxDegreePlusOne;
00049 
00050         string  name;
00051 
00052 public:
00053         typedef TNum    CoefficientType;
00054         typedef defs    TDefs;
00055 
00056         TNum * const    koeff; 
00057 
00060                 fast_polynomXY();
00061                 fast_polynomXY(short _degree);
00062                 fast_polynomXY(short _degree, short epsPrecision);
00063                 
00064                 fast_polynomXY(std::string _name,short _degree);
00065                 fast_polynomXY(const fast_polynomXY & fpx);
00066                 virtual ~fast_polynomXY();
00072                 inline short            getMaxDegree() const;
00073                 inline short            getDegree() const;
00074                 inline string                   getName() const {       return name;    };
00075                 inline unsigned short   getSize() const { return defs::getSize() ;};
00076                 
00082                 // kein set möglich, nur Kompatibilität? rename to redim(int degree)
00083                 inline void     setDegree(int degree) const;
00084                 inline void     setCoeff(const short x_exp,const short y_exp, const TNum value);
00085                 inline void     setCoeffFromRef(const short x_exp,const short y_exp, const TNum& value);
00086                 inline void     clear(short _degree);
00087                 inline void     clear();
00093                 inline TNum             getCoeff(const short x_exp, const short y_exp) const;
00094         
00095                 inline TNum const       getCoeffConst(const short x_exp, const short y_exp) const;
00096         
00097                 inline const TNum&      getCoeffConstRef(const short  x_exp, const short y_exp) const;
00098         
00099                 inline TNum&            getCoeffRef(const short x_exp, const short y_exp);
00100 
00101                 inline TNum const *     getCoeffConstAddr(const short x_exp, const short y_exp) const;
00102                 inline TNum *           getCoeffAddr(const short x_exp, const short y_exp);
00107                 inline fast_polynomXY & operator=(const fast_polynomXY & fpx);
00108                 inline bool operator==(const fast_polynomXY & fpx) const;
00112                 void    OutputPureCoefficients(ostream &datei, int maxDegree, bool mitKomma) const;
00113 
00114                 void    outputMatrix(std::ostream& os) const;
00115 
00116                 void    outputMatrix() const { outputMatrix(std::cerr); } ;
00117                                 
00118                 void    output(std::ostream& os) const;
00119                 void    output() const          {       output(std::cerr);      } ;
00120                         
00121                 
00126                 #ifdef SAFE
00127                         inline void testbounds(const short x_exp,const short y_exp) const;
00128                 #endif
00129 
00130 };
00131 
00132 
00133 
00134 
00135 
00142 template <class TNum>
00143 class fast_polynomx
00144 {
00145         
00146         private:
00147                 const int       maxDegree;
00148 
00149                 const int       size;
00150 
00151                 TNum *          koeff;  
00152         public:
00153 
00154         typedef TNum    CoefficientType;
00155 
00159                 fast_polynomx(const int gr);
00160                 inline fast_polynomx(const fast_polynomx& fpx);
00161 
00162                 ~fast_polynomx();
00163                 
00169                 #ifdef SAFE
00170                         inline void     testbounds(const int x_exp) const;
00171                 #endif
00172 
00176                 #ifdef DEBUG
00177                         void    output(std::ostream& os) const;
00178                         void    output() {output(std::cerr);};
00179                 
00180                 #endif
00181 
00185                 inline fast_polynomx& operator=(const fast_polynomx& fpx);
00191                 inline TNum             getCoeff(const int x_exp)  const;
00192         
00193                 inline  TNum&           getCoeffRef(const int x_exp)  ;
00194 
00195                 inline const TNum&      getCoeffConstRef(const int x_exp)  const;
00196         
00197                 inline  TNum const      getCoeffConst(const int x_exp)  const;
00198         
00199                 inline void             setCoeff(const int x_exp, const TNum& value);
00204                 inline const int getDegree() const ;
00205 
00210                 inline void     clear(int _degree);
00211 
00213                 inline void     clear();
00214 
00217         };
00218 
00219 
00220 template <class defs,class TNum>
00221 
00222 std::ostream &  operator<<(std::ostream & out, const fast_polynomXY<defs,TNum>& z)  
00223 {       
00224         z.outputMatrix(out);
00225         return out;
00226 }
00227         #include "fast_polynom.cpp"
00228 
Generated on Tue Nov 23 13:10:51 2010 for centerfocus by  doxygen 1.6.3