0
我有矩陣Gx
和Gy
這兩種稀疏類型的coo。無法將稀疏矩陣轉換爲稠密矩陣
我執行以下操作他們:
A = np.hstack((Gx.transpose(),Gy.transpose()))
B = np.vstack((Gx,Gy))
L = np.dot(A,B)
我想以可視化的解決方案,C所以我使用C.toarray()和C.todense(),但得到的答覆是:
In [391]: C
Out[391]:
array([ <16x16 sparse matrix of type '<type 'numpy.float64'>'
with 64 stored elements in Compressed Sparse Row format>], dtype=object)
In [392]: C.toarray()
Traceback (most recent call last):
File "<ipython-input-390-86c90f8dce51>", line 1, in <module>
C.toarray()
AttributeError: 'numpy.ndarray' object has no attribute 'toarray'
我怎麼能看到矩陣C
密集形式?