KrisLibrary  1.0.0
QRDecomposition.h
1 #ifndef MATH_QR_DECOMPOSITION_H
2 #define MATH_QR_DECOMPOSITION_H
3 
4 #include "MatrixTemplate.h"
5 
6 namespace Math {
7 
32 template <class T>
34 {
35 public:
36  typedef MatrixTemplate<T> MatrixT;
37  typedef VectorTemplate<T> VectorT;
38  bool set(const MatrixT& A);
39  void backSub(const VectorT& x,VectorT& b) const;
40  void leastSquares(const VectorT& x,VectorT& b,VectorT& residual) const;
41  void QMul(const VectorT& b,VectorT& x) const;
42  void QtMul(const VectorT& b,VectorT& x) const;
43  void RBackSub(const VectorT& b,VectorT& x) const;
44  void getQ(MatrixT& Q) const;
45  void getR(MatrixT& R) const;
46 
47  MatrixT QR;
48  VectorT tau;
49 };
50 
55 template <class T>
57 {
58 public:
59  typedef MatrixTemplate<T> MatrixT;
60  typedef VectorTemplate<T> VectorT;
61  bool set(const MatrixT& A);
62  void backSub(const VectorT& x,VectorT& b) const;
63  void QBackSub(const VectorT& x,VectorT& b) const;
64  void getQ(MatrixT& Q) const;
65 
66  MatrixT QR;
67  VectorT c;
68  bool singular;
69 };
70 
71 } //namespace Math
72 
73 #endif
Calculates the QR decomposition.
Definition: QRDecomposition.h:33
The QR decomposition as computed by the algorithm in Numerical Recipes in C.
Definition: QRDecomposition.h:56
A matrix over the field T.
Definition: function.h:10
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12
A vector over the field T.
Definition: function.h:9