Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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).