我试图在Python中实现复数的矩阵。但是我被困在程序的某个特定点上。我有两个模块Matrix.py,Complex.py和一个测试程序test.py.该模块实现在Github上在https://github.com/Soumya1234/Math_Repository/tree/dev_branch主办,我test.py下面Python中的矩阵实现
from Matrix import *
from Complex import *
C_init = Complex(2, 0)
print C_init
m1 = Matrix(2, 2, C_init)
m1.print_matrix()
C2= Complex(3, 3)
m1.addValue(1, 1, C2)//This is where all values of the matrix are getting
changed. But I want only the (1,1)th value to be changed to C2
m1.print_matrix()
中给出。在评论中提到,在Matrix.py中的addValue(个体经营,I,J)应该改变仅在第(i,j)位置处的值。那么为什么整个矩阵被替换?我做错了什么?
请不要引用外部代码的问题(这将让他们关闭),而不是发布最低工作例如这里。 –