
Boost Users : 
From: Lorenzo Bolla (bolla_at_[hidden])
Date: 20040408 11:28:15
seeing the dimension of your matrix, the easiest way to do that is:
1. compute z = X^T y: z is 5 x 1
2. compute A = X^T X with prod (trans (X), X): A is 5 x 5
3. use LAPACK to solve: A a = z (5 x 5 linear system)
ublas::solve only works for particular types of matrices (for example,
triangular matrices  upper or lower...  like the tag...).
regards,
lorenzo.
On Thu, Apr 08, 2004 at 04:36:17PM +0100, Russell Hind wrote:
> Angus Leeming wrote:
> >
> >X is 500x5
> >trans(X) is 5x500
> >prod(trans(X),X) is 5x5, which is a square matrix. So, yes, it can be
> >inverted (all other requirements assumed satisfied...). And if it's
> >5x5 the lu_ functions are perfect. In fact, you could probably invert
> >it by hand ;)
> >
>
> Is there no method in ublas that can invert it? I haven't done matrices
> for years, and don't have any docs on doing it.
>
> The initial problem I'm trying to solve is
>
> a = (X^T X)^1 X^T y
>
> where y is a 500 row vector and X is the 500 x 5 matrix. But I can't
> use lu_* with the compiler/boost version I have.
>
> ublas::solve says it does A^1 * b but what is the tag parameter passed
> to it? It can be lower_tag or upper_tag but I can't find what these
> mean in the docs, or the difference between them or which I should be using.
>
> Thanks
>
> Russell
>
> _______________________________________________
> Boostusers mailing list
> Boostusers_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boostusers
 CH3  N / \ NC C==O       CH C NCH3 \ / \ / N C   CH3 O
Boostusers list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net