Boost logo

Ublas :

Subject: Re: [ublas] a problem with compressed matrices
From: Ungermann, Jörn (j.ungermann_at_[hidden])
Date: 2011-08-23 09:01:48


Hi Tarek,

sorry, your mail does not contain enough information to see what's wrong. In the least, I'd need to have a very short program exhibiting the error, compile command and the version of boost you are using.

If you are looking for speed, it depends on which operation should be fast. Compressed_matrix<> times vector is reasonably fast with ublas. For basically everything else involving dense matrices (ublas::matrix<>), one should rely on some numerical backend such as ATLAS and call this via the boost::numerical_bindings.

If you are not yet commited to one solution, you might want to have a look at Eigen, which is very fast for dense matrices but offers only alpha support for sparse matrices.

Again, depends on your use case. To my knowledge, there is currently no silver bullet C++ linear algebra solution.

Regards,
Joern

> -----Original Message-----
> From: ublas-bounces_at_[hidden] [mailto:ublas-
> bounces_at_[hidden]] On Behalf Of Tarek
> Sent: Dienstag, 23. August 2011 13:22
> To: ublas_at_[hidden]
> Subject: Re: [ublas] a problem with compressed matrices
>
> Dear Joern,
> Thanks a lot for your reply. I tried to use sparse_prod, but I always
> get
> the following error, though I include the file:
> &lt;boost/numeric/ublas/operation_sparse.hpp&gt;
> error: no matching function for call to
> ‚'sparse_prod(boost::numeric::ublas::matrix<double>&,
> boost::numeric::ublas::matrix<double>&)’
>
>
> As for axpy_prod, it works fine in release mode (twice as fast as prod)
> when
> used for matrix-vector multiplication. For matrix-matrix multiplication
> however, it yields the following error:
>
> /usr/include/boost/numeric/ublas/operation.hpp: In function ‚'M&
> boost::numeric::ublas::axpy_prod(const
> boost::numeric::ublas::matrix_expression<E2>&, const
> boost::numeric::ublas::matrix_expression<E2>&, M&, bool) [with M =
> boost::numeric::ublas::compressed_matrix&lt;std::complex&lt;double&gt;
> >, E1
> = boost::numeric::ublas::matrix_binary_scalar1<const double,
> boost::numeric::ublas::compressed_matrix<std::complex<double> >,
> boost::numeric::ublas::scalar_multiplies&lt;double,
> std::complex&lt;double&gt; > >, E2 =
> boost::numeric::ublas::compressed_matrix&lt;std::complex&lt;double&gt;
> >]’:
> main.cpp:203:45: instantiated from here
> /usr/include/boost/numeric/ublas/operation.hpp:719:13: error: invalid
> use of
> incomplete type ‚'struct
> boost::numeric::ublas::zero_matrix&lt;std::complex&lt;double&gt;,
> std::allocator&lt;std::complex&lt;double&gt; > >‚'
> /usr/include/boost/numeric/ublas/fwd.hpp:132:11: error: declaration of
> ‘struct
> boost::numeric::ublas::zero_matrix&lt;std::complex&lt;double&gt;,
> std::allocator&lt;std::complex&lt;double&gt; > >‚'
>
>
> I noticed that Mathematica works much faster than uBlas programs, are
> you
> aware of other libraries that can do the multiplication faster than
> axpy_prod ?
>
>
> --
> View this message in context: http://boost.2283326.n4.nabble.com/a-
> problem-with-compressed-matrices-tp3757133p3762462.html
> Sent from the Boost - uBLAS mailing list archive at Nabble.com.
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: j.ungermann_at_[hidden]