I am a statistician working on DNA datasets. I am writing an R package, and I will routinely need to perform matrix multiplication on upper-triangular (sparse) matrices that have hundreds-of-millions of columns/rows.

I will be multiplying these matrices by low-pass and high-pass filters. For example:

enter image description here

Note that when multiplying the right and center, only the first two rows of the 'a' matrix need to be multiplied by the first column of the down-sampler, as the rest all have zeros in the first two entries.

Similarly, when premultiplying the down-sampler with the 'A' matrix, only the first row needs to be multiplied by the first column, as subsequent rows will be multiplying by zeros only.

Clearly when dealing with massive matrices, these unnecessary operations will add time to the calculation that could otherwise be avoided.

My question is: Is there a 'Forward multiplication' function for upper triangular matrices in either the R packages Matrix or c++ (which I can implement in Rcpp) that will avoid the unnecessary row/column operations that are not needed?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.