![]() You can leave a response, or trackback from your own site. You can follow any responses to this entry through the RSS 2.0 feed. This entry was posted on Sunday, March 28th, 2021 at 5:36 pm and is filed under code. ![]() Tags: find, matlab, numpy, python, scipy, sparse Rebuilding the sparse matrix directly from the CSC indices and indptr is also possible (i.e., avoiding the copy), but this version will happily work regardless of the original storage type of pyA. In scipy, you must explicitly specify the storage, for this example I’ll use CSC: = find(A) sparse is an attribute that you can assign to any two-dimensional MATLAB ® matrix that is composed of double or logical elements. Instead you can build a scipy sparse matrix directly. Using sparse matrices to store data that contains a large number of zero-valued elements can both save a significant amount of memory and speed up the processing of that data. PyA = py._matrix(full(A)) Ĭasting to full defeats the purpose of sparse storage. There is no built in support (AFAIK) for passing matlab sparse matrices to scipy sparse matrices.įor starters, don’t do this: A = sprandn(10000,10000,0.0001) Matlab has a (clunky) interface to python. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |