Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

numeric computing

by spurperl (Priest)
on Aug 04, 2003 at 04:56 UTC ( #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,

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

    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,


    -- 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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://280561]
Approved by vek
Front-paged by broquaint
[LanX]: Oh I see, userDict should have been declared in n outer scope ...
[LanX]: an
[LanX]: strange python accepts this?
[LanX]: no previous userDict?

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2018-03-20 18:19 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (257 votes). Check out past polls.