18 double a[] = {12, -51, 4, 6, 167, -68, -4, 24, -41};
22 std::cout <<
"initial matrox A " << std::endl;
30 std::cout <<
"Orthogonal Q matrix " << std::endl;
36 std::cout <<
"Upper Triangular R matrix " << std::endl;
37 auto R = decomp.
GetR();
45 std::cout <<
"Computed A matrix from Q * R " << std::endl;
48 for (
int i = 0; i <
A.GetNrows(); ++i) {
49 for (
int j = 0; j <
A.GetNcols(); ++j) {
51 Error(
"decomposeQR",
"Reconstrate matrix is not equal to the original : %f different than %f",compA(i,j),
A(i,j));
60 for (
int i = 0; i <
Q.GetNrows(); ++i) {
61 for (
int j = 0; j <
Q.GetNcols(); ++j) {
64 Error(
"decomposeQR",
"Q matrix is not orthogonal ");
#define R(a, b, c, d, e, f, g, h, i)
void Error(const char *location, const char *msgfmt,...)
virtual const TMatrixD & GetR()
TMatrixD GetOrthogonalMatrix() const
For a matrix A(m,n), return the OtrhogonalMatrix Q such as A = Q * R.
virtual Bool_t Decompose()
QR decomposition of matrix a by Householder transformations, see Golub & Loan first edition p41 & Sec...
void Print(Option_t *name="") const
Print the matrix as a table of elements.
Bool_t AreEqualAbs(Double_t af, Double_t bf, Double_t epsilon)