boost::ublas bindings ? (eigenvalues)

Hello, I'm looking for the boost::ublas bindings but I can't find them on the CVS or anywhere. Do you guys know where they are ? My goal is to compute eigenvalues from a matrix like the eig() function in matlab. The big picture is to implement the roots finding algorithm which uses eigenvalues... Thank you. Philippe

Nevermind I found them in the Sandbox. If someone still wants to help me on my eig() problem he's welcome ! :) Philippe

Philippe, The following code snippets might be helpful - I used singular value decomposition using lapack bindings to get eigenstuff. I don't know if it's the same thing as eig() in your case. ublas::matrix<double > A(rows, cols); ublas::matrix<double > ATA; ATA = prod(trans(A),A); ublas::matrix<double, boost::numeric::ublas::column_major > U(cols, cols), Vt(cols,cols); ublas::vector<double> S(cols); boost::numeric::bindings::lapack::gesvd(ATA, S, U, Vt); cout << U << endl << endl; cout << Vt << endl << endl; cout << S << endl << endl; HTH, Stjepan On 5/3/07, Philippe Vaucher <philippe.vaucher@gmail.com> wrote:
Nevermind I found them in the Sandbox. If someone still wants to help me on my eig() problem he's welcome ! :)
Philippe _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Stjepan Rajko wrote:
Philippe,
The following code snippets might be helpful - I used singular value decomposition using lapack bindings to get eigenstuff. I don't know if it's the same thing as eig() in your case.
ublas::matrix<double > A(rows, cols);
ublas::matrix<double > ATA; ATA = prod(trans(A),A);
ublas::matrix<double, boost::numeric::ublas::column_major > U(cols, cols), Vt(cols,cols); ublas::vector<double> S(cols); boost::numeric::bindings::lapack::gesvd(ATA, S, U, Vt);
cout << U << endl << endl; cout << Vt << endl << endl; cout << S << endl << endl;
It would be easier and more accurate to calculate the singular value decomposition of A itself, why bother with prod(trans(A),A) ? If you really do want to diagonalize prod(trans(A),A), a symmetric (and non-negative) matrix, the SVD is equivalent to an ordinary eigensolver and you would be better off using syev or syevr. Cheers, Ian
participants (3)
-
Ian McCulloch
-
Philippe Vaucher
-
Stjepan Rajko