On Jan 31, 11:56 am, John H Palmieri <[email protected]> wrote:
> I'm having some issues with integer matrices.  I have a matrix mat:
>
> sage: mat
> 891 x 1559 sparse matrix over Integer Ring
> sage: mat.rank()  # this takes a long time
> sage.bin(75404,0xa06be720) malloc: *** mmap(size=447524864) failed
> (error code=12)
> *** error: can't allocate region
> *** set a breakpoint in malloc_error_break to debug
> ---------------------------------------------------------------------------
> PariError                                 Traceback (most recent call
> last)
> ...
> PariError: not enough memory (48)
>
> On the other hand:
>
> sage: mat.dense_matrix().rank()  # this is pretty quick
> 891
>
> Similarly for elementary divisors: the sparse case makes Sage crash:
>
> sage: mat.elementary_divisors()
> sage.bin(75404,0xa06be720) malloc: *** mmap(size=2097152) failed
> (error code=12)
> *** error: can't allocate region
> *** set a breakpoint in malloc_error_break to debug
> sage.bin(75404,0xa06be720) malloc: *** mmap(size=2097152) failed
> (error code=12)
> *** error: can't allocate region
> *** set a breakpoint in malloc_error_break to debug
>
> ------------------------------------------------------------
> Unhandled SIGBUS: A bus error occured in SAGE.
> This probably occured because a *compiled* component
> of SAGE has a bug in it (typically accessing invalid memory)
> or is not properly wrapped with _sig_on, _sig_off.
> You might want to run SAGE under gdb with 'sage -gdb' to debug this.
> SAGE will now terminate (sorry).
> ------------------------------------------------------------
>
> The dense case finishes successfully and pretty quickly.
>
> I've had some similar issues before; if you have a sparse matrix over
> the integers, it seems as though you should always convert it to a
> dense matrix before doing anything to it.  (This doesn't seem true
> over a field; rank works for both dense and sparse matrices, and at
> least for some sparse ones, rank is faster without converting.)
>
> Questions:
>
> 1. for anyone familiar with the code, do these observations make
> sense?  Is it sensible to convert sparse integer matrices to dense
> ones before doing anything else?

Well, if you have a truly large sparse matrix the conversion will
fail.

> 2. Are there any guidelines about how large a matrix Sage (or Pari)
> can handle without barfing?  For example, if I'm using a Mac with 2GB
> of memory, or if I'm using sage.math?

Pari seems rather inefficient when the above sparse matrix requires
more than 2GB Ram to compute. The sparse matrix code needs a good
cleanup anyway.

I think generally using dense representations to compute operations
like rank is a mistake even though it is substantially faster in the
cases you see. But I also think this discussion should happen on sage-
devel anyway.

Cheers,

Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to