monolish  0.14.2
MONOlithic LIner equation Solvers for Highly-parallel architecture
linearoperator-dense_matmul.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 // double ///////////////////
9  Logger &logger = Logger::get_instance();
10  logger.func_in(monolish_func);
11 
12  // err
13  assert(A.get_col() == B.get_row());
14  assert(A.get_row() == C.get_row());
15  assert(B.get_col() == C.get_col());
16  assert(util::is_same_device_mem_stat(A, B, C));
17 
19  C = A.get_matmul_dense()(B);
20  } else {
21  throw std::runtime_error("error matmul is not initialized");
22  }
23 
24  logger.func_out();
25 }
26 
27 // float ///////////////////
30  Logger &logger = Logger::get_instance();
31  logger.func_in(monolish_func);
32 
33  // err
34  assert(A.get_col() == B.get_row());
35  assert(A.get_row() == C.get_row());
36  assert(B.get_col() == C.get_col());
37  assert(util::is_same_device_mem_stat(A, B, C));
38 
40  C = A.get_matmul_dense()(B);
41  } else {
42  throw std::runtime_error("error matmul is not initialized");
43  }
44 
45  logger.func_out();
46 }
47 
48 // double ///////////////////
51  Logger &logger = Logger::get_instance();
52  logger.func_in(monolish_func);
53 
54  // err
55  assert(A.get_row() == B.get_row());
56  assert(A.get_col() == C.get_row());
57  assert(B.get_col() == C.get_col());
58  assert(util::is_same_device_mem_stat(A, B, C));
59 
61  C = A.get_rmatmul_dense()(B);
62  } else {
63  throw std::runtime_error("error rmatmul is not initialized");
64  }
65 
66  logger.func_out();
67 }
68 
69 // float ///////////////////
72  Logger &logger = Logger::get_instance();
73  logger.func_in(monolish_func);
74 
75  // err
76  assert(A.get_row() == B.get_row());
77  assert(A.get_col() == C.get_row());
78  assert(B.get_col() == C.get_col());
79  assert(util::is_same_device_mem_stat(A, B, C));
80 
82  C = A.get_rmatmul_dense()(B);
83  } else {
84  throw std::runtime_error("error rmatmul is not initialized");
85  }
86 
87  logger.func_out();
88 }
89 
90 } // namespace monolish
monolish::matrix::LinearOperator
Linear Operator imitating Matrix.
Definition: monolish_coo.hpp:37
monolish_func
#define monolish_func
Definition: monolish_logger.hpp:9
monolish::Logger
logger class (singleton, for developper class)
Definition: monolish_logger.hpp:19
monolish::matrix::LinearOperator::get_rmatmul_dense_init_flag
bool get_rmatmul_dense_init_flag() const
get flag that shows rmatmul_dense is defined or not
Definition: monolish_linearoperator.hpp:301
monolish::Logger::func_out
void func_out()
Definition: logger_utils.cpp:80
monolish::matrix::LinearOperator::get_matmul_dense
std::function< matrix::Dense< Float >const matrix::Dense< Float > &)> get_matmul_dense() const
get multiplication function of matrix and matrix dense
Definition: monolish_linearoperator.hpp:243
monolish::matrix::Dense::get_row
size_t get_row() const
get # of row
Definition: monolish_dense.hpp:199
monolish::matrix::LinearOperator::get_col
size_t get_col() const
get # of col
Definition: monolish_linearoperator.hpp:207
monolish::matrix::Dense
Dense format Matrix.
Definition: monolish_coo.hpp:35
monolish::matrix::LinearOperator::get_rmatmul_dense
std::function< matrix::Dense< Float >const matrix::Dense< Float > &)> get_rmatmul_dense() const
get multiplication function of (Hermitian) transposed matrix and matrix dense;
Definition: monolish_linearoperator.hpp:257
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:454
monolish
Definition: monolish_matrix_blas.hpp:10
monolish::matrix::LinearOperator::get_row
size_t get_row() const
get # of row
Definition: monolish_linearoperator.hpp:198
monolish::blas::rmatmul
void rmatmul(const matrix::LinearOperator< double > &A, const matrix::Dense< double > &B, matrix::Dense< double > &C)
LinearOperator multiplication: C = A^t B.
Definition: linearoperator-dense_matmul.cpp:49
monolish::matrix::Dense::get_col
size_t get_col() const
get # of col
Definition: monolish_dense.hpp:208
monolish::matrix::LinearOperator::get_matmul_dense_init_flag
bool get_matmul_dense_init_flag() const
get flag that shows matmul_dense is defined or not
Definition: monolish_linearoperator.hpp:290
monolish::blas::matmul
void matmul(const matrix::Dense< double > &A, const matrix::Dense< double > &B, matrix::Dense< double > &C)
Dense matrix multiplication: C = AB.
Definition: dense-dense_matmul.cpp:7
monolish::Logger::get_instance
static Logger & get_instance()
Definition: monolish_logger.hpp:42
monolish::Logger::func_in
void func_in(const std::string func_name)
Definition: logger_utils.cpp:69