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 (Priest) on May 20, 2022 at 15:41 UTC