17 double a[] = {12, -51, 4, 6, 167, -68, -4, 24, -41};
21 std::cout <<
"initial matrox A " << std::endl;
29 std::cout <<
"Orthogonal Q matrix " << std::endl;
35 std::cout <<
"Upper Triangular R matrix " << std::endl;
36 auto R = decomp.
GetR();
44 std::cout <<
"Computed A matrix from Q * R " << std::endl;
47 for (
int i = 0; i < A.
GetNrows(); ++i) {
48 for (
int j = 0; j < A.
GetNcols(); ++j) {
50 Error(
"decomposeQR",
"Reconstrate matrix is not equal to the original : %f different than %f",compA(i,j),A(i,j));
59 for (
int i = 0; i < Q.GetNrows(); ++i) {
60 for (
int j = 0; j < Q.GetNcols(); ++j) {
63 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,...)
Use this function in case an error occurred.
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)