September 29, 2020 How to work with and load/save sparse compressed matrices? (numir, mir.sparse) | ||||
---|---|---|---|---|
| ||||
I wish to use load / save for sparse compressed matrices using mir. import mir.sparse; auto sp = sparse!double(5, 8); auto crs = sp.compress; How can I save/load sparse compressed arrays in `npz` format? (format: ``csc``, ``csr``, ``bsr``, ``dia`` or coo``) how can i again decompress the compressed sparse array to dense? Thanks Shaleen |
October 05, 2020 Re: How to work with and load/save sparse compressed matrices? (numir, mir.sparse) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shaleen Chhabra | On Tuesday, 29 September 2020 at 04:52:11 UTC, Shaleen Chhabra wrote: > I wish to use load / save for sparse compressed matrices using mir. > > import mir.sparse; > auto sp = sparse!double(5, 8); > auto crs = sp.compress; > > > How can I save/load sparse compressed arrays in `npz` format? > (format: ``csc``, ``csr``, ``bsr``, ``dia`` or coo``) Mir doesn't have I/O support for sparse tensors for now. > how can i again decompress the compressed sparse array to dense? // http://mir-algorithm.libmir.org/mir_ndslice_allocation.html#.slice import mir.ndslice.allocation: slice; // for DOK: auto dense = slice(sp); For crs you may need to iterate with byCoordinateValue http://mir.libmir.org/mir_sparse.html#.byCoordinateValue and initialize the dense slice. To estimate the raw length one may need to iterate all rows and get the maximum of the last element indices. > Thanks > Shaleen |
Copyright © 1999-2021 by the D Language Foundation