monolish
0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
src
blas
matrix
mataddsub
dense_mataddsub.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
6
namespace
{
7
8
template
<
typename
F>
9
void
matadd_core(
const
matrix::Dense<F> &A,
const
matrix::Dense<F> &B,
10
matrix::Dense<F> &C) {
11
Logger &logger =
Logger::get_instance
();
12
logger.func_in(
monolish_func
);
13
14
// err
15
assert(
util::is_same_size
(A, B, C));
16
assert(
util::is_same_device_mem_stat
(A, B, C));
17
18
internal::vadd(A.get_nnz(), A.val.data(), B.val.data(), C.val.data(),
19
A.get_device_mem_stat());
20
21
logger.func_out();
22
}
23
24
template
<
typename
F>
25
void
matsub_core(
const
matrix::Dense<F> &A,
const
matrix::Dense<F> &B,
26
matrix::Dense<F> &C) {
27
Logger &logger =
Logger::get_instance
();
28
logger.func_in(
monolish_func
);
29
30
// err
31
assert(
util::is_same_size
(A, B, C));
32
assert(
util::is_same_device_mem_stat
(A, B, C));
33
34
internal::vsub(A.get_nnz(), A.val.data(), B.val.data(), C.val.data(),
35
A.get_device_mem_stat());
36
37
logger.func_out();
38
}
39
}
// namespace
40
41
namespace
blas {
42
void
matadd
(
const
matrix::Dense<double>
&A,
const
matrix::Dense<double>
&B,
43
matrix::Dense<double>
&C) {
44
matadd_core(A, B, C);
45
}
46
void
matsub
(
const
matrix::Dense<double>
&A,
const
matrix::Dense<double>
&B,
47
matrix::Dense<double>
&C) {
48
matsub_core(A, B, C);
49
}
50
void
matadd
(
const
matrix::Dense<float>
&A,
const
matrix::Dense<float>
&B,
51
matrix::Dense<float>
&C) {
52
matadd_core(A, B, C);
53
}
54
void
matsub
(
const
matrix::Dense<float>
&A,
const
matrix::Dense<float>
&B,
55
matrix::Dense<float>
&C) {
56
matsub_core(A, B, C);
57
}
58
59
}
// namespace blas
60
}
// namespace monolish
monolish::util::is_same_size
bool is_same_size(const T &x, const U &y)
compare size of vector or 1Dview (same as is_same_structure())
Definition:
monolish_common.hpp:358
monolish_func
#define monolish_func
Definition:
monolish_logger.hpp:9
monolish::matrix::Dense
Dense format Matrix.
Definition:
monolish_coo.hpp:28
monolish::util::is_same_device_mem_stat
bool is_same_device_mem_stat(const T &arg1, const U &arg2)
compare same device memory status
Definition:
monolish_common.hpp:431
monolish::blas::matsub
void matsub(const matrix::Dense< double > &A, const matrix::Dense< double > &B, matrix::Dense< double > &C)
Dense matrix subtract: C = A - B.
Definition:
dense_mataddsub.cpp:46
monolish
Definition:
monolish_matrix_blas.hpp:9
monolish::blas::matadd
void matadd(const matrix::Dense< double > &A, const matrix::Dense< double > &B, matrix::Dense< double > &C)
Dense matrix addition: C = A + B.
Definition:
dense_mataddsub.cpp:42
monolish::Logger::get_instance
static Logger & get_instance()
Definition:
monolish_logger.hpp:42
Generated by
1.8.17