Changes between Version 1 and Version 4 of Ticket #8276


Ignore:
Timestamp:
02/17/10 09:56:32 (11 years ago)
Author:
hivert
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8276

    • Property Status changed from new to needs_review
  • Ticket #8276 – Description

    v1 v4  
    1313[0 0 1]
    1414}}}
     15
     16So here is now the current behavior:
     17{{{
     18sage: MM = MatrixSpace(ZZ, 3,3)
     19sage: MM(0).is_mutable()
     20True
     21sage: MM.zero_matrix().is_mutable()
     22False
     23sage: MM(1).is_mutable()
     24True
     25sage: MM.identity_matrix().is_mutable()
     26False
     27}}}
     28Note that calling {{{MM(0)}}} or {{{MM(1)}}} is a bad idea:
     29{{{
     30sage: timeit("MM(0)")
     31625 loops, best of 3: 72.4 µs per loop
     32sage: timeit("copy(MM.zero_matrix())")
     33625 loops, best of 3: 15.6 µs per loop
     34}}}
     35And for identity:
     36{{{
     37sage: timeit("MM(1)")
     38625 loops, best of 3: 67.4 µs per loop
     39sage: timeit("copy(MM.identity_matrix())")
     40625 loops, best of 3: 41.1 µs per loop
     41}}}