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

Improve complexity of getindex #31

Merged
merged 7 commits into from
Jul 18, 2022
Merged

Improve complexity of getindex #31

merged 7 commits into from
Jul 18, 2022

Conversation

tpgillam
Copy link
Contributor

@tpgillam tpgillam commented Jul 18, 2022

Previously, getindex constructed the full dense matrix. This gets expensive, as it is used when e.g. forming a string representation of the array.

Now we compute only the part that is necessary.

Closes #30

@tpgillam tpgillam changed the title Improve complexity of getinddex Improve complexity of getindex Jul 18, 2022
@codecov
Copy link

codecov bot commented Jul 18, 2022

Codecov Report

Merging #31 (74e5945) into master (f0f1cdf) will increase coverage by 1.36%.
The diff coverage is 90.90%.

@@            Coverage Diff             @@
##           master      #31      +/-   ##
==========================================
+ Coverage   71.84%   73.21%   +1.36%     
==========================================
  Files           4        3       -1     
  Lines         103      112       +9     
==========================================
+ Hits           74       82       +8     
- Misses         29       30       +1     
Impacted Files Coverage Δ
src/woodbury_pd_mat.jl 93.47% <90.90%> (-0.97%) ⬇️
src/PDMatsExtras.jl

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0f1cdf...74e5945. Read the comment docs.

Copy link
Contributor

@mzgubic mzgubic left a comment

Choose a reason for hiding this comment

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

Just to understand: previously the string would iterate over all the indexes, which would each construct a full Matrix, and then return the value. Now, instead of constructing the full matrix, we just construct the right element.

This seems sensible, and I wonder whether it takes roughly the same time as string(Matrix(woodbury))?

src/woodbury_pd_mat.jl Show resolved Hide resolved
@tpgillam tpgillam merged commit e6506b0 into master Jul 18, 2022
@tpgillam tpgillam deleted the tg/woodbury_tweaks branch July 18, 2022 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

string(::WoodburyPDMat) has worse than cubic complexity
2 participants