Boost logo

Ublas :

Subject: Re: [ublas] request for sparse vector example
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2008-12-19 04:27:23

Jose schrieb:
> On Thu, Dec 18, 2008 at 11:23 PM, Gunter Winkler <guwi17_at_[hidden]> wrote:
>> However most time people try to use algorithm on (weighted) graphs
>> rather than sparse matrix computations ...
> Is there a performance advantage to use an algorithm on graphs rather
> than sparse matrix computations ?
Actually, the graph algorithms are use to speed up sparse matrix
computations. (Especially when you have more than one CPU ...). The idea
is to first compute the result symbolically and then only compute the
non zeros of the result.
This task is easy for a simply matrix-vector-multiplication, but more
complicated if you need factorizations of your matrix.

> Could you point at which algorithm I should use ?
> I assume you're saying that ublas might not be the best tool for the job!
uBLAS is definitely good enough to develop your algorithm and to have
some first results. But if you are looking for maximum performance, then
you have to write a lot of optimizations by yourself. Additionally the
choice of data structures has a very big impact on performance. If you
plan to have lots of very big dictonaries then it might be better to
build a custom data type and necessary operations.

(BTW. using -DNDEGUB -O3 or at least -DBOOST_UBLAS_NDEBUG helps a lot)

Another questions is: Are you vectors based on integer or boolean
values? For the latter one it makes no sense to use uBlas.