TDecompQRH - how to use the householder decomposition?

Hi,

I want to use ROOT to decompose a general (mxn) matrix via householder transformations. (m > n)

I have an object QRH of the type TDecompQRH initialised with a Matrix A that I want to decompose. I do:

QRH->Decompose()

and make sure it suceeded.
After that I took a look at the stored matrices Q and R and especially QR which looks quite different from the initial A. A had strict band structure and only positive elements, QR is a lot more entries, of which quite some are negative.

Looking at the header of TDecompQRH I found this as the only documentation on the class:

[quote]Decompose a general (m x n) matrix A into A = fQ fR H where

fQ : (m x n) - orthogonal matrix
fR : (n x n) - upper triangular matrix
H : HouseHolder matrix which is stored through
fUp: (n) - vector with Householder up’s
fW : (n) - vector with Householder beta’s
[/quote]

and a reference to a paper I don’t have accessible, which would probably explain the documentation…

Now what is H? After all I read about the QR decomposition of a matrix one should have a series of householder matrices Q_i forming a final matrix Q and, in addition, the upper triang. matrix R.

I have built H from fUp and fW but can’t make any sense out of it. Is there anything else to do?

Thanks for any hints…

Hi Felix,

I guess you are asking for how to reconstruct the orginal
matrix from the decomposed results . This has been
implemented in most classes from TDecompBase through
the procedure “GetMatrix” but is missing in TDecompQRH .

I will see if I can get that coded .

The reference you mention (Golub & Loan) is standard linear
algebra book :

referenced [url]
amazon.com/Computations-Hopk … 431&sr=8-1

[/url]

Eddy

First of all, thank you for your answer.

Wwhat I did was just a consistency check. I wanted to see if the decomposed result gives back the original matrix, like A = QR or A = QRH suggests to be able to better understand why I do not get the results I expect.

Thanks for the link, but unfortunately I can"t get my hands on that book fast enough. What I need is a A = QR decomposition of a mxn matrix - can TDecompQRH do that for me? I do not understand the role of H. A quick fundamental comment would help very much I think.

Felix,

It is about 4 years ago that I coded this class and I will have to refresh
my memory about the storage of the decomposed elements .

You might get a hint from the Solve routine, where the
results are used to solve the Ax=b equation .

In particular take a look at the lines :

   for (Int_t k = 0; k < nQ; k++) {
      const TVectorD qc_k = TMatrixDColumn_const(fQ,k);
      ApplyHouseHolder(qc_k,fUp(k),fW(k),k,k+1,b);
   }

which hints at the calculation of the Q_i matrices .

Again, I hope I can get a GetMatrix routine coded that
will make the role of the different elements more clear .

Eddy

Thank you for your fast answers!

I’ll try to dig through the code and see if I can find out where the true and final decomposition is stored until I get the right Q and R for my calculations.

Tanks again,

Felix

Ok, I solved it. :smiley:

In principle my code was right all the time (writing a fitter here…) but unstable. A significant raise in the data density solved my issue. I just had a hard time bugfixing without any output, I am not a big fan of blackboxes of any sort :slight_smile:

Anyway, thank you for your time and have a nice… uhm… morning in NY :slight_smile: