Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-19 08:08:30

0001 // General vectors of rational numbers.
0002 
0003 #ifndef _CL_GV_RATIONAL_H
0004 #define _CL_GV_RATIONAL_H
0005 
0006 #include "cln/number.h"
0007 #include "cln/GV_real.h"
0008 #include "cln/rational_class.h"
0009 #include "cln/io.h"
0010 
0011 namespace cln {
0012 
0013 // A vector of rational numbers is just a normal vector of real numbers.
0014 
0015 typedef cl_heap_GV<cl_RA> cl_heap_GV_RA;
0016 
0017 struct cl_GV_RA : public cl_GV<cl_RA,cl_GV_R> {
0018 public:
0019     // Constructors.
0020     cl_GV_RA ();
0021     cl_GV_RA (const cl_GV_RA&);
0022     explicit cl_GV_RA (std::size_t len);
0023     // Assignment operators.
0024     cl_GV_RA& operator= (const cl_GV_RA&);
0025     // Private pointer manipulations.
0026     cl_GV_RA (cl_heap_GV_RA* p) : cl_GV<cl_RA,cl_GV_R> (p) {}
0027     cl_GV_RA (cl_private_thing p) : cl_GV<cl_RA,cl_GV_R> (p) {}
0028 };
0029 inline cl_GV_RA::cl_GV_RA (const cl_GV_RA& x) : cl_GV<cl_RA,cl_GV_R> (as_cl_private_thing(x)) {}
0030 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_GV_RA,cl_GV_RA)
0031 inline cl_GV_RA::cl_GV_RA (std::size_t len)
0032     : cl_GV<cl_RA,cl_GV_R> ((cl_heap_GV_RA*) cl_make_heap_GV_number(len)) {}
0033 inline cl_GV_RA::cl_GV_RA ()
0034     : cl_GV<cl_RA,cl_GV_R> ((cl_heap_GV_RA*) (cl_heap_GV_number*) cl_null_GV_number) {}
0035 
0036 // Copy a vector.
0037 inline const cl_GV_RA copy (const cl_GV_RA& vector)
0038 {
0039     return The(cl_GV_RA) (copy((const cl_GV_R&) vector));
0040 }
0041 
0042 // Output.
0043 inline void fprint (std::ostream& stream, const cl_GV_RA& x)
0044 {
0045     extern cl_print_flags default_print_flags;
0046     extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
0047     extern void print_rational (std::ostream& stream, const cl_print_flags& flags, const cl_RA& z);
0048     print_vector(stream, default_print_flags,
0049                  (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
0050                  (void (*) (std::ostream&, const cl_print_flags&, const cl_RA&))
0051                  &print_rational,
0052                  x);
0053 }
0054 CL_DEFINE_PRINT_OPERATOR(cl_GV_RA)
0055 
0056 }  // namespace cln
0057 
0058 #endif /* _CL_GV_RAATIONAL_H */