Ask Your Question

kyticka's profile - activity

2018-06-17 09:31:03 -0500 received badge  Popular Question (source)
2017-01-01 12:05:56 -0500 commented answer Deepcopy of a Matrix SageMath

Link to this answer. provided at stackoverflow.

2017-01-01 11:51:31 -0500 commented answer Deepcopy of a Matrix SageMath

I am a bit new to both Sage and Python and __deepcopy__ seemed like the function I should use. But there is no advantage in using __deepcopy__ over __copy__ for me.

2017-01-01 11:43:08 -0500 received badge  Scholar (source)
2017-01-01 11:43:02 -0500 received badge  Supporter (source)
2017-01-01 09:28:01 -0500 received badge  Nice Question (source)
2017-01-01 08:53:39 -0500 received badge  Student (source)
2017-01-01 08:27:03 -0500 asked a question Deepcopy of a Matrix SageMath

I am creating a deepcopy of a Matrix in SageMath.

import copy
A = Matrix([[1,2],[3,4]]).augment(Matrix.identity(2), subdivide=True)
B = copy.deepcopy(A)
print A
print B

Gives me:

[1 2|1 0]
[3 4|0 1]

[1 2 1 0]
[3 4 0 1]

What is the correct way to deepcopy a matrix with the subdivision? Do I have to use:

B.subdivide(*A.subdivisions())

SageMath version 7.2, Release Date: 2016-05-15

I did not know about ask.sagemath before. This is a repost of stackoverflow .com /questions/41322359/deepcopy-of-a-matrix-sagemath (my karma is not enough to post links).