|
Ublas : |
Subject: [ublas] [bindings] How to use lapack::pbtrf?
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2010-07-27 17:20:51
Hello!
I'm here again :P
Sorry for stressing, but this time I'm unable to use PBTRF (Cholesky
factorization for symmetric/hermitian matrices).
Specifically, I have a symmetric matrix, for instance:
ublas::symmetric_matrix<double,ublas::lower,ublas::column_major> A
If I call PBTRF:
bindings::lapack::pbtrf(A)
I get compiler errors like these ones:
--- [error] ---
boost-numeric_bindings/boost/numeric/bindings/lapack/computational/pbtrf.hpp:125:
error: no match for operator>= in
boost::numeric::bindings::bandwidth [with T =
boost::numeric::ublas::symmetric_matrix<double,
boost::numeric::ublas::basic_lower<long unsigned int>,
boost::numeric::ublas::basic_column_major<long unsigned int, long
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >, Tag =
boost::numeric::bindings::tag::lower](((const
boost::numeric::ublas::symmetric_matrix<double,
boost::numeric::ublas::basic_lower<long unsigned int>,
boost::numeric::ublas::basic_column_major<long unsigned int, long
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >&)((const
boost::numeric::ublas::symmetric_matrix<double,
boost::numeric::ublas::basic_lower<long unsigned int>,
boost::numeric::ublas::basic_column_major<long unsigned int, long
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >*)ab)),
(boost::numeric::bindings::lapack::pbtrf_impl<Value>::invoke(MatrixAB&)
[with MatrixAB = boost::numeric::ublas::symmetric_matrix<double,
boost::numeric::ublas::basic_lower<long unsigned int>,
boost::numeric::ublas::basic_column_major<long unsigned int, long
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >, Value = double]::uplo(),
boost::numeric::bindings::lapack::pbtrf_impl<Value>::invoke(MatrixAB&)
[with MatrixAB = boost::numeric::ublas::symmetric_matrix<double,
boost::numeric::ublas::basic_lower<long unsigned int>,
boost::numeric::ublas::basic_column_major<long unsigned int, long
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >, Value = double]::uplo())) >= 0
/usr/include/boost/mpl/assert.hpp:126: note: candidates are: char (&
mpl_::operator>=(mpl_::assert_, mpl_::assert_))[4]
boost-numeric_bindings/boost/numeric/bindings/lapack/computational/pbtrf.hpp:155:
instantiated from ptrdiff_t
boost::numeric::bindings::lapack::pbtrf(MatrixAB&) [with MatrixAB =
boost::numeric::ublas::symmetric_matrix<double,
boost::numeric::ublas::basic_lower<long unsigned int>,
boost::numeric::ublas::basic_column_major<long unsigned int, long
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >]
--- [/error] ---
The failing assertion is (pbtrf.hpp - line: 125):
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
Looking inside bindings/ublas/symmetric.hpp I didn't find the
"tag::bandwidth" property.
So, I've tried several alternative solutions like
* dense matrix + symmetric_adaptor
* banded_matrix
* dense matrix + banded_adaptor
I've also tried to copy the "tag::bandwidth" property definition from
bindings/ublas/banded.hpp into bindings/ublas/symmetric.hpp
mpl::pair< tag::bandwidth_type<1>, std::ptrdiff_t >,
mpl::pair< tag::bandwidth_type<2>, std::ptrdiff_t >
and effectively that assertion stop to fail. But unfortunately what
fails is now the assertion at line 127
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
bindings::stride_minor(ab) == 1 );
Where I'm wrong?
Thank you very much for the help!!
Cheers,
-- Marco