You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: I'm trying to use bigalgebra to calculate Hellinger distance on matrices of discrete probability distributions.
To do this calculation, I need to calculate elementwise square roots and do an elementwise subtraction 1 - X. I can't seem to find any way to do the elementwise square root without dropping back to standard matrices. For the elementwise subtraction, I can create a matrix of 1s as
But creating this matrix is surprisingly slow (about 3 times slower than a $n \times k$ by $k \times n$ multiplication) and seems to introduce a bunch of memory overhead that isn't cleaned up by automatic garbage collection. Then the elementwise difference using daxpy() is also surprisingly slow, taking more than twice as long as creating ones.
MWE attached. Thanks in advance for any suggestions!
Context: I'm trying to use
bigalgebra
to calculate Hellinger distance on matrices of discrete probability distributions.To do this calculation, I need to calculate elementwise square roots and do an elementwise subtraction
1 - X
. I can't seem to find any way to do the elementwise square root without dropping back to standard matrices. For the elementwise subtraction, I can create a matrix of 1s asBut creating this matrix is surprisingly slow (about 3 times slower than a$n \times k$ by $k \times n$ multiplication) and seems to introduce a bunch of memory overhead that isn't cleaned up by automatic garbage collection. Then the elementwise difference using
daxpy()
is also surprisingly slow, taking more than twice as long as creatingones
.MWE attached. Thanks in advance for any suggestions!
bigmemory.R.zip
The text was updated successfully, but these errors were encountered: