DD-AVX  2.0.0
DD-AVX.hpp
Go to the documentation of this file.
1 #ifndef DD_AVX_HPP
2 #define DD_AVX_HPP
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <math.h>
7 #include<float.h>
8 
9 #include <vector>
10 #include <algorithm>
11 #include <iostream>
12 #include <random>
13 #include <cassert>
14 
15 #include<omp.h>
16 
17 #include"./qd/dd_real.h"
18 #include"./DD-AVX_dd_vector.hpp"
19 #include"./DD-AVX_d_vector.hpp"
20 #include"./DD-AVX_d_spmat.hpp"
21 
22 using d_real = double;
23 
24 inline dd_real dd_rand(){
25  dd_real tmp;
26  tmp.x[0] = rand();
27  tmp.x[1] = tmp.x[0] * powf(2.0, -52);
28  return tmp;
29 }
30 
31 namespace dd_avx{
32 
34  void axpy(const dd_real& alpha, const dd_real_vector& x, dd_real_vector& y);
36  void axpy(const dd_real& alpha, const d_real_vector& x, dd_real_vector& y);
38  void axpy(const dd_real& alpha, const dd_real_vector& x, d_real_vector& y);
40  void axpy(const dd_real& alpha, const d_real_vector& x, d_real_vector& y);
41 
43  void axpy(const d_real& alpha, const dd_real_vector& x, dd_real_vector& y);
45  void axpy(const d_real& alpha, const d_real_vector& x, dd_real_vector& y);
47  void axpy(const d_real& alpha, const dd_real_vector& x, d_real_vector& y);
49  void axpy(const d_real& alpha, const d_real_vector& x, d_real_vector& y);
50 
51 
52 
54  void axpyz(const dd_real& alpha, const dd_real_vector& x, const dd_real_vector& y, dd_real_vector& z);
56  void axpyz(const dd_real& alpha, const d_real_vector& x, const dd_real_vector& y, dd_real_vector& z);
58  void axpyz(const dd_real& alpha, const dd_real_vector& x, const d_real_vector& y, dd_real_vector& z);
60  void axpyz(const dd_real& alpha, const d_real_vector& x, const d_real_vector& y, dd_real_vector& z);
61 
63  void axpyz(const d_real& alpha, const dd_real_vector& x, const dd_real_vector& y, dd_real_vector& z);
65  void axpyz(const d_real& alpha, const d_real_vector& x, const dd_real_vector& y, dd_real_vector& z);
67  void axpyz(const d_real& alpha, const dd_real_vector& x, const d_real_vector& y, dd_real_vector& z);
69  void axpyz(const d_real& alpha, const d_real_vector& x, const d_real_vector& y, dd_real_vector& z);
70 
72  void axpyz(const dd_real& alpha, const dd_real_vector& x, const dd_real_vector& y, d_real_vector& z);
74  void axpyz(const dd_real& alpha, const d_real_vector& x, const dd_real_vector& y, d_real_vector& z);
76  void axpyz(const dd_real& alpha, const dd_real_vector& x, const d_real_vector& y, d_real_vector& z);
78  void axpyz(const dd_real& alpha, const d_real_vector& x, const d_real_vector& y, d_real_vector& z);
79 
81  void axpyz(const dd_real& alpha, const dd_real_vector& x, const dd_real_vector& y, d_real_vector& z);
83  void axpyz(const dd_real& alpha, const d_real_vector& x, const dd_real_vector& y, d_real_vector& z);
85  void axpyz(const dd_real& alpha, const dd_real_vector& x, const d_real_vector& y, d_real_vector& z);
87  void axpyz(const dd_real& alpha, const d_real_vector& x, const d_real_vector& y, d_real_vector& z);
88 
89 
90 
92  void xpay(const dd_real& alpha, const dd_real_vector& x, dd_real_vector& y);
94  void xpay(const dd_real& alpha, const d_real_vector& x, dd_real_vector& y);
96  void xpay(const dd_real& alpha, const dd_real_vector& x, d_real_vector& y);
98  void xpay(const dd_real& alpha, const d_real_vector& x, d_real_vector& y);
99 
101  void xpay(const d_real& alpha, const dd_real_vector& x, dd_real_vector& y);
103  void xpay(const d_real& alpha, const d_real_vector& x, dd_real_vector& y);
105  void xpay(const d_real& alpha, const dd_real_vector& x, d_real_vector& y);
107  void xpay(const d_real& alpha, const d_real_vector& x, d_real_vector& y);
108 
109 
110 
112  void scale(const dd_real& alpha, dd_real_vector& x);
114  void scale(const d_real& alpha, dd_real_vector& x);
116  void scale(const dd_real& alpha, d_real_vector& x);
118  void scale(const d_real& alpha, d_real_vector& x);
119 
120 
121 
123  dd_real nrm2(const dd_real_vector& x);
125  dd_real nrm2(const d_real_vector& x);
126 
127 
128 
130  dd_real dot(const dd_real_vector& x, const dd_real_vector& y);
132  dd_real dot(const d_real_vector& x, const dd_real_vector& y);
134  dd_real dot(const dd_real_vector& x, const d_real_vector& y);
136  dd_real dot(const d_real_vector& x, const d_real_vector& y);
137 
139  void matvec(const d_real_SpMat& A, const dd_real_vector& x, dd_real_vector& y);
141  void matvec(const d_real_SpMat& A, const d_real_vector& x, dd_real_vector& y);
143  void matvec(const d_real_SpMat& A, const dd_real_vector& x, d_real_vector& y);
145  void matvec(const d_real_SpMat& A, const d_real_vector& x, d_real_vector& y);
146 }
147 
148 #endif
double d_real
Definition: DD-AVX.hpp:22
dd_real dd_rand()
Definition: DD-AVX.hpp:24
double precision CRS format sparse matrix
Double precision vector class, This class is almost same as std::vector<double>
Double-double precision vector class.
void scale(const dd_real &alpha, dd_real_vector &x)
scale: x = ax
Definition: scale.cpp:5
void axpy(const dd_real &alpha, const dd_real_vector &x, dd_real_vector &y)
axpy: y = ax+y
Definition: axpy.cpp:6
void matvec(const d_real_SpMat &A, const dd_real_vector &x, dd_real_vector &y)
matvec: y = Ax
void axpyz(const dd_real &alpha, const dd_real_vector &x, const dd_real_vector &y, dd_real_vector &z)
axpyz: z = ax+y
Definition: axpyz.cpp:6
dd_real nrm2(const dd_real_vector &x)
nrm2: ans = ||x||
Definition: nrm2.cpp:6
dd_real dot(const dd_real_vector &x, const dd_real_vector &y)
dot: ans = (x,y)
Definition: dot.cpp:6
void xpay(const dd_real &alpha, const dd_real_vector &x, dd_real_vector &y)
xpay: y = x+ay
Definition: xpay.cpp:7