Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Strassen's Algorithm for Matrix Multiplication

by cormanaz (Chaplain)
on Apr 13, 2013 at 15:01 UTC ( #1028525=perlquestion: print w/replies, xml ) Need Help??
cormanaz has asked for the wisdom of the Perl Monks concerning the following question:

Good day bros. Does anyone know where I can find example code in PERL for Strassen's matrix multiplication algorithm? I found something in MCE samples but that seems to be for fixed size, static matrices to test timing. I'm looking for something that will multiply any-sized (conformable, of course) matrices with actual data.
  • Comment on Strassen's Algorithm for Matrix Multiplication

Replies are listed 'Best First'.
Re: Strassen's Algorithm for Matrix Multiplication
by LanX (Bishop) on Apr 13, 2013 at 15:11 UTC
    Porting the C-code in WP:Strassen_algorithm#Source_code seems straightforward!

    Don't you think you should at least provide some links in the OP?

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      My bad re missing link.

      That seems to be what they've done in the MCE code example. What I don't get is this argument $tam (used both in perl and C). It says in the C code this has something to do with the "length of the matrix" but a matrix has two dimensions, so I'm not sure what they mean by "length." This is what made me think they were setting up some kind of fixed size test data.

        Strassen's algorithm only works for square matrices of a dimenstion that is a power of two I believe. At least a superficial scan of the Wikipedia article seems to confirm that. It also mentions padding non-square matrices.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1028525]
Approved by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2018-02-18 11:40 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (253 votes). Check out past polls.