Added in-place functions 'qraddcol!' and 'qrdelcol!' #10
+263
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for the disposition!
The idea here is that the A and R matrices are allocated from the beginning, so only the temporary vectors in the qraddcol operations are used. I tried to minimize allocation in general to obtain a performant implementation. Because of this, when you add a new column, you must tell the function how full your R matrix is.
So here are the modifications:
I tried the following code:
and got the following output:
───────────────────────────
Time Allocations
─────────────────────── ────
Tot / % measured: 8.11s / 60.9% 2.04GiB / 25.3%
Section ncalls time %tot avg alloc %tot avg
────────────────────────────────────
dynamic 200 3.71s 75.1% 18.6ms 512MiB 96.9% 2.56MiB
in-place 100 1.23s 24.9% 12.3ms 16.3MiB 3.1% 167KiB
────────────────────────────────────
So, roughly a 60% time reduction and considerable savings in terms of memory allocations.