Boost logo

Ublas :

Subject: Re: [ublas] Eigenvalues & -vectors
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-07-05 09:15:59

Am 05.07.2010 um 00:26 schrieb Thomas Klimpel:

> Kraus Philipp wrote:
>> I have looked at the example for the dsyev call under[snip]
>> Can I call boost syev in the same way?
> I probably misunderstand this question. You can use exactly the same
> argument list as in this MKL example when you replace "dsyev" by
> "LAPACK_DSYEV", but what would be the point of using the bindings
> then?
>> I want to calculate for an arbitrary square matrix the
>> eigenvectors and -values (like the Matlab command [SNIP]).
>> Do I understand the steps in the correct order?
>> 1. I create a lower bounded matrix of my sqaured matrix
>> 2. I call the boost command syev with the bounded matrix

> matrix_type A(n,n);
> // fill the lower triangle of A with the correct values
> //...
> std::vector<double> w(n);
> bindings::lapack::syev('V', bindings::lower(A), w); // writing
> "Vectors" instead of 'V' won't work here, sorry for that :(

I think there was a little mistake, because "lower" means, that the
values must be filled into the upper triangle.
My little code snip:

ublas::matrix<double, ublas::column_major> x(3,3);

x(0,0) = 1;
x(1,0) = 2;
x(1,1) = 2;
x(2,0) = 3;
x(2,1) = 3;
x(2,2) = 4;
std::cout << x << std::endl;

ublas::vector<T> l(3);
lapack::syev( 'V', bindings::symm(bindings::upper(x)), l );

returns in l the values (4,2,1) if I set bindings::lower the return
values are (-0.870495,-.143348,8.01384)
Matlab returns for the same matrix (4,2,1)

Thanks for help.


P.S.: In my next step I must create the triangle from a squared matrix