【问题标题】:Deepcopy of a Matrix SageMath矩阵 SageMath 的深拷贝
【发布时间】:2016-12-25 15:25:54
【问题描述】:

我正在 SageMath 中创建一个矩阵的深拷贝。

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

给我:

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

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

用细分深度复制矩阵的正确方法是什么?我必须使用:

B.subdivide(*A.subdivisions())

SageMath 7.2 版,发布日期:2016-05-15

【问题讨论】:

  • SageMath version 7.3, Release Date: 2016-08-04...

标签: python python-2.7 matrix deep-copy sage


【解决方案1】:

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

看来sage有自定义方法

__copy__

但不是自定义方法

__deepcopy__

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-12
    • 2015-01-13
    • 2011-09-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 1970-01-01
    相关资源
    最近更新 更多