How to quickly calculate the sum of the transpose of a sparse matrix?
6 views (last 30 days)
I have a very big sparse matrix A. I want to obtain the sum of its transpose of the selected columns in A. Here is my code:
B = A(:,selectedCol)';
sumA = sum(B);
I am wondering if there is a faster way to do the above calculation.
Thanks a lot in advance.
Depening on the size of selectedCols, it may also help to cast the operation as a matrix/vector multiplication
B=sum( A(:,selectedCol) ,2)';