home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12458 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  1.8 KB

  1. Path: sparky!uunet!cs.utexas.edu!usc!elroy.jpl.nasa.gov!ames!agate!overload.lbl.gov!lll-winken!sundance!moonshine!jac
  2. From: jac@moonshine.llnl.gov (James A. Crotinger)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Que: Double-Precision Complex Arrays
  5. Message-ID: <jac.714099380@moonshine>
  6. Date: 18 Aug 92 00:56:20 GMT
  7. References: <92230.141240K3006E7@ALIJKU11.BITNET>
  8. Sender: news@sundance.llnl.gov (News Administrator)
  9. Organization: Magnetic Fusion Energy - LLNL
  10. Lines: 34
  11.  
  12. K3006E7@ALIJKU11.BITNET writes: 
  13.  
  14. > How does one declare a complex array?
  15. >   static complex array_name[2][2];
  16. > doesn't work, for example.
  17.  
  18.   I think the problem is that the AT&T complex class doesn't 
  19. have a complex::complex() constructor. Rather, I think it has
  20. complex::complex(float re=0.0, float im=0.0), and in some older
  21. implementations, this latter constructor could not be used in
  22. the construction of arrays. Although it is a hack, I think you
  23. can fix the problem by editing <complex.h> and adding an inline
  24. complex::complex() constructor which simply initializes the 
  25. members to zero.
  26.  
  27.   BTW, a better solution is to write a ComplexMatrix class (or
  28. Matrix<complex> if you have templates). C "Arrays" suck.
  29.  
  30. > 2) How does one declare double precision complex numbers?  And
  31. > double precision complex arrays?  Does one have to fiddle with
  32. > the complex.h file itself in order to get double precision?
  33.  
  34.   The Sun C++ (AT&T CFRONT) complex.h is based on "double". If yours
  35. isn't, fixing things will be more complex 8-) than just modifying
  36. complex.h.
  37.  
  38.  
  39.   Jim
  40.  
  41. --
  42. -------------------------------------------------/\--------------------------
  43. James A. Crotinger     Lawrence Livermore N'Lab // \ The above views are mine
  44. jac@moonshine.llnl.gov P.O. Box 808;  L-630 \\ //---\  and are not neces-
  45. (510) 422-0259         Livermore CA  94550   \\/Amiga\  sarily those of LLNL.
  46.