If you have a sparse matrix (mostly zeros) there are algorithms out there that will speed things up considerably. Google "sparse matrix multiplication". If not, you'll probably have to hook in some compiled code (as you have done) - to get a little extra speed you might try MMX extensions.
Update:
Here's the basic idea behind sparse matrix multiplication. Collapse the vectors into lists of the non-zero elements and corresponding lists of their indexes in the original vectors. Then traverse the lists of indexes for the vectors you are multiplying - you only have to multiply the vector elements when their indexes match up. Your result is the intersection of the lists of indexes and the multiplied elements of those indexes. (Obviously, this only helps if most of the elements are zeros - however, that's fairly common in the sciences.)

In reply to Re: Fast matrix multiplication by bean
in thread Fast matrix multiplication by ludo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.