import numpy as np import scipy.sparse as sp m = sp.lil_matrix((7329,7329)) np.save(path,m) #用numpy的load方法存储矩阵,path为存储的路径 mat = np.load(path)[()] #读取存储的矩阵,注意[()]这个符号可以抽取对象 mat = mat.toarray() #将稀疏矩阵转为稠密矩阵
import numpy as np import scipy.sparse as sp m = sp.lil_matrix((7329,7329)) np.save(path,m) #用numpy的load方法存储矩阵,path为存储的路径 mat = np.load(path)[()] #读取存储的矩阵,注意[()]这个符号可以抽取对象 mat = mat.toarray() #将稀疏矩阵转为稠密矩阵