monolish  0.17.3-dev.16
MONOlithic LInear equation Solvers for Highly-parallel architecture
monolish_generalized_eigen.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <omp.h>
3 #include <vector>
4 
5 #include "./monolish_solver.hpp"
7 
8 namespace monolish {
12 namespace generalized_eigen {
13 
39 template <typename MATRIX, typename Float>
40 class LOBPCG : public solver::solver<MATRIX, Float> {
41 private:
42  // TODO: support multiple lambda(eigenvalue)s
43  [[nodiscard]] int monolish_LOBPCG(MATRIX &A, MATRIX &B, vector<Float> &lambda,
44  matrix::Dense<Float> &x, int itype);
45 
46 public:
47  [[nodiscard]] int solve(MATRIX &A, MATRIX &B, vector<Float> &lambda,
48  matrix::Dense<Float> &x, int itype);
49 
50  void create_precond(MATRIX &A) {
51  throw std::runtime_error("this precond. is not impl.");
52  }
53 
55  throw std::runtime_error("this precond. is not impl.");
56  }
57 
65  [[nodiscard]] std::string name() const {
66  return "monolish::generalized_eigen::LOBPCG";
67  }
68 
76  [[nodiscard]] std::string solver_name() const { return "LOBPCG"; }
77 };
100 template <typename MATRIX, typename Float>
101 class DC : public solver::solver<MATRIX, Float> {
102 private:
103  [[nodiscard]] int LAPACK_DC(MATRIX &A, MATRIX &B, vector<Float> &lambda,
104  int itype);
105 
106 public:
107  [[nodiscard]] int solve(MATRIX &A, MATRIX &B, vector<Float> &lambda,
108  int itype);
109 
110  void create_precond(MATRIX &A) {
111  throw std::runtime_error("this precond. is not impl.");
112  }
113 
115  throw std::runtime_error("this precond. is not impl.");
116  }
117 
125  [[nodiscard]] std::string name() const {
126  return "monolish::generalized_eigen::DC";
127  }
128 
136  [[nodiscard]] std::string solver_name() const { return "DC"; }
137 };
139 } // namespace generalized_eigen
140 } // namespace monolish
Dense format Matrix.
void apply_precond(const vector< Float > &r, vector< Float > &z)
int solve(MATRIX &A, MATRIX &B, vector< Float > &lambda, matrix::Dense< Float > &x, int itype)
std::string name() const
get solver name "monolish::generalized_eigen::DC"
std::string name() const
get solver name "monolish::generalized_eigen::LOBPCG"
int monolish_LOBPCG(MATRIX &A, MATRIX &B, vector< Float > &lambda, matrix::Dense< Float > &x, int itype)
std::string solver_name() const
get solver name "LOBPCG"
void apply_precond(const vector< Float > &r, vector< Float > &z)
int solve(MATRIX &A, MATRIX &B, vector< Float > &lambda, int itype)
int LAPACK_DC(MATRIX &A, MATRIX &B, vector< Float > &lambda, int itype)
std::string solver_name() const
get solver name "DC"
monolish namespaces