I agree, the best is to speed up matrices at all, instead of creating a
dangerous hack, just to speed up 2x2 Matrices.

Further I think it's natural to inherit (most) matrix classes from
Matrix, so this should not be changed.

bg,
Johannes

On 11.01.2013 21:47, Nils Bruin wrote:
> sage/matrix$ grep _mutability *.pxd
> matrix0.pxd:    cdef sage.structure.mutability.Mutability _mutability
> matrix0.pxd:    cdef check_mutability(self)
> matrix0.pxd:    cdef check_bounds_and_mutability(self, Py_ssize_t i,
> Py_ssize_t j)
> matrix0.pxd:    cdef check_row_bounds_and_mutability(self, Py_ssize_t
> r1, Py_ssize_t r2)
> matrix0.pxd:    cdef check_column_bounds_and_mutability(self,
> Py_ssize_t c1, Py_ssize_t c2)
> 
> so if you change that to
> 
> cdef bint _mutability
> 
> you probably only have to amend those 4 routines. Further attribute
> access:
> 
> sage/matrix$ grep \\._mutability *.pyx | wc
>      20      69    1235
> 
> in matrix0.pyx these are just the lines in the functions above and the
> remaining 9 lines are in a handful of special matrix implementations
> and of the form
> 
>    if self._mutability._is_immutable:
> 
> which aren't really adhering to protocol (accessing private
> attributes! twice!), but are easily rewritten (to faster code anyway!)
> 
> I thinks it's entirely doable to just make _mutability a straight
> boolean flag. Does anyone have reasons why this is not a good idea?
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to