Hi Robert,

On 14 Feb., 18:26, Robert Bradshaw <[email protected]>
wrote:
> For some rings, copy might be able to use memcpy, where as zeroing it
> out might be a big loop. Really, there should be a method for getting
> a new empty matrix (which may or may not be all zeros) in the fastest
> way possible.


Well, there certainly is a method to get a new matrix:
  sage: MS = MatrixSpace(GF(2),5,5)
  sage: C = MS._MatrixSpace_generic__matrix_class
  sage: C.__new__(C,MS,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 0 0 0]

However, in contrast to what the example suggest, I reckon that
__new__ will, in general, not return a zero matrix.

But it is of course much faster than doing C(MS,0,0,0) or copying the
matrix.

Cheers,
Simon

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

Reply via email to