Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

RPolynome.hpp

00001 #ifndef __RPolynome_H__
00002 #define __RPolynome_H__
00003 
00004 
00005 
00024 #include <stdio.h>
00025 #include <math.h>
00026 
00027 class RPolynome
00028 {
00029 public:
00030 
00031 int             n,nmax;
00032 double* a;
00033 
00034 public:
00035         
00036 RPolynome(int nmax=6);
00037 RPolynome(double a0, int nmax=1);
00038 RPolynome(double a0, double a1, int nmax=2);
00039 RPolynome(double a0, double a1, double a2, int nmax=3);
00040 RPolynome(double* ax, int n, int nmax=6);
00041 RPolynome(const RPolynome& x);
00042 RPolynome& operator=(const RPolynome& x);
00043 
00044 ~RPolynome(){delete[] a;}
00045 
00046 inline int getOrder(){return n-1;}
00047 inline int numberOfCoeff() const{return n;} 
00048 inline int maxCoeff() const{return nmax;}
00049 
00050 inline double getA(int i) const{return a[i];}
00051 inline void setA(int i, double ax){n= n > i ? n : i; a[i]=ax;}
00052 inline void addA(double ax){if( n<nmax ){a[n]=ax; n++;} }
00053 
00054 void clear();
00055 void setP0(double a0);
00056 void setP1(double a0, double a1);
00057 void setP2(double a0, double a1, double a2);
00058 
00059 void setX_A(double x_a);  // (x-a)
00060 
00061 void multiplyX_A(double x_a);  // (x-a)
00062 
00063 double getValue(double x);
00064 
00065 // real operations
00066 void operator+=(double value){ n= n<1 ? n : 1;  a[0] += value; }
00067 void operator-=(double value){ n= n<1 ? n : 1; a[0] -= value; }
00068 void operator*=(double value);
00069 void operator/=(double value);
00070 
00071 // complex operations
00072 void operator+=(const RPolynome& p);
00073 void operator-=(const RPolynome& p);
00074 void operator*=(const RPolynome& p);
00075 
00076 // friends
00077 friend RPolynome operator+(const RPolynome& v, double a);                       // v<op>a
00078 friend RPolynome operator+(double a, const RPolynome& v);                       // a<op>v
00079 friend RPolynome operator-(const RPolynome& v, double a);                       // v<op>a
00080 friend RPolynome operator-(double a, const RPolynome& v);                       // a<op>v
00081 friend RPolynome operator*( const RPolynome& v, double a);                      // v<op>a
00082 friend RPolynome operator*(double a,const  RPolynome& v);                       // a<op>v
00083 friend RPolynome operator/(const  RPolynome& v, double a);                      // v<op>a
00084 
00085 friend RPolynome operator+(const RPolynome& v1, const RPolynome& v2);                   // v1<op>v2
00086 friend RPolynome operator-(const RPolynome& v1, const RPolynome& v2);                   // v1<op>v2
00087 friend RPolynome operator*(const RPolynome& v1, const RPolynome& v2);                   // v1<op>v2
00088 
00089         
00090 void output();
00091 void output(FILE* file);
00092 };
00093 
00094 #endif
00095 
00096          
SourceForge.net Logo
Restoreinpaint sourceforge project `C++/Java Image Processing, Restoration, Inpainting Project'.

Bernard De Cuyper: Open Project Leader: Concept, design and development.
Bernard De Cuyper & Eddy Fraiha 2002, 2003. Bernard De Cuyper 2004. Open and free, for friendly usage only.
Modifications on Belgium ground of this piece of artistic work, by governement institutions or companies, must be notified to Bernard De Cuyper.
bern_bdc@hotmail.com