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

Aggressive constprop in istriu/istril for structured matrices #54437

Merged
merged 1 commit into from May 12, 2024

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented May 10, 2024

This makes the following evaluate at compile-time:

julia> U = UpperTriangular(rand(2,2));

julia> @code_typed istriu(U)
CodeInfo(
1return true
) => Bool

Also, this reduces latency in this operation:

julia> @time (U -> istriu(U))(U)
  0.069995 seconds (158.88 k allocations: 8.715 MiB, 83.72% compilation time) # nightly
  0.035610 seconds (156.62 k allocations: 8.594 MiB, 68.18% compilation time) # This PR

Similar methods are annotated for other structured matrix types, where the results may be trivially obtained from the structure for certain values of the band index k.

@jishnub jishnub added the domain:linear algebra Linear algebra label May 10, 2024
@jishnub jishnub merged commit 25c8128 into master May 12, 2024
9 checks passed
@jishnub jishnub deleted the jishnub/istriul_constprop branch May 12, 2024 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants