[ 
https://issues.apache.org/jira/browse/MATH-248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675698#action_12675698
 ] 

Christian Semrau commented on MATH-248:
---------------------------------------

According to my little tests, walking in optimized order and adding the 
pairwise products to the result matrix is much faster for very sparse matrices, 
but for a full matrix (every entry set to 1), it is about 50% slower than the 
current implementation. So the implementation might switch between the two 
algorithms. Also one might wish to walk the other matrix if it is more sparse 
than this.


> Multiplying sparse matrices is slow
> -----------------------------------
>
>                 Key: MATH-248
>                 URL: https://issues.apache.org/jira/browse/MATH-248
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Christian Semrau
>            Priority: Minor
>
> The multiplication of sparse real matrices is very slow compared to real 
> matrices: Ten times as slow for size 200, four times as slow for size 400. 
> The time is independent of the number of nonzero entries, because the general 
> algorithm inherited from AbstractRealMatrix is used. I suggest using a 
> specialized multiplication algorithm for matrices that are "sparse enough", 
> walking only over the nonzero entries in one of the matrices.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to