[SciPy-user] Sparse matrix advice

Boris von Loesch boris@vonloesch...
Wed Nov 21 02:54:38 CST 2007


Hi Anand,

I use the COO-format for the creation of the matrix, because it could
be assembled quite fast. A second advantage is, that you need to
create the sparsity only the first time and then just create a vector
with the non-zero entries.
For calculations I convert it to CSR-Format, which is also quite fast.
With this method I can create a 255^2*255^2 sparse matrix with roughly
8 non-zero entries per row in about 0.25 sec. Creating the matrix in
LIL-format or DIC-format is a lot slower.

Best regards,
Boris

On Nov 21, 2007 12:30 AM, Anand Patil <anand.prabhakar.patil@gmail.com> wrote:
> Hi all,
>
> I'm looking for a 'row-ish' sparse matrix format that I can operate on
> (including making new nonzero elements) quickly in C++ or Pyrex. Could
> anyone recommend one?
>
> The LIL format looks nice because it can be expanded without any
> copying, but I'm worried that having to call PyList_GetItem (or
> whatever it is), inc/decreffing and converting from Python to C
> integers will take up a lot of time. PyTrilinos' Epetra looks pretty
> cool but I'm not sure how much distributed memory stuff I'll be doing
> and it would take me a long time to understand.
>
> I'm thinking that a good solution might be Pyrex wrappers for matrices
> represented as C++ vectors of rows, which are themselves vectors;
> would this actually be a good solution, and is anything like this out
> there already?
>
> I'm a total sparse linear algebra neophyte, so if I'm missing some
> boat entirely please help me get a clue.
>
> Many thanks in advance,
> Anand Patil
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-user mailing list