driver.hh

Go to the documentation of this file.
1 
6 #ifndef sparseqrDriver_hh
7 #define sparseqrDriver_hh
8 
9 #include <memory>
10 #include "basics/typedefs.hh"
11 #include "operator/compositions.hh"
12 #include "operator/sparseMatrix.hh"
13 #include "operator/permutation.hh"
14 #include "sparseqr/sparseqr.hh"
16 
17 using concepts::Real;
18 
19 namespace sparseqr {
20 
21  // **************************************************************** Driver **
22 
34  class Driver : concepts::Operator<Real> {
35  public:
42  : concepts::Operator<Real>(A.dimY(), A.dimX())
43  , rank_(0), A_(A), computed_(false)
44  , Prow_(nullptr), Pcol_(nullptr), Q_(nullptr), Qt_(nullptr), restr_(nullptr), ext_(nullptr)
45  , prow_(0), pcol_(0), qr_(nullptr) {}
46  virtual ~Driver();
60  inline int rank();
61 
62  virtual void operator()(const concepts::Function<Real>& fncY,
66  protected:
67  virtual std::ostream& info(std::ostream& os) const;
68  private:
69  void compute_();
70  int rank_;
72  bool computed_;
73  std::unique_ptr<concepts::Permutation<Real> > Prow_, Pcol_;
74  std::unique_ptr<sparseqr::GivensRotations<Real> > Q_, Qt_;
75  std::unique_ptr<concepts::TrivExtendRestrict<Real> > restr_, ext_;
77  std::unique_ptr<QR> qr_;
79  };
80 
81  int Driver::rank() {
82  if (!computed_) compute_();
83  return rank_;
84  }
85 
86 } // namespace sparseqr
87 
88 #endif // sparseqrDriver_hh
sparseqr::GivensRotations< Real > * Q()
Returns .
bool computed_
Definition: driver.hh:72
virtual std::ostream & info(std::ostream &os) const
concepts::Permutation< Real > * Prow()
Returns .
Operator(uint dimX, uint dimY)
Definition: compositions.hh:51
concepts::Array< int > prow_
Definition: driver.hh:76
std::unique_ptr< concepts::Permutation< Real > > Pcol_
Definition: driver.hh:73
concepts::TrivExtendRestrict< Real > * restriction()
Returns the restriction from n to the last n-r degrees of freedom.
virtual const uint dimX() const
Returns the size of the image space of the operator (number of rows of the corresponding matrix)
Definition: compositions.hh:93
std::unique_ptr< QR > qr_
Definition: driver.hh:77
std::unique_ptr< sparseqr::GivensRotations< Real > > Q_
Definition: driver.hh:74
concepts::Permutation< Real > * Pcol()
Returns .
Driver(const concepts::SparseMatrix< Real > &A)
Constructor.
Definition: driver.hh:41
SparseQR solver.
Definition: driver.hh:19
void operator()(const concepts::Vector< Real > &fncY, concepts::Vector< Real > &fncX)
std::unique_ptr< concepts::TrivExtendRestrict< Real > > restr_
Definition: driver.hh:75
sparseqr::Qmatrix q_
Definition: driver.hh:78
std::unique_ptr< concepts::TrivExtendRestrict< Real > > ext_
Definition: driver.hh:75
int rank()
Returns the rank of the matrix.
Definition: driver.hh:81
std::unique_ptr< concepts::Permutation< Real > > Prow_
Definition: driver.hh:73
Abstract class for an operator.
Definition: ARPACK.hh:16
sparseqr::GivensRotations< Real > * Qt()
Returns .
Driver class for sparse QR decomposition.
Definition: driver.hh:34
concepts::TrivExtendRestrict< Real > * extension()
Returns the extension from the last n-r to n degrees of freedom.
virtual ~Driver()
concepts::Array< int > pcol_
Definition: driver.hh:76
virtual void operator()(const concepts::Function< Real > &fncY, concepts::Function< Real > &fncX)
std::unique_ptr< sparseqr::GivensRotations< Real > > Qt_
Definition: driver.hh:74
virtual const uint dimY() const
Returns the size of the source space of the operator (number of columns of the corresponding matrix)
Definition: compositions.hh:98
const concepts::SparseMatrix< Real > & A_
Definition: driver.hh:71
Q matrix of the QR factorization.
Definition: sparseqr.hh:96
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich