Boost logo

Ublas :

Subject: [ublas] Bindings traits: tag::matrix_type is not defined for ublas::matrix
From: Manuel Gonzalez (iinmgc00_at_[hidden])
Date: 2012-06-26 05:47:22


Hello,

I am using the traits system in the current version of the numeric bindings, in
particular the tag "boost::numeric::bindings::tag::matrix_type" which can take
the following values:

boost::numeric::bindings::tag::general
boost::numeric::bindings::tag::triangular
boost::numeric::bindings::tag::symmetric
boost::numeric::bindings::tag::hermitian
boost::numeric::bindings::tag::band

I have found that this tag is not defined for ublas::matrix, and I think it
should be defined with value "general".

This test program shows the problem:

--- START CODE ---

#define BOOST_ALL_NO_LIB
#include <boost/numeric/bindings/tag.hpp>
#include <boost/numeric/bindings/ublas/matrix.hpp>
#include <boost/numeric/bindings/ublas/matrix_sparse.hpp>

typedef boost::numeric::ublas::matrix<double> test_type;
//typedef boost::numeric::ublas::compressed_matrix<double> test_type;
//typedef boost::numeric::ublas::coordinate_matrix<double> test_type;

void foo(const boost::numeric::bindings::tag::general& tag) { }

int main(void) {
        boost::numeric::bindings::detail::property_at< test_type,
boost::numeric::bindings::tag::matrix_type >::type prop;
        foo(prop);
        return 0;
}

--- END CODE ---

The linker stops due to an error because "prop" has type 'boost::mpl::void_'.
Uncommenting the typedefs show that the tag "matrix_type" is correctly defined
as "general" for sparse matrices.

To correct the problem, the following line:

        mpl::pair< tag::matrix_type, tag::general >,
                
should be included between lines 36 and 37 in file
"boost/numeric/bindings/ublas/matrix.hpp".

Best regards,
Manuel