-
Notifications
You must be signed in to change notification settings - Fork 26
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
using sparse matrix #70
base: master
Are you sure you want to change the base?
Conversation
Thanks a lot for this great contribution! I will need some time to ensure it doesn't have any negative side effects to (my) workflows and downstream dependencies. |
@@ -1,5 +1,12 @@ | |||
import("methods") | |||
|
|||
importFrom("Matrix", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add Matrix
to Depends in the DESCRIPTION
file to make R CMD check
working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll do! Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've committed the fixed DESCRIPTION
file.
I'm having a look at the errors and fixing them. |
Added support to sparse matrices and tests.
Hi, I've made some modifications to the code. I've also left the support to dense matrices, so you can easily adapt the code in case you need some legacy support. I had to write new C++ functions for the colMeans and colMedians ( Of course, the support to the algebra of the sparseMatrixNA is missing (if you sum a "missing" value and number you get a number instead of the "missing"), so you can have some "weird" behaviours for downstream analysis. But, that would require a new class. Another solution would be dropping the difference between NAs and zeros, in that way the implementation would be straightforward. |
Codecov Report
@@ Coverage Diff @@
## master #70 +/- ##
==========================================
- Coverage 88.44% 87.78% -0.67%
==========================================
Files 81 82 +1
Lines 1411 1514 +103
==========================================
+ Hits 1248 1329 +81
- Misses 163 185 +22
Continue to review full report at Codecov.
|
Wow, what a great PR!
Could you please explain why this is necessary? In |
Thanks! :)
In sparseMatrix, NAs occupy memory unfortunately. Otherwise, it would be straightforward to implement it. Basically, the idea is to convert the zeros to
That's easily solved by writing the C versions. Unfortunately, |
Thanks for clarification. I wasn't aware of this detail of the |
Another completely different route is using something like |
I've made some changes to use sparse matrices from "Matrix".
I think it may be better in terms of memory usage, especially for imaging data, where data are often quite sparse.