monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
frank.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::frank_matrix(const int &M) {
7  Logger &logger = Logger::get_instance();
8  logger.util_in(monolish_func);
9 
10  matrix::COO<T> mat(M, M);
11  for (int i = 0; i < M; ++i) {
12  for (int j = 0; j < M; ++j) {
13  T val = M - std::max(i, j);
14  mat.insert(i, j, val);
15  }
16  }
17 
18  logger.util_out();
19 
20  return mat;
21 }
22 template matrix::COO<double> util::frank_matrix(const int &M);
23 template matrix::COO<float> util::frank_matrix(const int &M);
24 
25 template <typename T>
26 T util::frank_matrix_eigenvalue(const int &M, const int &N) {
27  T exact_result =
28  1.0 /
29  (2.0 * (1.0 - std::cos(M_PI * (2 * (M - N + 1) + 1) / (2 * M + 1))));
30  return exact_result;
31 }
32 template double util::frank_matrix_eigenvalue(const int &M, const int &N);
33 template float util::frank_matrix_eigenvalue(const int &M, const int &N);
34 
35 } // namespace monolish
monolish_func
#define monolish_func
Definition: monolish_logger.hpp:9
monolish::util::frank_matrix
matrix::COO< T > frank_matrix(const int &M)
create Frank matrix
Definition: frank.cpp:6
monolish::Logger
logger class (singleton, for developper class)
Definition: monolish_logger.hpp:19
monolish::vml::max
void max(const matrix::CRS< double > &A, const matrix::CRS< double > &B, matrix::CRS< double > &C)
Create a new CRS matrix with greatest elements of two matrices (C[0:nnz] = max(A[0:nnz],...
Definition: matrix_vml.cpp:382
monolish::util::frank_matrix_eigenvalue
T frank_matrix_eigenvalue(const int &M, const int &N)
Nth eigenvalue from the bottom of MxM Frank matrix.
Definition: frank.cpp:26
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::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