Last 2 dimensions of the array must be square

这个报错是因为我们在求解行列式的值的时候使用了:

np.linalg.det(D)

但是D必须是方阵才可以进行运算,不是方阵则会报错,我们把之前的行列式更改为方阵就不会再报错了,当然这也是numpy自身计算数值的一个缺陷。

posted @ 2019-07-05 10:56  Geeksongs  阅读(2845)  评论(0编辑  收藏  举报

Coded by Geeksongs on Linux

All rights reserved, no one is allowed to pirate or use the document for other purposes.