in reply to computational efficiency

I'll have to do that a couple of hundred times to a couple of hundred thousand times, so right now I'm thinking of how to optimize the code.

You might want to look at PDL, or make a custom Inline::C program to do the calculations. PDL uses very fast Fortran routines to do it's math. Plain Perl's math is slowed down by the overhead it uses on maintaining variable type, so it is not best for computational efficiency.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: computational efficiency
by etj (Priest) on May 24, 2022 at 23:46 UTC
    Plain PDL uses C, not Fortran, routines for its calculations (except in PDL::Slatec and PDL::Minuit, which are bindings to supplied Fortran routines, if the system has a Fortran compiler). However PDL::LinearAlgebra is a binding to LAPACK. That was originally in Fortran, but increasingly parts of the implementations you'll find installed or packaged are written in C and/or C++.