| tqrfunc.h - numeric - C++ library with numerical algorithms | |
| git clone git://src.adamsgaard.dk/numeric | |
| Log | |
| Files | |
| Refs | |
| LICENSE | |
| --- | |
| tqrfunc.h (821B) | |
| --- | |
| 1 // Make sure header is only included once | |
| 2 #ifndef QRFUNC_H_ | |
| 3 #define QRFUNC_H_ | |
| 4 | |
| 5 #include <armadillo> | |
| 6 #include "header.h" | |
| 7 | |
| 8 // QR structure | |
| 9 class QR { | |
| 10 private: | |
| 11 // System size | |
| 12 const Lengthtype n; | |
| 13 | |
| 14 public: | |
| 15 //// Data | |
| 16 | |
| 17 // Input data | |
| 18 arma::mat A; | |
| 19 | |
| 20 // QR decomposition matrices | |
| 21 arma::mat Q; | |
| 22 arma::mat R; | |
| 23 | |
| 24 //// Prototype functions | |
| 25 | |
| 26 // Constructor prototype | |
| 27 QR(arma::mat &A); | |
| 28 | |
| 29 // Destructor | |
| 30 ~QR(); | |
| 31 | |
| 32 // Return system size | |
| 33 Lengthtype size(); | |
| 34 | |
| 35 // QR decomposition of Armadillo matrix A, returning R | |
| 36 // and modified A (=Q) | |
| 37 void decomp(); | |
| 38 | |
| 39 // Backsubstitution of triangular system | |
| 40 arma::vec backsub(arma::vec &b); | |
| 41 | |
| 42 // Absolute value of the determinant of matrix R | |
| 43 Floattype det(); | |
| 44 | |
| 45 // Inverse of matrix A | |
| 46 arma::mat inverse(); | |
| 47 }; | |
| 48 | |
| 49 #endif |