Hi,

I expect rows(copy=True) to return me a fresh copy every time I request it.
It looks like copy=True/False doesn't matter and every time I get a kind of 
reference to internal cached rows of the Matrix, while the Matrix itself is 
always left untouched.

See an example:


X=Matrix([[1, 2], [3, 4]])
print "\nX:\n", str(X)
A=X.rows(copy=False)
A[1][1]=5
print "\nA (from X.rows(copy=False)):\n", str(A)
print "\nX.rows(copy=True):\n", str(X.rows(copy=True))
print "\nX.rows(copy=False):\n", str(X.rows(copy=False))
print "\nX:\n", str(X)
B=X.rows(copy=True)
B[1][0]=6
print "\nB (from X.rows(copy=True)):\n", str(B)
print "\nX.rows(copy=True):\n", str(X.rows(copy=True))
print "\nX.rows(copy=False):\n", str(X.rows(copy=False))
print "\nX:\n", str(X)


X:
[1 2]
[3 4]

A (from X.rows(copy=False)):
[(1, 2), (3, 5)]

X.rows(copy=True):
[(1, 2), (3, 5)]

X.rows(copy=False):
[(1, 2), (3, 5)]

X: # how comes X wasn't modified itself?
[1 2]
[3 4]

B (from X.rows(copy=True)):
[(1, 2), (6, 5)]

X.rows(copy=True): # Why I don't get a fresh copy?
[(1, 2), (6, 5)]

X.rows(copy=False): # B was a copy, why original rows are modified?
[(1, 2), (6, 5)]

X: # how comes X wasn't modified itself then?
[1 2]
[3 4]


the code is there:
http://aleph.sagemath.org/?q=knhqgv

Phil

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to