monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
DC.cpp
Go to the documentation of this file.
1 #include "../../include/monolish_blas.hpp"
2 #include "../../include/monolish_eigen.hpp"
3 #include "../internal/lapack/monolish_lapack.hpp"
4 #include "../internal/monolish_internal.hpp"
5 
6 namespace monolish {
7 
8 template <typename MATRIX, typename T>
9 int standard_eigen::DC<MATRIX, T>::LAPACK_DC(MATRIX &A, vector<T> &lambda) {
10  int ret = MONOLISH_SOLVER_SUCCESS;
11  Logger &logger = Logger::get_instance();
12  logger.solver_in(monolish_func);
13 
14  const char jobz = 'V';
15  const char uplo = 'U';
16 
17  int info = internal::lapack::syevd(A, lambda, &jobz, &uplo);
18  if (info > 0) {
20  } else if (info < 0) {
22  }
23 
24  logger.solver_out();
25  return ret;
26 }
27 
28 template int standard_eigen::DC<matrix::Dense<double>, double>::LAPACK_DC(
29  matrix::Dense<double> &A, vector<double> &lambda);
30 template int standard_eigen::DC<matrix::Dense<float>, float>::LAPACK_DC(
31  matrix::Dense<float> &A, vector<float> &lambda);
32 
33 template <typename MATRIX, typename T>
34 int standard_eigen::DC<MATRIX, T>::solve(MATRIX &A, vector<T> &lambda) {
35  Logger &logger = Logger::get_instance();
36  logger.solver_in(monolish_func);
37 
38  int ret = 0;
39  if (this->get_lib() == 0) {
40  ret = LAPACK_DC(A, lambda);
41  }
42 
43  logger.solver_out();
44  return ret; // err code
45 }
46 
47 template int standard_eigen::DC<matrix::Dense<double>, double>::solve(
48  matrix::Dense<double> &A, vector<double> &lambda);
49 template int
50 standard_eigen::DC<matrix::Dense<float>, float>::solve(matrix::Dense<float> &A,
51  vector<float> &x);
52 
53 template <typename MATRIX, typename T>
54 int generalized_eigen::DC<MATRIX, T>::LAPACK_DC(MATRIX &A, MATRIX &B,
55  vector<T> &lambda, int itype) {
56  int ret = MONOLISH_SOLVER_SUCCESS;
57  Logger &logger = Logger::get_instance();
58  logger.solver_in(monolish_func);
59 
60  const char jobz = 'V';
61  const char uplo = 'U';
62 
63  int info = internal::lapack::sygvd(A, B, lambda, itype, &jobz, &uplo);
64  if (info > 0) {
66  } else if (info < 0) {
68  }
69 
70  logger.solver_out();
71  return ret;
72 }
73 
74 template int generalized_eigen::DC<matrix::Dense<double>, double>::LAPACK_DC(
75  matrix::Dense<double> &A, matrix::Dense<double> &B, vector<double> &lambda,
76  int itype);
77 template int generalized_eigen::DC<matrix::Dense<float>, float>::LAPACK_DC(
78  matrix::Dense<float> &A, matrix::Dense<float> &B, vector<float> &lambda,
79  int itype);
80 
81 template <typename MATRIX, typename T>
82 int generalized_eigen::DC<MATRIX, T>::solve(MATRIX &A, MATRIX &B,
83  vector<T> &lambda, int itype) {
84  Logger &logger = Logger::get_instance();
85  logger.solver_in(monolish_func);
86 
87  int ret = 0;
88  if (this->get_lib() == 0) {
89  ret = LAPACK_DC(A, B, lambda, itype);
90  }
91 
92  logger.solver_out();
93  return ret; // err code
94 }
95 
96 template int generalized_eigen::DC<matrix::Dense<double>, double>::solve(
97  matrix::Dense<double> &A, matrix::Dense<double> &B, vector<double> &lambda,
98  int itype);
99 template int generalized_eigen::DC<matrix::Dense<float>, float>::solve(
100  matrix::Dense<float> &A, matrix::Dense<float> &B, vector<float> &lambda,
101  int itype);
102 
103 } // namespace monolish
monolish_func
#define monolish_func
Definition: monolish_logger.hpp:9
monolish::standard_eigen::DC::LAPACK_DC
int LAPACK_DC(MATRIX &A, vector< Float > &lambda)
monolish::generalized_eigen::DC::LAPACK_DC
int LAPACK_DC(MATRIX &A, MATRIX &B, vector< Float > &lambda, int itype)
monolish::standard_eigen::DC::solve
int solve(MATRIX &A, vector< Float > &lambda)
MONOLISH_SOLVER_SUCCESS
#define MONOLISH_SOLVER_SUCCESS
Definition: monolish_common.hpp:10
MONOLISH_SOLVER_BREAKDOWN
#define MONOLISH_SOLVER_BREAKDOWN
Definition: monolish_common.hpp:13
monolish
Definition: monolish_matrix_blas.hpp:9
monolish::generalized_eigen::DC::solve
int solve(MATRIX &A, MATRIX &B, vector< Float > &lambda, int itype)
MONOLISH_SOLVER_RESIDUAL_NAN
#define MONOLISH_SOLVER_RESIDUAL_NAN
Definition: monolish_common.hpp:14
monolish::Logger::get_instance
static Logger & get_instance()
Definition: monolish_logger.hpp:42