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

Faster trace for StridedMatrixes #55523

Merged
merged 1 commit into from
Aug 19, 2024
Merged

Faster trace for StridedMatrixes #55523

merged 1 commit into from
Aug 19, 2024

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Aug 18, 2024

This PR generalizes the tr(::Matrix) method to accept StridedMatrix types.
As a consequence:

julia> A = rand(1000,1000);

julia> V = view(A, axes(A)...);

julia> @btime tr($V);
  1.990 μs (3 allocations: 7.88 KiB) # nightly v"1.12.0-DEV.1063"
  999.455 ns (0 allocations: 0 bytes) # this PR

@jishnub jishnub added linear algebra Linear algebra arrays [a, r, r, a, y, s] labels Aug 18, 2024
@jishnub jishnub requested a review from ViralBShah August 19, 2024 06:33
@jishnub jishnub merged commit d17b5ac into master Aug 19, 2024
7 of 9 checks passed
@jishnub jishnub deleted the jishnub/tr_stridedmatrix branch August 19, 2024 14:00
KristofferC pushed a commit that referenced this pull request Sep 12, 2024
This PR generalizes the `tr(::Matrix)` method to accept `StridedMatrix`
types.
As a consequence:
```julia
julia> A = rand(1000,1000);

julia> V = view(A, axes(A)...);

julia> @Btime tr($V);
  1.990 μs (3 allocations: 7.88 KiB) # nightly v"1.12.0-DEV.1063"
  999.455 ns (0 allocations: 0 bytes) # this PR
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants