pseudo inverse of sparse matrix in python

后端 未结 2 1289
天涯浪人
天涯浪人 2021-02-15 17:46

I am working with data from neuroimaging and because of the large amount of data, I would like to use sparse matrices for my code (scipy.sparse.lil_matrix or csr_matrix).

<
2条回答
  •  爱一瞬间的悲伤
    2021-02-15 18:20

    Regardless of the answer to my comment, I would think you could accomplish this fairly easily using the Moore-Penrose SVD representation. Find the SVD with scipy.sparse.linalg.svds, replace Sigma by its pseudoinverse, and then multiply V*Sigma_pi*U' to find the pseudoinverse of your original matrix.

提交回复
热议问题