Hi Simon,

> There are ways to create an empty matrix from scratch, whithout
> calling zero_matrix first (namely by calling the matrix class). 

Well, it's not very straight-forward, but I agree there is a way (which I 
didn't think of before)

sage: from sage.matrix.matrix_mod2_dense import Matrix_mod2_dense
sage: MS = MatrixSpace(GF(2),64000,64000)
sage: A = Matrix_mod2_dense(MS,None,True,True)

Btw. the speed argument does not seem to hold true for dense over GF(2):

sage: MS = MatrixSpace(GF(2),10000,10000)
sage: %timeit A = Matrix_mod2_dense(MS,None,True,True)
125 loops, best of 3: 2.25 ms per loop
sage: %timeit _ = copy(A)
125 loops, best of 3: 6.37 ms per loop

Which makes sense because we always return a zero matrix when we allocate in 
M4RI, so copy() is alloc + memcpy while just creating it is just an alloc.

I guess one approach could be a class attribute which determines whether a 
cache should be used or not (i.e. by type). Another one would decide based on  
some dimension (I don't know which since that depends on the implementation 
heavily).

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to