DD-AVX  2.0.0
vector_copy.cpp
Go to the documentation of this file.
1 #include<DD-AVX_internal.hpp>
2 //Double
4  resize(vec.size());
5  std::copy(vec.hi.begin(), vec.hi.end(), begin());
6 }
7 
9  resize(vec.size());
10  std::copy(vec.begin(), vec.end(), begin());
11 }
12 
13 void d_real_vector::copy(const std::vector<double>& vec){
14  resize(vec.size());
15  std::copy(vec.begin(), vec.end(), begin());
16 }
17 
18 void d_real_vector::copy(const std::vector<dd_real>& vec){
19  resize(vec.size());
20 
21  #pragma omp parallel for
22  for(int i=0; i < vec.size(); i++){
23  at(i) = vec[i].x[0];
24  }
25 }
26 
28  copy(vec);
29  return *this;
30 }
31 
33  copy(vec);
34  return *this;
35 }
36 
37 d_real_vector& d_real_vector::operator=(const std::vector<double>& vec){
38  copy(vec);
39  return *this;
40 }
41 
42 d_real_vector& d_real_vector::operator=(const std::vector<dd_real>& vec){
43  copy(vec);
44  return *this;
45 }
46 
47 //DD
49  resize(vec.size());
50  std::copy(vec.hi.begin(), vec.hi.end(), hi.begin());
51  std::copy(vec.lo.begin(), vec.lo.end(), lo.begin());
52  N = vec.N;
53 }
54 
56  resize(vec.size());
57  std::copy(vec.begin(), vec.end(), hi.begin());
58  std::fill(this->lo.begin(), this->lo.end(), 0.0);
59  N = vec.size();
60 }
61 
62 void dd_real_vector::copy(const std::vector<double>& vec){
63  resize(vec.size());
64  std::copy(vec.begin(), vec.end(), hi.begin());
65  std::fill(this->lo.begin(), this->lo.end(), 0.0);
66  N = vec.size();
67 }
68 
69 void dd_real_vector::copy(const std::vector<dd_real>& vec){
70  hi.resize(vec.size());
71  lo.resize(vec.size());
72 
73  #pragma omp parallel for
74  for(int i=0; i < vec.size(); i++){
75  hi[i] = vec[i].x[0];
76  lo[i] = vec[i].x[1];
77  }
78  N = vec.size();
79 }
80 
82  this->copy(vec);
83  return *this;
84 }
85 
87  this->copy(vec);
88  return *this;
89 }
90 
91 dd_real_vector& dd_real_vector::operator=(const std::vector<double>& vec){
92  this->copy(vec);
93  return *this;
94 }
95 
96 dd_real_vector& dd_real_vector::operator=(const std::vector<dd_real>& vec){
97  this->copy(vec);
98  return *this;
99 }
Double precision vector class, This class is almost same as std::vector<double>
void copy(const dd_real_vector &vec)
copy from dd_real_vector
Definition: vector_copy.cpp:3
d_real_vector & operator=(const dd_real_vector &vec)
copy from dd_real_vector
Definition: vector_copy.cpp:27
Double-double precision vector class.
std::vector< double > lo
void copy(const dd_real_vector &vec)
copy from dd_real_vector
Definition: vector_copy.cpp:48
int size() const
get size
dd_real_vector & operator=(const dd_real_vector &vec)
copy from dd_real_vector
Definition: vector_copy.cpp:81
std::vector< double > hi
void resize(int n)
resize, this method is almost same as std::vector