1 #include "../../../../include/monolish_blas.hpp"
2 #include "../../../internal/monolish_internal.hpp"
13 const T *vecd = vec.data();
16 const size_t N = get_col();
17 const size_t Len = get_row() > get_col() ? get_row() : get_col();
19 assert(Len == vec.size());
21 if (gpu_status ==
true) {
22 #if MONOLISH_USE_GPU // gpu
23 #pragma omp target teams distribute parallel for
24 for (
size_t i = 0; i < Len; i++) {
25 vald[N * i + i] *= vecd[i];
28 throw std::runtime_error(
"error USE_GPU is false, but gpu_status == true");
31 #pragma omp parallel for
32 for (
size_t i = 0; i < Len; i++) {
33 vald[N * i + i] *= vecd[i];
48 const T *vecd = vec.data();
51 const size_t N = get_col();
52 const size_t Len = get_row() > get_col() ? get_row() : get_col();
54 assert(Len == vec.size());
56 if (gpu_status ==
true) {
57 #if MONOLISH_USE_GPU // gpu
58 #pragma omp target teams distribute parallel for
59 for (
size_t i = 0; i < Len; i++) {
60 vald[N * i + i] *= vecd[i];
63 throw std::runtime_error(
"error USE_GPU is false, but gpu_status == true");
66 #pragma omp parallel for
67 for (
size_t i = 0; i < Len; i++) {
68 vald[N * i + i] *= vecd[i];
75 const view1D<vector<double>,
double> &vec);
77 const view1D<vector<float>,
float> &vec);
84 const T *vecd = vec.data();
87 const size_t N = get_col();
88 const size_t Len = get_row() > get_col() ? get_row() : get_col();
90 assert(Len == vec.size());
92 if (gpu_status ==
true) {
93 #if MONOLISH_USE_GPU // gpu
94 #pragma omp target teams distribute parallel for
95 for (
size_t i = 0; i < Len; i++) {
96 vald[N * i + i] *= vecd[i];
99 throw std::runtime_error(
"error USE_GPU is false, but gpu_status == true");
102 #pragma omp parallel for
103 for (
size_t i = 0; i < Len; i++) {
104 vald[N * i + i] *= vecd[i];
111 const view1D<matrix::Dense<double>,
double> &vec);
113 const view1D<matrix::Dense<float>,
float> &vec);