Closed llrs closed 2 years ago
I have added a new commit with the requested changes. I have also pre-allocated the initial lists that I missed previously.
The other big change that could speed everything is to replace missing data by 0 on rgcca before calling any other subsequent function. I'm not sure if this is deferred to when the matrix multiplications happen for some reason as I haven't tested it, but I think this would help simplifying the code and make it a bit faster.
The other big change that could speed everything is to replace missing data by 0 on rgcca before calling any other subsequent function. I'm not sure if this is deferred to when the matrix multiplications happen for some reason as I haven't tested it, but I think this would help simplifying the code and make it a bit faster.
The current strategy is to allow different ways to handle missing values: complete
and nipals
for now. The first one removes all lines containing missing values, the second virtually changes missing values to 0 by using this pm
function to make the matrix multiplications. There used to be other methods to deal with missing values, they probably had an interest in this pm
mechanism too but I am not sure.
Given the current state I think you are right, it would make more sense and simplify greatly if we just replaced missing values with 0 right from the start. However, I think it will wait the next release as it might break the code if not done carefully...
Done! When documenting the package roxygen2 updated the RoxygenNote version and I added the Encoding: UTF-8 to avoid a warning from roxygen2.
Somehow I missed that criteria change, sorry. Fixing that mistake the speed gain is practically insignificant.
I made sure this time that between the both versions they return the same result
This PR has some minor speed tweaks:
(t)crossprod
whenever possible*apply
family of functions.There are some other minor tweaks like adding a new
shave
method to use instead ofshave.malist
,shave.veclist
and usingmessage
instead ofcat(paste0(
These changes result on an almost 1x speed improvement and a reduction on memory allocated on my tests with 50 iterations:
Hope it helps!