Boost logo

Ublas :

Subject: Re: [ublas] problem regards to using boost binding library for svd in lapack under vc 9.0
From: Jianshu Zhang (sago_vinson_at_[hidden])
Date: 2009-04-22 07:41:01


Hi, Thomas,

Thanks for your guide. Now the svd works for me now.

However, there is one thing confused me. The following codes will give an assertion fail until I specify the svd function to gesdd('A',A, S, U, V) or gesdd(A, S). Therefore I'm confused by the jobz option. Can somebody simply explain about the "O","N","A","S" option?

#define BOOST_NUMERIC_BINDINGS_USE_CLAPACK
//#define BIND_FORTRAN_LOWERCASE_UNDERSCORE

#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>
#include <boost/numeric/ublas/io.hpp>
#include <iostream>
#include <complex>

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>(1, 2);
A(0,1)=std::complex<double>(3, 4);
A(1,0)=std::complex<double>(5, 6);
A(1,1)=std::complex<double>(7, 8);
A(2,0)=std::complex<double>(9, 10);
A(2,1)=std::complex<double>(11, 12);
A(3,0)=std::complex<double>(13, 14);
A(3,1)=std::complex<double>(15, 16);

std::cout << A << std::endl;

matrix<std::complex<double>, column_major> U(4,4);
matrix<std::complex<double>, column_major> V(2,2);
vector<double> S(2);

gesdd(A, S, U, V);
//gesdd(A, S);

std::cout << U << std::endl;
std::cout << S << std::endl;
std::cout << V << std::endl;
std::cin.get();
return 0;
}

BRs,

_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx