Mercurial > octave
diff liboctave/dbleQR.h @ 9713:7918eb15040c
refactor the QR classes onto a templated base
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 12 Oct 2009 10:42:49 +0200 |
parents | d865363208d6 |
children | 4c0cdbe0acca |
line wrap: on
line diff
--- a/liboctave/dbleQR.h Sun Oct 11 15:27:51 2009 -0700 +++ b/liboctave/dbleQR.h Mon Oct 12 10:42:49 2009 +0200 @@ -30,47 +30,31 @@ #include "dMatrix.h" #include "dColVector.h" #include "dRowVector.h" +#include "base-qr.h" class OCTAVE_API -QR +QR : public base_qr<Matrix> { public: - enum type - { - std, - raw, - economy - }; + // Import them here to allow the QR:: prefix. + typedef qr_type_t type; - QR (void) : q (), r () { } - - QR (const Matrix&, QR::type = QR::std); + static const type std = qr_type_std; + static const type raw = qr_type_raw; + static const type economy = qr_type_economy; - QR (const Matrix& q, const Matrix& r); - - QR (const QR& a) : q (a.q), r (a.r) { } + QR (void) : base_qr<Matrix> () { } - QR& operator = (const QR& a) - { - if (this != &a) - { - q = a.q; - r = a.r; - } - return *this; - } + QR (const Matrix&, qr_type_t = qr_type_std); - ~QR (void) { } - - void init (const Matrix&, QR::type); + QR (const Matrix& qx, const Matrix& rx) + : base_qr<Matrix> (qx, rx) { } - Matrix Q (void) const { return q; } + QR (const QR& a) : base_qr<Matrix> (a) { } - Matrix R (void) const { return r; } - - QR::type get_type (void) const; + void init (const Matrix&, qr_type_t); void update (const ColumnVector& u, const ColumnVector& v); @@ -90,21 +74,12 @@ void shift_cols (octave_idx_type i, octave_idx_type j); - friend std::ostream& operator << (std::ostream&, const QR&); - protected: void form (octave_idx_type n, Matrix& afact, - double *tau, QR::type qr_type); - - Matrix q; - Matrix r; + double *tau, qr_type_t qr_type); }; -#ifndef HAVE_QRUPDATE -void warn_qrupdate_once (void); -#endif - #endif /*