On 4/19/07, Jeff Allotta <[EMAIL PROTECTED]> wrote:
> Thanks for the quick response.  The dict method should definitely be a
> help in general, but I have a couple more questions about this.
>
> After trying some things, I've noticed that it is possible to coerce a
> flat list into a sparse matrix but not a list of lists.
>
> E.G.
> sage: B = MatrixSpace(ZZ,5,5)
> sage: v = [0 for i in range(25)]
> sage: u = [[0 for i in range(5)] for j in range(5)]
> sage: B(v)
> [0 0 0 0 0]
> [0 0 0 0 0]
> [0 0 0 0 0]
> [0 0 0 0 0]
> [0 0 0 0 0]
>
> sage: B(u) ---> results in the same error as before.
> Is there a conceptual reason that a flat list works, but a list of

That looks like just a mistake on our paper.  We should make
it so both cases work.  I've made this trac 352
   http://www.sagemath.org:9002/sage_trac/ticket/352

> Also, is there some idea of how much is saved by using sparse
> matrices?

It depends on how sparse they are.  A sparse 100000 x 100000
matrix with only 3 nonzero entries will take almost no space.  A
dense matrix of the same size will take more memory than your
computer has.

>  Or is it just a result of programming convenience?

Sparse matrices can easily be slower, but they can take
vastly less memory.  Sometimes working with them can be
faster too, especially if they are very sparse.





-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://www.williamstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to