|
Boost Users : |
Subject: [Boost-users] How to do svd for a complex matrix using ublas & lapack bindings?
From: Allen Chen (allen.chenal_at_[hidden])
Date: 2008-12-24 10:21:17
Hi,
Today I begin to learn to use boost ublas.
And I have successfully done svd for a real matrix. To do svd for a
complex matrix, I simply change codes from double to std::complex like
the following.
But it does not work.
#include <boost/numeric/bindings/lapack/gesdd.hpp>
#include<boost/numeric/bindings/traits/ublas_matrix.hpp>
#include<boost/numeric/bindings/traits/ublas_vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/vector.hpp>
int main()
{
using namespace boost::numeric::bindings::lapack;
using namespace boost::numeric::ublas;
matrix<std::complex<double>, column_major> A (4,2);
A(0,0)=std::complex<double>(2, 5);
A(0,1)=4;
A(1,0)=1;
A(1,1)=3;
A(2,0)=0;
A(2,1)=0;
A(3,0)=0;
A(3,1)=0;
std::cout << A << std::endl;
matrix<std::complex<double>, column_major> U(4,4);
matrix<std::complex<double>, column_major> V(2,2);
vector<std::complex<double>> S(2);
gesdd(A, S, U, V);
std::cout << U << std::endl;
std::cout << S << std::endl;
std::cout << V << std::endl;
return 0;
}
When compiles the program, MSVC8 will tell that it found no gesdd
method for complex type arguments.
Please help me.
Thanks
Allen
Boost-users 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