fast matrix multiplication in Matlab

前端 未结 5 2010
孤城傲影
孤城傲影 2020-12-21 10:46

I need to make a matrix/vector multiplication in Matlab of very large sizes: \"A\" is an 655360 by 5 real-valued matrix that are not necessarily sparse and \"B\" is a 655360

5条回答
  •  -上瘾入骨i
    2020-12-21 11:20

    In order to avoid the transpose operation, you could try:

    sum(bsxfun(@times, A, B), 2)
    

    But I would be astonished it was faster than the direct version. See @thiton's answer.

    Also look at http://www.mathworks.co.uk/company/newsletters/news_notes/june07/patterns.html to see why the column-vector-based version is faster than the row-vector-based version.

提交回复
热议问题