Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for I/O of standard formats #763

Open
perazz opened this issue Jan 16, 2024 · 10 comments
Open

Support for I/O of standard formats #763

perazz opened this issue Jan 16, 2024 · 10 comments
Assignees
Labels
idea Proposition of an idea and opening an issue to discuss it specification Discussion and iteration over the API

Comments

@perazz
Copy link
Contributor

perazz commented Jan 16, 2024

Motivation

As linear algebra support develops, it would be useful to have simple interfaces to access test matrices to/from standard formats into the stdlib formats.

Prior Art

Additional Information

cc #749
cc #486
cc @minhqdao

@perazz perazz added idea Proposition of an idea and opening an issue to discuss it specification Discussion and iteration over the API labels Jan 16, 2024
@jalvesz
Copy link
Contributor

jalvesz commented Jan 16, 2024

For reference, the SciPy IO API: https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.mmwrite.html#scipy.io.mmwrite
the TACO library also offers an API of the sorts for C++ and Python: http://tensor-compiler.org/docs/scientific_computing.html

@ivan-pi
Copy link
Member

ivan-pi commented Jan 17, 2024

I've added #486 which is also relevant. I would be keen to have the SciPy .npz format supported, which is also used to pass sparse matrices.

@ivan-pi
Copy link
Member

ivan-pi commented Jan 17, 2024

the TACO library also offers an API of the sorts for C++ and Python: http://tensor-compiler.org/docs/scientific_computing.html

The formats supported by TACO are:

@ivan-pi
Copy link
Member

ivan-pi commented Jan 17, 2024

There is also a naive text format that MATLAB uses, described under

I've used it in the past, to quickly output a matrix and import it into MATLAB for inspection (spy) and calculating the spectral radius.

@jalvesz
Copy link
Contributor

jalvesz commented Jan 17, 2024

I've also used the same format locally to then use matplotlib's spy https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.spy.html
So basically take whichever sparse format > transform to COO > dump a file <name>.dat

@ivan-pi
Copy link
Member

ivan-pi commented Jan 17, 2024

Can we use the MatrixMarket routines from NIST (potentially, wrapped in a nicer interface)? Or should we do a clean-room design and implementation?

@jalvesz
Copy link
Contributor

jalvesz commented Jan 17, 2024

It could be good to have them for comparison, but it could be the occasion to make a clean-room design.
Maybe decided on the style for the signature of IO procedures, this could already enable focusing on individual implementations that should respect the decided signature.

I had in mind something like this:

subroutine matrix_<save/load>_<format>( matrix_type , file_name , ...optionals... )
end subroutine

@jvdp1
Copy link
Member

jvdp1 commented Jan 17, 2024

Can we use the MatrixMarket routines from NIST (potentially, wrapped in a nicer interface)?

If their licenses permit it, I would say yes. It might be good to contact them, before using their codes (e.g., like it was done for the hash and some sort procedures).

@perazz
Copy link
Contributor Author

perazz commented Jan 22, 2024

I will ask @minhqdao if he plans to take care of this issue.

@minhqdao minhqdao self-assigned this Jan 22, 2024
@minhqdao
Copy link
Contributor

Thanks, @perazz, for opening this issue and all of you for your input and adding the references. I'll take care of it over the next few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Proposition of an idea and opening an issue to discuss it specification Discussion and iteration over the API
Projects
None yet
Development

No branches or pull requests

5 participants