|
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:
#define BOOST_UBLAS_NDEBUG
#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;
t.restart();
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);
ublas::axpy_prod(m1,m2,r,true);
std::cout << "Matrix mult. took " <<t.elapsed()<< "
s" << std::endl;
return 0;
}
The error I get in Xcode is: error: invalid use of incomplete type 'struct
boost::numeric::ublas::zero_matrix >'
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: http://boost.2283326.n4.nabble.com/a-problem-with-compressed-matrices-tp3757133p3757133.html Sent from the Boost - uBLAS mailing list archive at Nabble.com.