Perhaps Math::VecStat would suit your needs (I happened upon it while looking for a module for calculating primes).

It's description: "This package procides some basic statistics on numerical vectors. All the subroutines can take a copy of the vector, or, preferably for efficiency, a reference to the vector to be operated on.

max(@vector), max(\@vector)

return the maximum value of given values or vector. In an array context returns the value and the index in the array where it occurs.

min(@vector), min(\@vector)

return the minimum value of given values or vector, In an array context returns the value and the index in the array where it occurs.

maxabs(@vector), maxabs(\@vector)

return the maximum value of absolute of the given values or vector. In an array context returns the value and the index in the array where it occurs.

minabs(@vector), minabs(\@vector)

return the minimum value of the absolute of the given values or vector, In an array context returns the value and the index in the array where it occurs.

sum($v1,$v2,...), sum(@vector), sum(\@vector)

return the sum of the given values or vector average($v1,$v2,..), average(@vector), average(\@vector)

return the average of the given values or vector."

redmist

In reply to Re: vector math by redmist
in thread vector math by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.