monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
transpose_coo.cpp
Go to the documentation of this file.
1 #include "../../../include/common/monolish_dense.hpp"
2 #include "../../../include/common/monolish_logger.hpp"
3 #include "../../../include/common/monolish_matrix.hpp"
4 #include "../../internal/monolish_internal.hpp"
5 
6 namespace monolish {
7 namespace matrix {
8 
9 template <typename T> COO<T> &COO<T>::transpose() {
10  Logger &logger = Logger::get_instance();
11  logger.util_in(monolish_func);
12  using std::swap;
13  swap(rowN, colN);
14  swap(row_index, col_index);
15  return *this;
16  logger.util_out();
17 }
20 
21 template <typename T> void COO<T>::transpose(COO &B) const {
22  Logger &logger = Logger::get_instance();
23  logger.util_in(monolish_func);
24  B.set_row(get_col());
25  B.set_col(get_row());
26  B.set_nnz(get_nnz());
27  B.row_index = get_col_ind();
28  B.col_index = get_row_ptr();
29  B.val = get_val_ptr();
30  logger.util_out();
31 }
32 template void COO<double>::transpose(COO &B) const;
33 template void COO<float>::transpose(COO &B) const;
34 
35 } // namespace matrix
36 } // namespace monolish
monolish::matrix::COO::row_index
std::vector< int > row_index
Coodinate format row index, which stores row numbers of the non-zero elements (size nnz)
Definition: monolish_coo.hpp:65
monolish::matrix::COO::set_col
void set_col(const size_t N)
Set col number.
Definition: monolish_coo.hpp:276
monolish_func
#define monolish_func
Definition: monolish_logger.hpp:9
monolish::matrix::COO::set_row
void set_row(const size_t M)
Set row number.
Definition: monolish_coo.hpp:266
monolish::Logger
logger class (singleton, for developper class)
Definition: monolish_logger.hpp:19
monolish::Logger::util_out
void util_out()
Definition: logger_utils.cpp:123
monolish::matrix::COO::val
std::vector< Float > val
Coodinate format value array, which stores values of the non-zero elements (size nnz)
Definition: monolish_coo.hpp:77
monolish::Logger::util_in
void util_in(const std::string func_name)
Definition: logger_utils.cpp:113
monolish
Definition: monolish_matrix_blas.hpp:9
monolish::matrix::COO
Coodinate (COO) format Matrix (need to sort)
Definition: monolish_coo.hpp:38
monolish::matrix::COO::set_nnz
void set_nnz(const size_t NNZ)
Set # of non-zero elements.
Definition: monolish_coo.hpp:286
monolish::matrix::COO::transpose
COO & transpose()
get transposed matrix (A^T)
Definition: transpose_coo.cpp:9
monolish::Logger::get_instance
static Logger & get_instance()
Definition: monolish_logger.hpp:42
monolish::matrix::COO::col_index
std::vector< int > col_index
Coodinate format column index, which stores column numbers of the non-zero elements (size nnz)
Definition: monolish_coo.hpp:71