On 6/11/10 2:44 AM, William Stein wrote:
On Fri, Jun 11, 2010 at 12:19 AM, Jason Grout
<jason-s...@creativetrax.com> wrote:
On 6/11/10 1:50 AM, William Stein wrote:
Copy on write *should* be rather easy to implement for matrices at least.
William indicates otherwise in [1]. I can't think of an easy way to do it
either, so I'm really curious what how you think it would be easy.
Just out of curiosity, is this what would happen below with what you
guys are envisioning
for immutable copy on write matrices?
[snip]
I think the above would be very, very confusing to me. If immutable
matrices *act* as if they are fully mutable, but basically silently
have completely different semantics, this will be confusing.
I agree. I think my concerns would be taken care of if we just made the
top-level identity_matrix (and zero_matrix) function return a mutable matrix
(i.e., MM(1) or MM(0), rather than MM.one() or MM.zero())
I've posted a patch for doing this at
http://trac.sagemath.org/sage_trac/ticket/9212. It's ready for review.
Wait. Wasn't there a big discussion on sage-devel only maybe 3 months
ago which was
all about changing identity_matrix() to be *immutable*???
http://trac.sagemath.org/sage_trac/ticket/8276
Yes and no. That's the discussion I pulled your comment from (linked in
[1] below).
The discussion before was dealing with (if MM is a matrix space)
MM.one() and MM.zero() (and MM.identity_matrix()). It was decided that
MM(1) and MM(0) would stay mutable.
For someone that doesn't want to deal with creating a matrix space, but
just wants to create a matrix (think: student), having the *top-level*
identity_matrix function return MM(1) instead of MM.one() (i.e., mutable
matrix instead of immutable matrix) is very convenient. That is the
change that is in #9212. The same comment applies to the *top-level*
zero_matrix function.
Thanks,
Jason
Thanks,
Jason
[1]
http://groups.google.com/group/sage-devel/browse_frm/thread/1042edd11b3854b2
--
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
--
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