Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^2: PDL vs C speed questionby glwtta (Hermit) |
on May 07, 2005 at 23:58 UTC ( [id://454943]=note: print w/replies, xml ) | Need Help?? |
I don't think I understand your code - is @data the same as my @data? I think what's confusing people here is the PDL notation - my fault, I should've given the pure Perl version - since $data[$i] and $data[$j] are PDL vectors, the '*' operator is overloaded to return a vector of the same length as its arguments, with every component being the product of the corresponding components of the input vectors. The sum() function simply returns the sum of the vector components. The Perl version of my C example would look like this, assuming @data is an array of arrayrefs, rather than an array of PDL vectors: I really don't think the math here can be simplified any more; or else I need to brush up on basic arithmetic :) minor edit: forgot that square brackets get interpreted
In Section
Seekers of Perl Wisdom
|
|