DP3
LLSSolver.h
Go to the documentation of this file.
1 // Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy)
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 
4 #ifndef DDECAL_LLS_SOLVER_H
5 #define DDECAL_LLS_SOLVER_H
6 
7 #include <complex>
8 #include <memory>
9 #include <utility>
10 #include <vector>
11 
12 namespace dp3 {
13 namespace ddecal {
14 
19 
25 class LLSSolver {
26  public:
27  using complex = std::complex<float>;
28  LLSSolver(int m, int n, int nrhs) : m_(m), n_(n), nrhs_(nrhs) {}
29 
30  virtual ~LLSSolver() {}
31 
32  virtual bool Solve(complex* a, complex* b) = 0;
33  virtual bool Solve(complex* a, complex* b,
34  [[maybe_unused]] complex* initial_value) {
35  return Solve(a, b);
36  } // can use initial guess x
37 
38  static std::unique_ptr<LLSSolver> Make(LLSSolverType lss_type, int m, int n,
39  int nrhs);
40 
41  static LLSSolverType ParseType(const std::string& solver);
42 
43  protected:
44  int m_; // number of rows in matrix A
45  int n_; // number of columns in matrix A
46  int nrhs_; // number of columns in vector b
47 };
48 
49 } // namespace ddecal
50 } // namespace dp3
51 
52 #endif
Definition: LLSSolver.h:25
virtual bool Solve(complex *a, complex *b, [[maybe_unused]] complex *initial_value)
Definition: LLSSolver.h:33
LLSSolver(int m, int n, int nrhs)
Definition: LLSSolver.h:28
int m_
Definition: LLSSolver.h:44
int n_
Definition: LLSSolver.h:45
virtual ~LLSSolver()
Definition: LLSSolver.h:30
int nrhs_
Definition: LLSSolver.h:46
static std::unique_ptr< LLSSolver > Make(LLSSolverType lss_type, int m, int n, int nrhs)
static LLSSolverType ParseType(const std::string &solver)
virtual bool Solve(complex *a, complex *b)=0
std::complex< float > complex
Definition: LLSSolver.h:27
LLSSolverType
Definition: LLSSolver.h:18
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53