Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Read Matrix Market withfast_matrix_market#391

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
eriknw merged 22 commits intopython-graphblas:mainfromeriknw:fast-matrix-market
Mar 22, 2023

Conversation

@eriknw
Copy link
Member

@eriknweriknw commentedFeb 18, 2023
edited
Loading

Closes#384.

This usesfast_matrix_market (which lookspretty fast) by default if available, but will fall back toscipy if necessary.scipy is still necessary to be installed even if using "fast_matrix_market" engine.

There were three small issues I encountered that I plan to raise upstream, but I was able to work around them.

TODO:

@coveralls
Copy link

coveralls commentedFeb 18, 2023
edited
Loading

Coverage Status

Changes unknown
when pullingd9ceebc on eriknw:fast-matrix-market
into ** on python-graphblas:main**.

@eriknw
Copy link
MemberAuthor

CC ,@alugowskifast-matrix-market works pretty well as a near-drop-in replacement forscipy.io.mmread, and I'm really happy to improve the user experience around MM files--thanks! I had to work around a fewtiny differences, which wasn't that difficult, so these aren't that important:

@alugowski, when writing Matrix Market files, do you recommend passing scipy CSR or CSC matrices instead of COO? I'm curious whetherfmm or SuiteSparse:GraphBLAS would handle this faster.

Comment on lines 553 to 555
if_output_type(A)is_Vector:
indices,values=A.to_coo(sort=False)
s=COO(indices,values,shape=A.shape)
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

btw@SultanOrazbayev I just special-casedVector into_pydata_sparse, b/c previously it was creating a(1, n)-shaped sparse array from a Vector instead of a(n,)-shaped array.

SultanOrazbayev reacted with thumbs up emoji

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Oops, sorry about that!

Copy link
Member

@SultanOrazbayevSultanOrazbayev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks great,@eriknw !

eriknw reacted with thumbs up emoji
Comment on lines +671 to +677
try:
fromfast_matrix_marketimportmmwrite# noqa: F811
exceptImportError:# pragma: no cover (import)
ifengine!="auto":
raiseImportError(
"fast_matrix_market is required to write Matrix Market files "
f'using the "{engine}" engine'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Not sure to what extent DRY principle is useful here, but perhaps there is scope for generalising this check for suitable import as some utility function (as a separate PR).

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm open to such a PR :)

You may notice that my style sometimes doesn't adhere to DRY for small, straightforward (to me) things, but I suspect there are cases where things could be improved.

@eriknw
Copy link
MemberAuthor

Thanks for reviewing@SultanOrazbayev!

I just finished the final TODO for this PR--I added documentation toio.rst.

SultanOrazbayev reacted with hooray emoji

@eriknweriknw merged commit4920dc8 intopython-graphblas:mainMar 22, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@SultanOrazbayevSultanOrazbayevSultanOrazbayev approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Option to read MatrixMarket withfast_matrix_market

3 participants

@eriknw@coveralls@SultanOrazbayev

[8]ページ先頭

©2009-2025 Movatter.jp