Boost logo

Ublas :

Subject: [ublas] a problem with compressed matrices
From: Tarek (physics.reality_at_[hidden])
Date: 2011-08-20 10:27:09

I noticed that the function axpy_prod() in ublas has a problem when used in
release mode with compressed sparse matrices, see yourself:

#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/operation.hpp>

namespace ublas = boost::numeric::ublas;
#include <boost/timer.hpp>
int main()
    boost::timer t;

    ublas::compressed_matrix<double> m1(700,700,0);
    ublas::compressed_matrix<double> m2(700,700,0);
    ublas::compressed_matrix<double> r(700,700,0);
    //r= prod(m1,m2);
    std::cout << "Matrix mult. took " <&lt;t.elapsed()&lt;&lt; &quot;
s&quot; &lt;&lt; std::endl;

    return 0;

The error I get in Xcode is: error: invalid use of incomplete type 'struct
boost::numeric::ublas::zero_matrix &gt;'

I noticed also that prod() is faster than axpy_prod for both dense and
sparse matrices contrary to what is advertised!! You can check that too in
the same code. Actually it seems to me that the matrix is not treated as
sparse at all, since multiplication of all-zero sparse matrices should take
no time. In debug mode, it takes 20 second on my computer !!

View this message in context:
Sent from the Boost - uBLAS mailing list archive at