monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
eye.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 template <typename T> matrix::COO<T> util::eye(const int M) {
7  Logger &logger = Logger::get_instance();
8  logger.util_in(monolish_func);
9 
10  matrix::COO<T> mat(M, M);
11 
12  for (int i = 0; i < M; i++) {
13  mat.insert(i, i, 1.0);
14  }
15 
16  logger.util_out();
17 
18  return mat;
19 }
20 template matrix::COO<double> util::eye(const int M);
21 template matrix::COO<float> util::eye(const int M);
22 
23 } // namespace monolish
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::COO::insert
void insert(const size_t m, const size_t n, const Float val)
insert element to (m, n)
Definition: at_insert_sort_coo.cpp:30
monolish::Logger::util_out
void util_out()
Definition: logger_utils.cpp:123
monolish::util::eye
matrix::COO< T > eye(const int M)
create band matrix
Definition: eye.cpp:6
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::Logger::get_instance
static Logger & get_instance()
Definition: monolish_logger.hpp:42