26template <
typename T>
inline
27void Copy(T *x, T *y,
int N) {
28 #pragma omp parallel for simd
29 for(
int i=0; i<N; i++) { y[i] = x[i]; }
38template <
typename T>
inline
39void Scal(T a, T *x,
int N) {
40 #pragma omp parallel for simd
41 for(
int i=0; i<N; i++) { x[i] *= a; }
51template <
typename T>
inline
52void Axpy(T a, T *x, T *y,
int N) {
53 #pragma omp parallel for simd
54 for(
int i=0; i<N; i++) { y[i] += a * x[i]; }
65template <
typename T>
inline
66void Axpby(T a, T *x, T b, T *y,
int N) {
67 #pragma omp parallel for simd
68 for(
int i=0; i<N; i++) { y[i] = a * x[i] + b * y[i]; }
79template <
typename T>
inline
80void Axpyz(T a, T *x, T *y, T *z,
int N) {
81 #pragma omp parallel for simd
82 for(
int i=0; i<N; i++) { z[i] = a * x[i] + y[i]; }
92template <
typename T>
inline
93T
Dot(T *x, T *y,
int N) {
95 #pragma omp parallel for simd reduction(+: res)
96 for(
int i=0; i<N; i++) { res += x[i] * y[i]; }
106template <
typename T>
inline
109 #pragma omp parallel for simd reduction(+: res)
110 for(
int i=0; i<N; i++) { res += x[i] * x[i]; }
111 return std::sqrt(res);
120template <
typename T>
inline
122 #pragma omp parallel for simd
123 for(
int i=0; i<N; i++) { y[i] *= x[i]; }
132template <
typename T>
inline
134 #pragma omp parallel for simd
135 for(
int i=0; i<N; i++) { y[i] /= x[i]; }
145template <
typename T>
inline
149 r = std::sqrt(a*a + b*b);
162template <
typename T>
inline
166 a[0] = c * temp - s * b[0];
167 b[0] = s * temp + c * b[0];
void Axpby(T a, T *x, T b, T *y, int N)
Compute y = a * x + b * y.
T Dot(T *x, T *y, int N)
Compute the dot product of x and y.
void HadDiv(T *x, T *y, int N)
Compute the element-wise division of x and y.
void Copy(T *x, T *y, int N)
Copy x to y.
void Scal(T a, T *x, int N)
Multiply x by a.
T Nrm2(T *x, int N)
Compute the 2-norm of x.
void HadProd(T *x, T *y, int N)
Compute the Hadamard product of x and y.
void Axpyz(T a, T *x, T *y, T *z, int N)
Compute z = a * x + y.
void Grot(T c, T s, T *a, T *b)
Compute the Gives rotation.
void Axpy(T a, T *x, T *y, int N)
Compute y = a * x + y.
T Ggen(T a, T b, T *c, T *s)
Generate a Gives rotation matrix.
The top-level namespace of SenK.
Some supplemental functions are defined.