Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Multiplying matrices

by Ea (Chaplain)
on Mar 11, 2014 at 10:51 UTC ( [id://1077829]=note: print w/replies, xml ) Need Help??


in reply to Re: Multiplying matrices
in thread Multiplying matrices

For many years, I too have suggested people look at PDL, but it's only now reflecting on zentara's suggestion that I see PDL could really use some example code up on perlmonks. Unfortunately, I'm not a big PDL user, so you might want to jump onto the PDL mailing list or peruse the Quantified Onion for more knowledgeable answers.

Taking a stab at an example, would the PDL code look something like this?

use PDL; # amino acids in this order in the reaction rates pdl # A R N D C Q E G H I L K M F P S T W Y V B Z X $rates = pdl [ [ 5, -2, -1 ], [ -2, 7, -1 ], [ -1, -1, 7 ], ]; $multiplied_rates = $rates x $rates; print $multiplied_rates;
My calculation by hand seems to agree with the first two values. The rest is left as an exercise for the user.

Looks a lot easier than the OP's code, if you can overcome the fear of the new. And it's kinda cool :)

Edit:If I'd checked before posting, I would have linked to The Perl Data Language (PDL): A Quick Reference Guide or RFC: Getting Started with PDL (the Perl Data Language) both of which have lots of examples.

Sometimes I can think of 6 impossible LDAP attributes before breakfast.

Replies are listed 'Best First'.
Re^3: Multiplying matrices
by etj (Deacon) on May 20, 2022 at 15:41 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1077829]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-03-29 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found