#8276: Make the one(), identity_matrix() and zero_matrix() cached and immutable.
------------------------------+---------------------------------------------
   Reporter:  hivert          |       Owner:  hivert           
       Type:  defect          |      Status:  needs_review     
   Priority:  major           |   Milestone:  sage-4.3.3       
  Component:  linear algebra  |    Keywords:  One Zero mutable.
     Author:  Florent Hivert  |    Upstream:  N/A              
   Reviewer:                  |      Merged:                   
Work_issues:                  |  
------------------------------+---------------------------------------------
Changes (by rossk):

  * keywords:  One mutable. => One Zero mutable.


Comment:

 I just have have a query now that Im looking at the ticket that someone
 may care to answer.
 I appreciate there may be implementation issues that differentiate the
 different constructs i.e.  M().zero() vs M(0) etc. But from a language
 point of view (i.e. not considering constructions vs coercions), why are
 the different matrices below treated differently i.e. why arent they all
 immutable)? Im just thinking that, for example, M().zero() and
 M().zero_matrix() and M(0) etc each return a zero matrix that cant be
 changed (either theres an error if its immutable or the assignment is
 ignored). So shouldnt they all be immutable? And why is there a variation
 in the mutability between the zero and identity matrices. (Apologies if
 there's something obvious I missed)

 {{{
 sage: MM(0).is_mutable()
 True
 sage: MM.zero_matrix().is_mutable()
 False
 sage: MM.zero().is_mutable()
 True

 sage: MM(1).is_mutable()
 True
 sage: MM.identity_matrix().is_mutable()
 False
 sage: MM.one().is_mutable()
 False
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8276#comment:16>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to