DD-AVX  2.0.0
DD-AVX_d_vector.hpp
Go to the documentation of this file.
1 #ifndef D_VECTOR_HPP
2 #define D_VECTOR_HPP
3 
4 class dd_real_vector;
6 struct dd_real;
7 
9 class d_real_vector : public std::vector<double>{
10  friend class dd_real_vector;
11  public:
12  d_real_vector() : std::vector<double>(){};
13 
15  d_real_vector(const std::vector<double>& obj) : std::vector<double>(obj) {}
17  d_real_vector(double a) : std::vector<double>(a) {}
19  d_real_vector(int a) : std::vector<double>(a) {}
21  d_real_vector(long a) : std::vector<double>(a) {}
22 
24  d_real_vector(int n, double val) : std::vector<double>(n, val) {}
26  d_real_vector(long n, double val) : std::vector<double>(n, val) {}
27 
29  std::vector<double> HI(){return *this;}
30 
32  std::vector<double> LO(){
33  std::vector<double> tmp(size(), 0.0);
34  return tmp;
35  }
36 //--I/O---------------------------------------
38  void print_all(){
39  for(int i=0; i<size(); i++)
40  std::cout << std::vector<double>::at(i) << std::endl;
41  }
42 
44  void print(int i){
45  std::cout << std::vector<double>::at(i) << std::endl;
46  }
47 
49  void input(const char* filename);
50 
52  void input_mm(FILE *file);
53 
55  void input_plane(FILE *file);
56 
58  void output_mm(const char *filename);
59 
61  void output_plane(const char *filename);
62 
63 //--copy---------------------------------------
65  void copy(const dd_real_vector& vec);
67  void copy(const d_real_vector& vec);
69  void copy(const std::vector<double>& vec);
71  void copy(const std::vector<dd_real>& vec);
72 
78  d_real_vector& operator=(const std::vector<double>& vec);
80  d_real_vector& operator=(const std::vector<dd_real>& vec);
81 
82 //--comparision == ---------------------------------------
84  bool operator==(const dd_real_vector& vec);
86  bool operator==(const d_real_vector& vec);
88  bool operator==(const std::vector<double>& vec);
90  bool operator==(const std::vector<dd_real>& vec);
91 
93  bool operator!=(const dd_real_vector& vec);
95  bool operator!=(const d_real_vector& vec);
97  bool operator!=(const std::vector<double>& vec);
99  bool operator!=(const std::vector<dd_real>& vec);
100 
101 //--cast -------------------------------------
103  operator double*(){
104  return data();
105  }
106 
108  operator dd_real_vector();
109 
110 //--minus---------------------------------------
112  void minus();
115 
116 //--add---------------------------------------
118  void add(dd_real_vector& vec1, dd_real_vector& vec2);
120  void add(d_real_vector& vec1, dd_real_vector& vec2);
122  void add(dd_real_vector& vec1, d_real_vector& vec2);
124  void add(d_real_vector& vec1, d_real_vector& vec2);
125 
130 
135 
136 //--sub---------------------------------------
138  void sub(dd_real_vector& vec1, dd_real_vector& vec2);
140  void sub(d_real_vector& vec1, dd_real_vector& vec2);
142  void sub(dd_real_vector& vec1, d_real_vector& vec2);
144  void sub(d_real_vector& vec1, d_real_vector& vec2);
145 
150 
155 
156 //--mul---------------------------------------
158  void mul(dd_real_vector& vec1, dd_real_vector& vec2);
160  void mul(d_real_vector& vec1, dd_real_vector& vec2);
162  void mul(dd_real_vector& vec1, d_real_vector& vec2);
164  void mul(d_real_vector& vec1, d_real_vector& vec2);
165 
170 
175 //--div---------------------------------------
177  void div(dd_real_vector& vec1, dd_real_vector& vec2);
179  void div(d_real_vector& vec1, dd_real_vector& vec2);
181  void div(dd_real_vector& vec1, d_real_vector& vec2);
183  void div(d_real_vector& vec1, d_real_vector& vec2);
184 
189 
194 };
195 
196 #endif
Double precision vector class, This class is almost same as std::vector<double>
void sub(dd_real_vector &vec1, dd_real_vector &vec2)
all elemetnt arithmetic function
Definition: vector_sub_d.cpp:9
d_real_vector operator+=(dd_real_vector &vec)
all elemetnt arithmetic function
bool operator==(const dd_real_vector &vec)
comparision
void input_plane(FILE *file)
create vector from plane format file
bool operator!=(const dd_real_vector &vec)
comparision
void input(const char *filename)
create vector from file
d_real_vector(long a)
create vector, all elements is a
d_real_vector operator/=(dd_real_vector &vec)
all elemetnt arithmetic function
void copy(const dd_real_vector &vec)
copy from dd_real_vector
Definition: vector_copy.cpp:3
d_real_vector(int n, double val)
create size n, all elements is val vector
d_real_vector(double a)
create vector, all elements is a
d_real_vector operator+(dd_real_vector &vec)
all elemetnt arithmetic function
d_real_vector operator-=(dd_real_vector &vec)
all elemetnt arithmetic function
void print(int i)
output vector element vec[i] to standard I/O
d_real_vector operator/(dd_real_vector &vec)
all elemetnt arithmetic function
void print_all()
output vector elements to standard I/O
void mul(dd_real_vector &vec1, dd_real_vector &vec2)
all elemetnt arithmetic function
Definition: vector_mul_d.cpp:9
void minus()
sign
d_real_vector operator-()
sign
d_real_vector & operator=(const dd_real_vector &vec)
copy from dd_real_vector
Definition: vector_copy.cpp:27
void output_mm(const char *filename)
outout vector to matrix market format
d_real_vector(long n, double val)
create size n, all elements is val vector
void div(dd_real_vector &vec1, dd_real_vector &vec2)
all elemetnt arithmetic function
Definition: vector_div_d.cpp:9
d_real_vector(const std::vector< double > &obj)
create vector from std::vector<double>
friend class dd_real_vector
void input_mm(FILE *file)
create vector from matrix market format file
d_real_vector(int a)
create vector, all elements is a
d_real_vector operator*(dd_real_vector &vec)
all elemetnt arithmetic function
void add(dd_real_vector &vec1, dd_real_vector &vec2)
all elemetnt arithmetic function
Definition: vector_add_d.cpp:9
std::vector< double > HI()
return DD's hi array
d_real_vector operator*=(dd_real_vector &vec)
all elemetnt arithmetic function
void output_plane(const char *filename)
outout vector to plane format
std::vector< double > LO()
return DD's lo array (return zero vector)
Double-double precision vector reference class.
Double-double precision vector class.
int size() const
get size
double * data()
get hi array pointer