DD-AVX  2.0.0
vector_div_d.cpp
Go to the documentation of this file.
1 #include<DD-AVX_internal.hpp>
2 
3 using namespace ddavx_core;
4 
5 //=========================================================
6 // function
7 //=========================================================
8 
10 {
11  if(size() != vec1.size() || size() != vec2.size()){
12  std::cerr << "error bad vector size" << std::endl;
13  assert(1);
14  }
15 
16 #pragma omp parallel for
17  for(int i=0 ; i<size() ; i++){
18  dd_real a, b, c;
19  a.x[0] = data()[i];
20  a.x[1] = 0.0;
21  b.x[0] = vec1.hi[i];
22  b.x[1] = vec1.lo[i];
23  c.x[0] = vec2.hi[i];
24  c.x[1] = vec2.lo[i];
25  a = b / c;
26  data()[i] = a.x[0];
27  }
28 }
29 
31 {
32  if(size() != vec1.size() || size() != vec2.size()){
33  std::cerr << "error bad vector size" << std::endl;
34  assert(1);
35  }
36 
37 #pragma omp parallel for
38  for(int i=0 ; i<size() ; i++){
39  dd_real a, b, c;
40  a.x[0] = data()[i];
41  a.x[1] = 0.0;
42  b.x[0] = vec1.data()[i];
43  b.x[1] = 0.0;
44  c.x[0] = vec2.hi[i];
45  c.x[1] = vec2.lo[i];
46  a = b / c;
47  data()[i] = a.x[0];
48  }
49 }
50 
52 {
53  if(size() != vec1.size() || size() != vec2.size()){
54  std::cerr << "error bad vector size" << std::endl;
55  assert(1);
56  }
57 
58 #pragma omp parallel for
59  for(int i=0 ; i<size() ; i++){
60  dd_real a, b, c;
61  a.x[0] = data()[i];
62  a.x[1] = 0.0;
63  b.x[0] = vec1.hi[i];
64  b.x[1] = vec1.lo[i];
65  c.x[0] = vec2.data()[i];
66  c.x[1] = 0.0;
67  a = b / c;
68  data()[i] = a.x[0];
69  }
70 }
71 
73 {
74  if(size() != vec1.size() || size() != vec2.size()){
75  std::cerr << "error bad vector size" << std::endl;
76  assert(1);
77  }
78 
79 #pragma omp parallel for
80  for(int i=0 ; i<size() ; i++){
81  data()[i] = vec1.data()[i] / vec2.data()[i];
82  }
83 }
84 
85 //=========================================================
86 // operator
87 //=========================================================
89 {
90  div(*this, vec);
91  return *this;
92 }
94 {
95  div(*this, vec);
96  return *this;
97 }
98 
100 {
101  div(*this, vec);
102  return *this;
103 }
105 {
106  div(*this, vec);
107  return *this;
108 }
109 
Double precision vector class, This class is almost same as std::vector<double>
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 div(dd_real_vector &vec1, dd_real_vector &vec2)
all elemetnt arithmetic function
Definition: vector_div_d.cpp:9
Double-double precision vector class.
std::vector< double > lo
int size() const
get size
std::vector< double > hi