Deepcopy of a Matrix SageMath

378 views Asked by At

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

1

There are 1 answers

0
kyticka On BEST ANSWER

Answer by tmonteil at https://ask.sagemath.org/question/36134/deepcopy-of-a-matrix-sagemath/?answer=36137#post-id-36137

It seems that sage has a custom method

__copy__

but not a custom method

__deepcopy__