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

Addmatrix.power to compute e.g.A @ A @ A @ ...#483

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 8 commits intopython-graphblas:mainfromeriknw:power
Jul 26, 2023

Conversation

@eriknw
Copy link
Member

This uses#481 (and is actually why I made#481).

I still need to write the docstring.

I tried to make this efficient by performing repeated squaring. For example, forA.power(8), this will compute:

cur=op(A @A).new()cur<<op(cur @cur)updater<<op(cur @cur)

This makes the implementation a little... uh... not obvious, but it works well.

A.power(n) returns anexpression so mask can be applied. Even if a mask is used, an intermediate resultA.power(n // 2) can still be pretty large--we only apply the mask on the very last matrix multiply.

I decided to requiren to be a positive integer.n == 0 could return "the" identity, but what would be the identity for different semirings?

This method will let us easily and efficiently implementnumber_of_walks ingraphblas_algorithms.

@eriknweriknw added the featureSomething is missing labelJul 16, 2023
@coveralls
Copy link

coveralls commentedJul 16, 2023
edited
Loading

Coverage Status

coverage: 99.414% (+0.2%) from 99.206% when pulling60a1d44 on eriknw:power into3476731 on python-graphblas:main.

@eriknweriknw merged commit8e42ded intopython-graphblas:mainJul 26, 2023
@eriknweriknw mentioned this pull requestNov 4, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jim22kjim22kjim22k approved these changes

Assignees

No one assigned

Labels

featureSomething is missing

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@eriknw@coveralls@jim22k

[8]ページ先頭

©2009-2025 Movatter.jp