Go to the documentation of this file.00001
00002
00003
00004 #ifndef sparseqrDriver_hh
00005 #define sparseqrDriver_hh
00006
00007 #include <memory>
00008 #include "basics/typedefs.hh"
00009 #include "operator/compositions.hh"
00010 #include "operator/sparseMatrix.hh"
00011 #include "operator/permutation.hh"
00012 #include "sparseqr/sparseqr.hh"
00013 #include "sparseqr/givensRotations.hh"
00014
00015 using concepts::Real;
00016
00017 namespace sparseqr {
00018
00019
00020
00032 class Driver : concepts::Operator<Real> {
00033 public:
00039 Driver(const concepts::SparseMatrix<Real>& A)
00040 : concepts::Operator<Real>(A.dimY(), A.dimX())
00041 , rank_(0), A_(A), computed_(false)
00042 , Prow_(0), Pcol_(0), Q_(0), Qt_(0), restr_(0), ext_(0)
00043 , prow_(0), pcol_(0), qr_(0) {}
00044 virtual ~Driver();
00046 concepts::Permutation<Real>* Prow();
00048 concepts::Permutation<Real>* Pcol();
00050 sparseqr::GivensRotations<Real>* Q();
00052 sparseqr::GivensRotations<Real>* Qt();
00054 concepts::TrivExtendRestrict<Real>* restriction();
00056 concepts::TrivExtendRestrict<Real>* extension();
00058 inline int rank();
00059
00060 virtual void operator()(const concepts::Function<Real>& fncY,
00061 concepts::Function<Real>& fncX);
00062 void operator()(const concepts::Vector<Real>& fncY,
00063 concepts::Vector<Real>& fncX);
00064 protected:
00065 virtual std::ostream& info(std::ostream& os) const;
00066 private:
00067 void compute_();
00068 int rank_;
00069 const concepts::SparseMatrix<Real>& A_;
00070 bool computed_;
00071 std::auto_ptr<concepts::Permutation<Real> > Prow_, Pcol_;
00072 std::auto_ptr<sparseqr::GivensRotations<Real> > Q_, Qt_;
00073 std::auto_ptr<concepts::TrivExtendRestrict<Real> > restr_, ext_;
00074 concepts::Array<int> prow_, pcol_;
00075 std::auto_ptr<QR> qr_;
00076 sparseqr::Qmatrix q_;
00077 };
00078
00079 int Driver::rank() {
00080 if (!computed_) compute_();
00081 return rank_;
00082 }
00083
00084 }
00085
00086 #endif // sparseqrDriver_hh