Syntactic Confectionery Delight | |
PerlMonks |
Re: In PDL, how to raise a matrix $m to a power $vby vr (Curate) |
on Feb 02, 2019 at 00:08 UTC ( [id://1229268]=note: print w/replies, xml ) | Need Help?? |
Looks like there is no such function. To clarify, we want, e.g., matrix 0 1 2 3 when squared, to become 2 3 6 11 Searching CPAN, (link that talexb provided), Math::MatrixReal can do it, but inefficiently -- O(n) rather than O(log n). And it's definitely not PDL. Indeed, as you say, very simple and reasonably efficient function can be written, utilizing exponentiation by squaring, maybe peeking at how numpy does it, but, of course, it's so simple, that the latter may not be necessary :)
In Section
Seekers of Perl Wisdom
|
|