Great book! I learned a lot!
One note about this section: https://caam37830.github.io/book/02_linear_algebra/sparse.html#saving-and-loading-sparse-matrices
It says to load a Matrix Market file manually using NumPy's genfromtxt then reconstructing the triplets. It's probably better to introduce scipy.io.mmread which can read this format directly into a coo_matrix.
Note that a .mtx file can have anywhere from 1 to 4 columns (from dense array to coordinate complex) so the genfromtxt approach can be fragile.
For very large matrices I can selfishly recommend the fast_matrix_market package: https://pypi.org/project/fast-matrix-market/
Great book! I learned a lot!
One note about this section: https://caam37830.github.io/book/02_linear_algebra/sparse.html#saving-and-loading-sparse-matrices
It says to load a Matrix Market file manually using NumPy's
genfromtxtthen reconstructing the triplets. It's probably better to introducescipy.io.mmreadwhich can read this format directly into acoo_matrix.Note that a
.mtxfile can have anywhere from 1 to 4 columns (from densearraytocoordinatecomplex) so thegenfromtxtapproach can be fragile.For very large matrices I can selfishly recommend the fast_matrix_market package: https://pypi.org/project/fast-matrix-market/