Ask Your Question

kyticka's profile - activity

2022-04-02 04:29:30 +0200 received badge  Famous Question (source)
2020-05-18 07:57:04 +0200 received badge  Notable Question (source)
2018-06-17 16:31:03 +0200 received badge  Popular Question (source)
2017-01-01 19:05:56 +0200 commented answer Deepcopy of a Matrix SageMath

Link to this answer. provided at stackoverflow.

2017-01-01 18:51:31 +0200 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 18:43:08 +0200 received badge  Scholar (source)
2017-01-01 18:43:02 +0200 received badge  Supporter (source)
2017-01-01 16:28:01 +0200 received badge  Nice Question (source)
2017-01-01 15:53:39 +0200 received badge  Student (source)
2017-01-01 15:27:03 +0200 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).