monolish
0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
src
blas
matrix
diag_op
dense_diag_scalar_div.cpp
Go to the documentation of this file.
1
#include "../../../../include/monolish_blas.hpp"
2
#include "../../../internal/monolish_internal.hpp"
3
4
namespace
monolish
{
5
namespace
matrix {
6
7
// div scalar
8
template
<
typename
T>
void
Dense<T>::diag_div
(
const
T alpha) {
9
Logger &logger =
Logger::get_instance
();
10
logger.func_in(
monolish_func
);
11
12
T *vald = val.data();
13
const
size_t
N = get_col();
14
const
size_t
Len = get_row() > get_col() ? get_row() : get_col();
15
16
if
(gpu_status ==
true
) {
17
#if MONOLISH_USE_GPU // gpu
18
#pragma omp target teams distribute parallel for
19
for
(
size_t
i = 0; i < Len; i++) {
20
vald[N * i + i] /= alpha;
21
}
22
#else
23
throw
std::runtime_error(
"error USE_GPU is false, but gpu_status == true"
);
24
#endif
25
}
else
{
26
#pragma omp parallel for
27
for
(
size_t
i = 0; i < Len; i++) {
28
vald[N * i + i] /= alpha;
29
}
30
}
31
32
logger.func_out();
33
}
34
template
void
monolish::matrix::Dense<double>::diag_div
(
const
double
alpha);
35
template
void
monolish::matrix::Dense<float>::diag_div
(
const
float
alpha);
36
37
}
// namespace matrix
38
}
// namespace monolish
monolish_func
#define monolish_func
Definition:
monolish_logger.hpp:9
monolish::matrix::Dense::diag_div
void diag_div(const Float alpha)
Scalar and diag. vector of dense matrix div.
monolish
Definition:
monolish_matrix_blas.hpp:9
monolish::Logger::get_instance
static Logger & get_instance()
Definition:
monolish_logger.hpp:42
Generated by
1.8.17