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.
In conjunction with my review #21, here are some suggestions that should improve your code from a correctness and performance point of view.
There is still more to optimize if you want to, especially regarding allocations. Let me know if you're interested in pursuing this.
Note that I have not performed benchmarks for lack of a meaningful benchmarking instance, but I'm 90% sure that these changes are beneficial. The only downside I can anticipate is a slightly increased compilation latency.
Correctness
similar
withcopy
when initializingA
andV
. This is an incomplete fix for Different results for two consecutive calls tofit!
on the same data #22, one would also need to avoid updatingepca.V
in-place (why do you do it?).Performance
Float64
when it makes sense and avoid implicit conversions fromInt
.L
to force specialization even though it is a function.Other updates
Parameters.@with_kw
can be replaced with the built-in@kwdef
, andParameters.@unpack
with the built-in(; a, b, c) = object
syntax.