Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Python tricks

by thechartist (Monk)
on Mar 04, 2019 at 21:49 UTC ( [id://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.

Replies are listed 'Best First'.
Re^2: Python tricks
by etj (Deacon) on May 02, 2022 at 17:22 UTC
    I would highly recommend PDL::LinearAlgebra which has had a medium-sized update recently to get all the wrappers for the underlying LAPACK routines to work with "native complex" data. It turns perldl into a rather more MATLAB/Octave-like matrix tool.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2024-04-18 08:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found