home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / microcrn / issue_40.arc / DAIMS.ARC / CHEB_VEC.HXX < prev    next >
Text File  |  1988-02-10  |  2KB  |  65 lines

  1. /* 
  2. -*++ class Cheb_vector: Vector in Chebyshev space
  3. ** 
  4. ** (*++ history: 
  5. **     17 Dec 87    Bruce Eckel    Creation date
  6. ** ++*)
  7. ** 
  8. ** (*++ detailed: 
  9. ** ++*)
  10. */
  11.  
  12. class phys_vector;  /* forward reference */
  13.  
  14. class Cheb_vector : public ColVec {
  15.   public:
  16.     Cheb_vector() : () {;}
  17.     Cheb_vector(int n) : (n) {;}
  18.     Cheb_vector(int n, double v) : (n,v) {;}
  19.     Cheb_vector(Cheb_vector & x) { *this = x;}
  20.     phys_vector & physical();    /* transform to physical space */
  21.     Cheb_vector & prime();    /* the derivative */
  22.     /* stuff used inside the functions: (for clarity) */
  23.         /* Chebyshev polynomial: */
  24.     double T(int n, double x) { return cos(n * acos(x)); } 
  25.         /* increments over physical space: */
  26.     double dx();
  27.         /* Value of indep variable in physical space: */
  28.     double X(int i) { return (i-1)*dx() -1;} 
  29.         /* Oceanography "C" function:*/
  30.     double C(int n) { return n==0? 2 : n > 0 ? 1 : -1; }
  31.     Cheb_vector & operator=(Cheb_vector & rval) 
  32.     {//cout << "before assignment\n";
  33.      //cout << (matrix)rval; 
  34.      (matrix &)(*this) = (matrix &)rval; 
  35.      //cout << "after assignment " << (*this); cout.flush();
  36.     return (*this); }
  37.     Cheb_vector & operator+(Cheb_vector & arg);
  38.     Cheb_vector & operator-(Cheb_vector & arg);
  39.     Cheb_vector & operator*(double & arg);
  40.     friend Cheb_vector & operator*(double & arg1, Cheb_vector & arg2)
  41.     { return arg2 * arg1; }  /* for commutativity */
  42. };
  43.  
  44. /* 
  45. -*++ class phys_vector: Vector in physical space
  46. ** 
  47. ** (*++ history: 
  48. **     17 Dec 87    Bruce Eckel    Creation date
  49. ** ++*)
  50. ** 
  51. ** (*++ detailed: 
  52. ** ++*)
  53. */
  54.  
  55. class phys_vector : public ColVec {
  56.   public:
  57.     phys_vector() : () {;}
  58.     phys_vector(int n) : (n) {;}
  59.     phys_vector(int n, double v) : (n,v) {;}
  60.     phys_vector(phys_vector & x) : (x) {;}
  61.     Cheb_vector & Chebyshev();    /* transform to Chebyshev space */
  62.     phys_vector & operator=(phys_vector & rval) 
  63.     { (matrix &)(*this) = (matrix &)rval; return (*this); }
  64. };
  65.