You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.8 KiB

25 years ago
  1. // General vectors of complex numbers.
  2. #ifndef _CL_GV_COMPLEX_H
  3. #define _CL_GV_COMPLEX_H
  4. #include "cl_number.h"
  5. #include "cl_GV_number.h"
  6. #include "cl_complex_class.h"
  7. #include "cl_io.h"
  8. // A vector of complex numbers is just a normal vector of numbers.
  9. typedef cl_heap_GV<cl_N> cl_heap_GV_N;
  10. struct cl_GV_N : public cl_GV<cl_N,cl_GV_number> {
  11. public:
  12. // Constructors.
  13. cl_GV_N ();
  14. cl_GV_N (const cl_GV_N&);
  15. explicit cl_GV_N (uintL len);
  16. // Assignment operators.
  17. cl_GV_N& operator= (const cl_GV_N&);
  18. // Private pointer manipulations.
  19. cl_GV_N (cl_heap_GV_N* p) : cl_GV<cl_N,cl_GV_number> (p) {}
  20. cl_GV_N (cl_private_thing p) : cl_GV<cl_N,cl_GV_number> (p) {}
  21. };
  22. inline cl_GV_N::cl_GV_N (const cl_GV_N& x) : cl_GV<cl_N,cl_GV_number> (as_cl_private_thing(x)) {}
  23. CL_DEFINE_ASSIGNMENT_OPERATOR(cl_GV_N,cl_GV_N)
  24. inline cl_GV_N::cl_GV_N (uintL len)
  25. : cl_GV<cl_N,cl_GV_number> ((cl_heap_GV_N*) cl_make_heap_GV_number(len)) {}
  26. inline cl_GV_N::cl_GV_N ()
  27. : cl_GV<cl_N,cl_GV_number> ((cl_heap_GV_N*) (cl_heap_GV_number*) cl_null_GV_number) {}
  28. // Copy a vector.
  29. inline const cl_GV_N copy (const cl_GV_N& vector)
  30. {
  31. return The(cl_GV_N) (copy((const cl_GV_number&) vector));
  32. }
  33. // Output.
  34. inline void fprint (cl_ostream stream, const cl_GV_N& x)
  35. {
  36. extern cl_print_flags cl_default_print_flags;
  37. extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
  38. extern void print_complex (cl_ostream stream, const cl_print_flags& flags, const cl_N& z);
  39. print_vector(stream, cl_default_print_flags,
  40. (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
  41. (void (*) (cl_ostream, const cl_print_flags&, const cl_N&))
  42. &print_complex,
  43. x);
  44. }
  45. CL_DEFINE_PRINT_OPERATOR(cl_GV_N)
  46. #endif /* _CL_GV_COMPLEX_H */