home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11.lha / ccs-lib / include / complex.h next >
Encoding:
C/C++ Source or Header  |  1991-06-04  |  897 b   |  44 lines

  1. /*
  2.     COMPLEX . H
  3. */
  4.  
  5. #ifndef    FType
  6. #define    FType    float
  7. #endif
  8.  
  9. #ifndef    COMPLEX_H
  10. #define    COMPLEX_H
  11.  
  12. #define pi    3.1415926535897932384626434
  13.  
  14. typedef struct {
  15.     FType    re, im;
  16.     } COMPLEX;
  17.  
  18. typedef struct {
  19.     double    re, im;
  20.     } DBCOMPLEX;
  21.  
  22. #define        c_re(c)        ((c).re)
  23. #define        c_im(c)        ((c).im)
  24.  
  25. /*
  26.  * C_conj substitutes c by its complex conjugate.
  27.  */
  28. #define c_conj(c)        { c_im (c) = -c_im (c); }
  29.  
  30. #define    c_realdiv(c, real)    { c_re (c) /= (real); c_im (c) /= (real); }
  31.  
  32. extern DBCOMPLEX *DBW_factors, *DBcmpx_in, *DBcmpx_out;
  33. extern COMPLEX *W_factors, *cmpx_in, *cmpx_out;
  34. extern unsigned DBNfactors, Nfactors;
  35.  
  36. /*
  37.  * W gives the (already computed) Wn ^ k (= e ^ (2pi * i * k / n)).
  38.  * Notice that the powerseries of Wn has period Nfactors.
  39.  */
  40. #define    DBW(n, k)    (DBW_factors [((k) * (DBNfactors / (n))) % DBNfactors])
  41. #define    W(n, k)        (W_factors [((k) * (Nfactors / (n))) % Nfactors])
  42.  
  43. #endif    COMPLEX_H
  44.