# Ublas :

From: Eddie Vedder (Eddie.Vedder_at_[hidden])
Date: 2005-12-22 03:25:12

Hello list,

my problem was ...

> > The matrix Q is represented as a product of elementary reflectors
> > Q = H(1) H(2) . . . H(k), where k = min(m,n).
> > Each H(i) has the form
> > H(i) = I - tau * v * v'
> > where tau is a real scalar, and v is a real vector with
> > v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i),
> > and tau in TAU(i).
> >

... because of your help I was successful. So for the archive I post the
solution:

ublas::identity_matrix<double> matI( k );
ublas::matrix<double> matV( k, 1 );
ublas::matrix<double> matVTrans;
ublas::matrix<double> matVProd;
ublas::matrix<double> matHProd( k, k );
matHProd = matI;
for ( unsigned i = 1; i <= k; i++ ) {
for ( unsigned iV = 1; iV <= m; iV++ ) {
if ( iV <= i-1 )
matV( iV-1, 0 ) = 0.0;
else if ( iV == i )
matV( iV-1, 0 ) = 1.0;
else if ( iV > i )
matV( iV-1, 0 ) = matAQR( iV-1, i-1 );
}
matVTrans = trans(matV); // v'
matVProd = prod( matV, matVTrans ); // v * v'
matVProd *= vecTau( i-1 ); // tau * v * v'
matVProd = matI - matVProd; // H(i) = I - tau * v * v'
matQ = prod( matHProd, matVProd );
matHProd = matQ;
} // endfor i

```--
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie
```