DD-AVX  2.0.0
vector_div_dd.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] = hi[i];
20  a.x[1] = lo[i];
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  hi[i] = a.x[0];
27  lo[i] = a.x[1];
28  }
29 }
30 
32 {
33  if(size() != vec1.size() || size() != vec2.size()){
34  std::cerr << "error bad vector size" << std::endl;
35  assert(1);
36  }
37 
38 #pragma omp parallel for
39  for(int i=0 ; i<size() ; i++){
40  dd_real a, b, c;
41  a.x[0] = hi[i];
42  a.x[1] = lo[i];
43  b.x[0] = vec1.data()[i];
44  b.x[1] = 0.0;
45  c.x[0] = vec2.hi[i];
46  c.x[1] = vec2.lo[i];
47  a = b / c;
48  hi[i] = a.x[0];
49  lo[i] = a.x[1];
50  }
51 }
52 
53 
55 {
56  if(size() != vec1.size() || size() != vec2.size()){
57  std::cerr << "error bad vector size" << std::endl;
58  assert(1);
59  }
60 
61 #pragma omp parallel for
62  for(int i=0 ; i<size() ; i++){
63  dd_real a, b, c;
64  a.x[0] = hi[i];
65  a.x[1] = lo[i];
66  b.x[0] = vec1.hi[i];
67  b.x[1] = vec1.lo[i];
68  c.x[0] = vec2.data()[i];
69  c.x[1] = 0.0;
70  a = b / c;
71  hi[i] = a.x[0];
72  lo[i] = a.x[1];
73  }
74 }
75 
77 {
78  if(size() != vec1.size() || size() != vec2.size()){
79  std::cerr << "error bad vector size" << std::endl;
80  assert(1);
81  }
82 
83 #pragma omp parallel for
84  for(int i=0 ; i<size() ; i++){
85  dd_real a, b, c;
86  a.x[0] = hi[i];
87  a.x[1] = lo[i];
88  b.x[0] = vec1.data()[i];
89  b.x[1] = 0.0;
90  c.x[0] = vec2.data()[i];
91  c.x[1] = 0.0;
92  a = b / c;
93  hi[i] = a.x[0];
94  lo[i] = a.x[1];
95  }
96 }
97 
98 //=========================================================
99 // operator
100 //=========================================================
101 
103 {
104  div(*this, vec);
105  return *this;
106 }
107 
109 {
110  div(*this, vec);
111  return *this;
112 }
113 
115 {
116  div(*this, vec);
117  return *this;
118 }
119 
121 {
122  div(*this, vec);
123  return *this;
124 }
125 
Double precision vector class, This class is almost same as std::vector<double>
Double-double precision vector class.
std::vector< double > lo
dd_real_vector operator/=(dd_real_vector &vec)
all elemetnt arithmetic function
int size() const
get size
dd_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
std::vector< double > hi