此代码适用于使用矩阵的高斯消除,我无法理解屏幕上出现以下错误的原因。
def elimGauss(A,m,n):
for k in range(n-1):
for i in range(k+1,n):
p = -A[i][k] / (A[k][k])
for j in range(k,n):
if (k == j):
A[i][j] = 0
else:
A[i][j] = A[i][j] + (p * A[k][j])
错误是:
Traceback (most recent call last):
File "C:/Users/Solange/Desktop/Trabajo Final Fund. Programacion - Eliminacion Gauss.py", line 42, in <module>
elimGauss(M,3,3)
File "C:/Users/Solange/Desktop/Trabajo Final Fund. Programacion - Eliminacion Gauss.py", line 29, in elimGauss
p = -A[i][k] / (A[k][k])
TypeError: 'NoneType' object is not subscriptable