Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-02-13 09:24:54


Am Dienstag, 13. Februar 2007 00:28 schrieb
Richard_Harding_at_[hidden]:
> Hello,
>
> I have a very sparse matrix (<= 6 nnz entries per row with
> potentially thousands of columns) which I need to pre-multiply by its
> transpose in order to solve the normal equations associated with a
> least-squares computation: (A'A)x = A'b. I may have missed them, but

Don't do this - trust me ;-)

in order to solve the least squares problem you do a QR-decomposition of
A and get the cholesky decomposition of A'A for free:

A = QR -> A'A = (QR)'QR = R'Q'QR= R'R

> I did not find any built-in matrix-transpose-matrix or
> matrix-transpose-vector operations in uBLAS.

you can call prod(trans(A), A) or even sparse_prod(trans(A), A) (from
operation_sparse.hpp)

mfg
Gunter