Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Python tricks

by thechartist (Monk)
on Mar 04, 2019 at 21:49 UTC ( #1230873=note: print w/replies, xml ) Need Help??


in reply to Python tricks

The matrix transposition can be done as a one-liner if you use PDL:

Done on Strawberry Perl 5.26.1 perl -MPDL -e "$seq = sequence(3,2)+1; print transpose( $seq );"
Edit: even better is:
perl -MPDL -e "print transpose(sequence(3,2)+1);"
The nested function calls appeal to my Lispy side; but in Perl, it is often easier for me to assign something to a variable, then pass that variable to a function/subroutine. My matrix algebra is very rusty, but I suppose some of the other matrix problems have 1 line solutions using PDL. I will come back to this.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2020-10-24 09:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (242 votes). Check out past polls.

    Notices?