Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

numeric computing

by spurperl (Priest)
on Aug 04, 2003 at 04:56 UTC ( [id://280561]=perlquestion: print w/replies, xml ) Need Help??

spurperl has asked for the wisdom of the Perl Monks concerning the following question:

Dear fellow monks,

Is there any numeric computing package in Perl ? For example, solution of Linear equations using various methods (Gauss-Jordan, LTU, etc...), and/or root finding ?

All I found was Math::Matrix which is a base, but no real numeric tools ?

Perl may not be the best tool for numeric analysis work, but sometimes it's needed.

Replies are listed 'Best First'.
Re: numeric computing
by Zaxo (Archbishop) on Aug 04, 2003 at 05:05 UTC

    You're looking for PDL. Very fast and good.

    After Compline,
    Zaxo

Re: numeric computing
by wufnik (Friar) on Aug 04, 2003 at 07:30 UTC
    hola;

    PDL, above, is great, but lacks a number of LP specific thingies. chunlou suggested the Math::LP at Re: Re: Minimax / AlphaBeta harness, which i think works on unix, tho i had problems getting it to compile. it harnesses one of the faster LP engines.

    there is also the gnu linear programming toolkit, sadly yet to find a perl harness. this also solves constraint satistaction probs like n-queens, and other prob. categories. links to that and other potentially useful LP engines are in the above thread.

    best of luck,

    wufnik

    -- in the world of the mules there are no rules --
Re: numeric computing
by chunlou (Curate) on Aug 04, 2003 at 16:34 UTC

    It happens that there's Statistics::LTU. In general, look for the solution that lets Perl interface with other external software.

    Inline::Octave may be useful.

    Pari (a number theory package) may also be of use.

    Omegahat has a bunch of bi-directional interfaces for general programming languages and math software.

    Math::MatrixReal can solve linear equations alright. It can't deal with eigensystem in general, only the symmetric case. But it's not hard to implement your own power method to find real (as opposed to complex) eigen values.

    use constant eps => 0.00001; my $m; sub eigen { $m = shift; # assume a Math::MatrixReal object return _eigen(-1e300, $m->column(1)->each(sub{1})); } sub _eigen { my $v = $_[1]; $v = $m*$v; my $eigen = $v->norm_max(); $v = $v*(1/$eigen); abs($eigen - $_[0]) > eps ? _eigen($eigen,$v) : return($eigen,$v); }


    __________________
    Caveat. Power method may go on forever if no real eigenvalues exist unless you explicitly limit the number of iteration.

Re: numeric computing
by jmanning2k (Pilgrim) on Aug 04, 2003 at 18:35 UTC
Re: numeric computing
by etj (Deacon) on Jun 26, 2022 at 02:01 UTC
    The correct answer to this question: use PDL, and for linear-algebra processing, use PDL::LinearAlgebra.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://280561]
Approved by vek
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-24 04:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found