3

I'm having trouble finding the eigenvalues of a boost matrix using the boost LAPACK bindings. This is my best guess:

template<class T>
boost::numeric::ublas::vector<double> diagonalize(const boost::numeric::ublas::matrix<T>& input)
{
    // create a working copy of the input
    boost::numeric::ublas::banded_matrix<T,boost::numeric::ublas::column_major> A(input);

    fortran_int_t n = input.size1();

    // Calculate tridiagonal form
    boost::numeric::ublas::vector<double> d(n);     //diagonal elements of tridiagonal matrix
    boost::numeric::ublas::vector<double> e(n-1);   //offdiagonal elements of tridiagonal matrix
    boost::numeric::ublas::vector<T> tau(n-1);  //other stuff
    boost::numeric::bindings::lapack::hetrd( A, d, e, tau );

    //Calculate eigenvalues
    boost::numeric::bindings::lapack::sterf(n,d,e);

    return d;
}

where the compilation fails with:

boost/numeric/bindings/detail/property_map.hpp:30: error: no type named 'property_map' in 'struct 
 boost::numeric::bindings::detail::adaptor_access<boost::numeric::ublas::banded_matrix<std::complex<double>, 
boost::numeric::ublas::basic_column_major<long unsigned int, long int>,
boost::numeric::ublas::unbounded_array<std::complex<double>, 
std::allocator<std::complex<double> > > >, void> 

I know I'm probably messing up matrix types here but the compiler error leaves me a little helpless and I can't find any examples on the web.

jgauffin
  • 99,844
  • 45
  • 235
  • 372
  • Have you included `bindings/ublas/vector_proxy.hpp`? – talonmies Apr 03 '12 at 05:08
  • Thank you for your reply. In fact I hadn't, but inclusion didn't change anything. I guess one needs to use a [triangular matrix](http://www.boost.org/doc/libs/1_35_0/libs/numeric/ublas/doc/triangular.htm) as input to `hetrd` but then I ran into some other compiler error. I ended up using the [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page) library instead, pretty unsatisfying (the solution, not Eigen) – Johannes Ferber Apr 04 '12 at 09:11

0 Answers0