This module provides some primitive and useful functions defined
using PDL::PP based on functionality of what are sometimes called
ufuncs (for example NumPY and Mathematica talk about these).
It collects all the functions generally used to reduce or
accumulate along a dimension. These all do their job across the
first dimension but by using the slicing functions you can do it
on any dimension.

The PDL::Reduce module provides an alternative interface
to many of the functions in this module.

intover uses a point spacing of one (i.e., delta-h==1). You will
need to scale the result to correct for the true point delta).

For n > 3, these are all O(h^4) (like Simpson's rule), but are
integrals between the end points assuming the pdl gives values just at
these centres: for such `functions', sumover is correct to O(h), but
is the natural (and correct) choice for binned data, of course.

intover ignores the bad-value flag of the input piddles.
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

The median is sometimes not a good choice as if the array has
an even number of elements it lies half-way between the two
middle values - thus it does not always correspond to a data
value. The lower-odd median is just the lower of these two values
and so it ALWAYS sits on an actual data value which is useful in
some circumstances.

oddmedover processes bad values.
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

This function reduces the dimensionality of a piddle by one by finding
the specified percentile (p) along the 1st dimension. The specified
percentile must be between 0.0 and 1.0. When the specified percentile
falls between data points, the result is interpolated. Values outside
the allowed range are clipped to 0.0 or 1.0 respectively. The algorithm
implemented here is based on the interpolation variant described at
http://en.wikipedia.org/wiki/Percentile as used by Microsoft Excel
and recommended by NIST.

This function reduces the dimensionality of a piddle by one by finding
the specified percentile along the 1st dimension. The specified
percentile must be between 0.0 and 1.0. When the specified percentile
falls between two values, the nearest data value is the result.
The algorithm implemented is from the textbook version described
first at http://en.wikipedia.org/wiki/Percentile.

Return the specified percentile of all elements in a piddle. The
specified percentile (p) must be between 0.0 and 1.0. When the
specified percentile falls between data points, the result is
interpolated.

Return the specified percentile of all elements in a piddle. The
specified percentile must be between 0.0 and 1.0. When the specified
percentile falls between two values, the nearest data value is the
result.

This routine does not thread over the dimensions of $pdl;
it returns the minimum and maximum values of the whole array.
See minmaximum if this is not what is required.
The two values are returned as Perl scalars similar to min/max.

Sort a list of vectors lexicographically, returning the indices of the
sorted vectors rather than the sorted list itself.

As with qsortvec, the input PDL should be an NxM array containing M
separate N-dimensional vectors. The return value is an integer M-PDL
containing the M-indices of original array rows, in sorted order.

As with qsortvec, the zeroth element of the vectors runs slowest in the
sorted list.

Additional dimensions are threaded over: each plane is sorted separately,
so qsortveci may be thought of as a collapse operator of sorts (groan).

Copyright (C) Tuomas J. Lukka 1997 (lukka@husc.harvard.edu)
Contributions by Christian Soeller (c.soeller@auckland.ac.nz)
and Karl Glazebrook (kgb@aaoepp.aao.gov.au) All rights
reserved. There is no warranty. You are allowed to redistribute this
software / documentation under certain conditions. For details, see
the file COPYING in the PDL distribution. If this file is separated
from the PDL distribution, the copyright notice should be included in
the file.