DD-AVX  2.0.0
vector_mul_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  registers regs;
16 
17 #pragma omp parallel private(regs)
18  {
19  int i=0, is=0, ie=0;
20  get_isie(size(), is, ie);
21  for(i = is; i < (ie-SIMD_Length+1); i += SIMD_Length){
22  reg a_hi = load(hi[i]);
23  reg a_lo = load(lo[i]);
24 
25  reg b_hi = load(vec1.hi[i]);
26  reg b_lo = load(vec1.lo[i]);
27 
28  reg c_hi = load(vec2.hi[i]);
29  reg c_lo = load(vec2.lo[i]);
30 
31  Mul(a_hi, a_lo, b_hi, b_lo, c_hi, c_lo, regs);
32 
33  store(hi[i], a_hi);
34  store(lo[i], a_lo);
35  }
36  for(;i<ie;i++){
37  Mul(hi[i], lo[i], vec1.hi[i], vec1.lo[i], vec2.hi[i], vec2.lo[i]);
38  }
39  }
40 }
41 
43 {
44  if(size() != vec1.size() || size() != vec2.size()){
45  std::cerr << "error bad vector size" << std::endl;
46  assert(1);
47  }
48  registers regs;
49 
50 #pragma omp parallel private(regs)
51  {
52  int i=0, is=0, ie=0;
53  get_isie(size(), is, ie);
54  for(i = is; i < (ie-SIMD_Length+1); i += SIMD_Length){
55  reg a_hi = load(hi[i]);
56  reg a_lo = load(lo[i]);
57 
58  reg b_hi = load(vec1.hi[i]);
59  reg b_lo = load(vec1.lo[i]);
60 
61  reg c_hi = load(vec2.data()[i]);
62 
63  Muld(a_hi, a_lo, b_hi, b_lo, c_hi, regs);
64 
65  store(hi[i], a_hi);
66  store(lo[i], a_lo);
67  }
68  for(;i<ie;i++){
69  Muld(hi[i], lo[i], vec1.hi[i], vec1.lo[i], vec2.data()[i]);
70  }
71  }
72 }
73 
74 
76 {
77  mul(vec2, vec1);
78 }
79 
81 {
82  if(size() != vec1.size() || size() != vec2.size()){
83  std::cerr << "error bad vector size" << std::endl;
84  assert(1);
85  }
86  registers regs;
87 
88 #pragma omp parallel private(regs)
89  {
90  int i=0, is=0, ie=0;
91  get_isie(size(), is, ie);
92  for(i = is; i < (ie-SIMD_Length+1); i += SIMD_Length){
93  reg a_hi = load(hi[i]);
94  reg a_lo = load(lo[i]);
95 
96  reg b_hi = load(vec1.data()[i]);
97  reg b_lo = regs.zeros;
98 
99  reg c_hi = load(vec2.data()[i]);
100  reg c_lo = regs.zeros;
101 
102  Mul(a_hi, a_lo, b_hi, b_lo, c_hi, c_lo, regs);
103 
104  store(hi[i], a_hi);
105  store(lo[i], a_lo);
106  }
107  for(;i<ie;i++){
108  Mul(hi[i], lo[i], vec1.data()[i], 0.0, vec2.data()[i], 0.0);
109  }
110  }
111 }
112 
113 //=========================================================
114 // operator
115 //=========================================================
116 
118 {
119  mul(*this, vec);
120  return *this;
121 }
122 
124 {
125  mul(*this, vec);
126  return *this;
127 }
128 
130 {
131  mul(*this, vec);
132  return *this;
133 }
134 
136 {
137  mul(*this, vec);
138  return *this;
139 }
140 
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
void mul(dd_real_vector &vec1, dd_real_vector &vec2)
all elemetnt arithmetic function
dd_real_vector operator*=(dd_real_vector &vec)
all elemetnt arithmetic function
std::vector< double > hi