import scipy as s import scipy.sparse as ss from scipy.sparse.construct import eye as speye import scipy.sparse.linalg as ssl......A = ss.kron(Ay, speye(nx)) + ss.kron(speye(ny), Ax)这个“coo”稀疏形式矩阵,就是存一个坐标带一个值的那种如 ...... (2382, 2223) -64.0 (2382, 2381) -64.0 (2382, 2382) 256.0 (2382, 2383) -64.0 (2383, 2224) -64.0 (2383, 2382) -64.0 (2383, 2383) 256.0 (2383, 2384) -64.0 (2384, 2225) -64.0 (2384, 2383) -64.0 (2384, 2384) 256.0 如何对A求逆呢? 这是A的value [[ <2385x2385 sparse matrix of type '<type 'numpy.float64'>'with 11577 stored elements in Compressed Sparse Row format>]] 我尝试了一下 scipy.sprase.linalg.inv(A),发现根本行不通:AttributeError: 'matrix' object has no attribute 'format' 查了一下http://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.inv.html#scipy.sparse.linalg.inv发现貌似A可以使稀疏矩阵格式才对,我现在是搞不懂了,matlab能简单实现的稀疏矩阵求逆python会不行吗?求各位大佬帮我看看[source] |