Skip to content

Instantly share code, notes, and snippets.

@kmx
Last active August 29, 2015 14:01
Show Gist options
  • Save kmx/be3f401efbeafdc3fc27 to your computer and use it in GitHub Desktop.
Save kmx/be3f401efbeafdc3fc27 to your computer and use it in GitHub Desktop.
PDL functions
function module description
abs PDL::Ops elementwise absolute value
acos PDL::Math The usual trigonometric function. Works inplace.
acosh PDL::Math The standard hyperbolic function. Works inplace.
and PDL::Ufunc Return the logical and of all elements in a piddle.
and2 PDL::Ops binary and of two piddles
andover PDL::Ufunc Project via and to N-1 dimensions
append PDL::Primitive append two or more piddles by concatenating along their first dimensions
approx PDL::Core test for approximately equal values (relaxed "==")
asin PDL::Math The usual trigonometric function. Works inplace.
asinh PDL::Math The standard hyperbolic function. Works inplace.
assgn PDL::Ops Plain numerical assignment. This is used to implement the ".=" operator
at PDL::Core Returns a single value inside a piddle as perl scalar.
atan PDL::Math The usual trigonometric function. Works inplace.
atan2 PDL::Ops elementwise "atan2" of two piddles
atanh PDL::Math The standard hyperbolic function. Works inplace.
average PDL::Ufunc Project via average to N-1 dimensions
avg PDL::Ufunc Return the average of all elements in a piddle.
axisvals PDL::Basic Fills a piddle with index values on Nth dimension
axisvalues PDL::Primitive Internal routine
badflag PDL::Bad getter/setter for the bad data flag
badmask PDL::Math Clears all "infs" and "nans" in $a to the corresponding value in $b.
badvalue PDL::Bad returns the value used to indicate a missing (or bad) element for the
band PDL::Ufunc Return the bitwise and of all elements in a piddle.
bandover PDL::Ufunc Project via bitwise and to N-1 dimensions
bessj0 PDL::Math The regular Bessel function of the first kind, J_n Works inplace.
bessj1 PDL::Math The regular Bessel function of the first kind, J_n Works inplace.
bessjn PDL::Math The regular Bessel function of the first kind, J_n . This takes a second
bessy0 PDL::Math The regular Bessel function of the second kind, Y_n. Works inplace.
bessy1 PDL::Math The regular Bessel function of the second kind, Y_n. Works inplace.
bessyn PDL::Math The regular Bessel function of the first kind, Y_n . This takes a second
bitnot PDL::Ops unary bit negation
bor PDL::Ufunc Return the bitwise or of all elements in a piddle.
borover PDL::Ufunc Project via bitwise or to N-1 dimensions
bswap2 PDL::IO::Misc Swaps pairs of bytes in argument x()
bswap4 PDL::IO::Misc Swaps quads of bytes in argument x()
bswap8 PDL::IO::Misc Swaps octets of bytes in argument x()
byte PDL::Core Convert to byte datatype - see 'Datatype_conversions'
bytescl PDL::ImageRGB Scales a pdl into a specified data range (default 0-255)
cat PDL::Core concatenate piddles to N+1 dimensional piddle
ceil PDL::Math Round to integer values in floating-point format. Works inplace.
check_badflag PDL::Bad Clear the bad-value flag of a piddle if it does not contain any bad
clip PDL::Primitive Clip (threshold) a piddle by (optional) upper or lower bounds.
clump PDL::Core "clumps" several dimensions into one large dimension
conv1d PDL::Primitive 1D convolution along first dimension
convert PDL::Core Generic datatype conversion function
copy PDL::Core Make a physical copy of a piddle
copybad PDL::Bad Copies values from one piddle to another, setting them bad if they are
cos PDL::Ops the cos function
cosh PDL::Math The standard hyperbolic function. Works inplace.
cquant PDL::ImageRGB quantize and reduce colours in 8-bit images
crossp PDL::Primitive Cross product of two 3D vectors
cumuprodover PDL::Ufunc Cumulative product
cumusumover PDL::Ufunc Cumulative sum
daverage PDL::Ufunc Project via average to N-1 dimensions
davg PDL::Ufunc Return the average (in double precision) of all elements in a piddle.
dcumuprodover PDL::Ufunc Cumulative product
dcumusumover PDL::Ufunc Cumulative sum
diagonal PDL::Core Returns the multidimensional diagonal over the specified dimensions.
diagonalI PDL::Slices Returns the multidimensional diagonal over the specified dimensions.
dice PDL::Slices Dice rows/columns/planes out of a PDL using indexes for each dimension.
dims PDL::Core Return piddle dimensions as a perl list
divide PDL::Ops divide two piddles
doflow PDL::Core Turn on/off dataflow
dog PDL::Core Opposite of 'cat' :). Split N dim piddle to list of N-1 dim piddles
double PDL::Core Convert to double datatype - see 'Datatype_conversions'
dprod PDL::Ufunc Return the product (in double precision) of all elements in a piddle.
dprodover PDL::Ufunc Project via product to N-1 dimensions
dsum PDL::Ufunc Return the sum (in double precision) of all elements in a piddle.
dsumover PDL::Ufunc Project via sum to N-1 dimensions
dummy PDL::Core Insert a 'dummy dimension' of given length (defaults to 1)
eigens PDL::MatrixOps Real eigenvalues and -vectors of a real square matrix.
eigens_sym PDL::MatrixOps Eigenvalues and -vectors of a symmetric square matrix. If passed an
eq PDL::Ops binary equal to operation ("==")
erf PDL::Math The error function. Works inplace.
erfc PDL::Math The complement of the error function. Works inplace.
erfi PDL::Math The inverse of the error function. Works inplace.
exp PDL::Ops the exponential function
fhdr PDL::Core Retrieve or set FITS header information from a piddle
fibonacci PDL::Primitive Constructor - a vector with Fibonacci's sequence
flat PDL::Core flatten a piddle (alias for "$pdl->clump(-1)")
float PDL::Core Convert to float datatype - see 'Datatype_conversions'
floor PDL::Math Round to integer values in floating-point format. Works inplace.
flows PDL::Core Whether or not a piddle is indulging in dataflow
ge PDL::Ops the binary >= (greater equal) operation
get_autopthread_actual PDL::Core Get the actual number of pthreads executed for the last pdl processing
get_autopthread_size PDL::Core Get the current autopthread_size setting.
get_autopthread_targ PDL::Core Get the current target number of processor threads (pthreads) for
get_dataref PDL::Core Return the internal data for a piddle, as a perl SCALAR ref.
get_datatype PDL::Core Internal: Return the numeric value identifying the piddle datatype
getdim PDL::Core Returns the size of the given dimension.
gethdr PDL::Core Retrieve header information from a piddle
getndims PDL::Core Returns the number of dimensions in a piddle
glue PDL::Primitive $c = $a->glue(,$b,...)
grandom PDL::Primitive Constructor which returns piddle of Gaussian random numbers
gt PDL::Ops the binary > (greater than) operation
hclip PDL::Primitive clip (threshold) $a by $b ($b is upper bound)
hcpy PDL::Core Switch on/off automatic header copying, with PDL pass-through
hdr PDL::Core Retrieve or set header information from a piddle
hdr_copy PDL::Core Return an explicit copy of the header of a PDL.
hdrcpy PDL::Core switch on/off/examine automatic header copying
hist PDL::Basic Create histogram of a piddle
histogram PDL::Graphics::PLplot Create a histogram of a 1-D variable.
identvaff PDL::Slices A vaffine identity transformation (includes thread_id copying).
in PDL::Primitive test if a is in the set of values b
indadd PDL::Primitive Threaded Index Add: Add "a" to the "ind" element of "sum", i.e:
index PDL::Slices "index", "index1d", and "index2d" provide rudimentary index indirection.
index1d PDL::Slices "index", "index1d", and "index2d" provide rudimentary index indirection.
index2d PDL::Slices "index", "index1d", and "index2d" provide rudimentary index indirection.
indexND PDL::Slices Find selected elements in an N-D piddle, with optional boundary handling
indx PDL::Core Convert to indx datatype - see 'Datatype_conversions'
info PDL::Core Return formatted information about a piddle.
inner PDL::Primitive Inner product over one dimension
inner2 PDL::Primitive Inner product of two vectors and a matrix
inner2d PDL::Primitive Inner product over 2 dimensions.
inner2t PDL::Primitive Efficient Triple matrix product "abc"
innerwt PDL::Primitive Weighted (i.e. triple) inner product
inplace PDL::Core Flag a piddle so that the next operation is done 'in place'
interlrgb PDL::ImageRGB Make an RGB image from a palette image and its lookup table.
interpND PDL::Primitive Interpolate values from an N-D piddle, with switchable method
interpolate PDL::Primitive routine for 1D linear interpolation
intersect PDL::Primitive Calculate the intersection of two piddles
intover PDL::Ufunc Project via integral to N-1 dimensions
is_inplace PDL::Core Test the in-place flag on a piddle
isbad PDL::Bad Returns a binary mask indicating which values of the input are bad
isbigendian PDL::IO::Misc Determine endianness of machine - returns 0 or 1 accordingly
isempty PDL::Core Test whether a piddle is empty
isfinite PDL::Math Sets $mask true if $a is not a "NaN" or "inf" (either positive or
isgood PDL::Bad Is a value good?
isnull PDL::Core Test whether a piddle is null
lags PDL::Slices Returns a piddle of lags to parent.
lclip PDL::Primitive clip (threshold) $a by $b ($b is lower bound)
le PDL::Ops the binary <= (less equal) operation
lgamma PDL::Math log gamma function
list PDL::Core Convert piddle to perl list
listindices PDL::Core Convert piddle indices to perl list
log PDL::Ops the natural logarithm
log10 PDL::Ops the base 10 logarithm
long PDL::Core Convert to long datatype - see 'Datatype_conversions'
longlong PDL::Core Convert to longlong datatype - see 'Datatype_conversions'
lt PDL::Ops the binary < (less than) operation
make_physical PDL::Core Make sure the data portion of a piddle can be accessed from XS code.
matmult PDL::Primitive Matrix multiplication
max PDL::GSL::RNG Return the maximum value generable by the RNG.
maximum PDL::Ufunc Project via maximum to N-1 dimensions
maximum_ind PDL::Ufunc Like maximum but returns the index rather than the value
maximum_n_ind PDL::Ufunc Returns the index of "m" maximum elements
median PDL::Ufunc Return the median of all elements in a piddle.
medover PDL::Ufunc Project via median to N-1 dimensions
min PDL::GSL::RNG Return the minimum value generable by this RNG.
minimum PDL::Ufunc Project via minimum to N-1 dimensions
minimum_ind PDL::Ufunc Like minimum but returns the index rather than the value
minimum_n_ind PDL::Ufunc Returns the index of "m" minimum elements
minmax PDL::Ufunc Returns an array with minimum and maximum values of a piddle.
minmaximum PDL::Ufunc Find minimum and maximum and their indices for a given piddle;
minus PDL::Ops subtract two piddles
mode PDL::Ufunc Return the mode of all elements in a piddle.
modeover PDL::Ufunc Project via mode to N-1 dimensions
modulo PDL::Ops elementwise "modulo" operation
mslice PDL::Core Convenience interface to slice, allowing easier inclusion of dimensions
mult PDL::Ops multiply two piddles
mv PDL::Slices move a dimension to another position
nbad PDL::Bad Returns the number of bad values in a piddle
nbadover PDL::Bad Find the number of bad elements along the 1st dimension.
ndcoords PDL::Basic Enumerate pixel coordinates for an N-D piddle
ndims PDL::Core Returns the number of dimensions in a piddle. Alias for getndims.
ndtri PDL::Math The value for which the area under the Gaussian probability density
ne PDL::Ops binary not equal to operation ("!=")
nelem PDL::Core Return the number of elements in a piddle
ngood PDL::Bad Returns the number of good values in a piddle
ngoodover PDL::Bad Find the number of good elements along the 1st dimension.
norm PDL::Primitive Normalises a vector to unit Euclidean length
not PDL::Ops the elementwise not operation
nslice PDL::Core c was an internally used interface for PDL::NiceSlice, but is
nslice_if_pdl PDL::Core If $self is a PDL, then calls "slice" with all but the last argument,
null PDL::Core Returns a 'null' piddle.
nullcreate PDL::Core Returns a 'null' piddle.
oddmedian PDL::Ufunc Return the oddmedian of all elements in a piddle.
oddmedover PDL::Ufunc Project via oddmedian to N-1 dimensions
oddpct PDL::Ufunc Return the specified percentile of all elements in a piddle. The
oddpctover PDL::Ufunc Project via percentile to N-1 dimensions
one2nd PDL::Primitive Converts a one dimensional index piddle to a set of ND coordinates
ones PDL::Core construct a one filled piddle
oneslice PDL::Slices experimental function - not for public use
or PDL::Ufunc Return the logical or of all elements in a piddle.
or2 PDL::Ops binary or of two piddles
orig_badvalue PDL::Bad returns the original value used to represent bad values for a given
orover PDL::Ufunc Project via or to N-1 dimensions
oslice PDL::Slices DEPRECATED: 'oslice' is the original 'slice' routine in pre-2.006_006
outer PDL::Primitive outer product over one dimension
pct PDL::Ufunc Return the specified percentile of all elements in a piddle. The
pctover PDL::Ufunc Project via percentile to N-1 dimensions
pdl PDL::Core PDL constructor - creates new piddle from perl scalars/arrays, piddles,
plus PDL::Ops add two piddles
pnminascii PDL::IO::Pnm int format; char* fd)
pnminraw PDL::IO::Pnm int isbin; char* fd)
pnmout PDL::IO::Pnm Write a line of pnm data.
polyfillv PDL::Image2D return the (dataflown) area of an image described by a polygon
polyroots PDL::Math Complex roots of a complex polynomial, given coefficients in order of
pow PDL::Math Synonym for `**'. Works inplace.
power PDL::Ops raise piddle $a to the power $b
prod PDL::Ufunc Return the product of all elements in a piddle.
prodover PDL::Ufunc Project via product to N-1 dimensions
px PDL::Dbg Print info about a piddle (or all known piddles)
qsort PDL::Ufunc Quicksort a vector into ascending order.
qsorti PDL::Ufunc Quicksort a vector and return index of elements in ascending order.
qsortvec PDL::Ufunc Sort a list of vectors lexicographically.
qsortveci PDL::Ufunc Sort a list of vectors lexicographically, returning the indices of the
random PDL::Primitive Constructor which returns piddle of random numbers
randsym PDL::Primitive Constructor which returns piddle of random numbers
range PDL::Slices Extract selected chunks from a source piddle, with boundary conditions
rangeb PDL::Slices Engine for range
rasc PDL::IO::Misc Simple function to slurp in ASCII numbers quite quickly,
rcols PDL::IO::Misc Read specified ASCII cols from a file into piddles and perl arrays (also
rdsa PDL::IO::Misc Read a FIGARO/NDF format file.
reorder PDL::Slices Re-orders the dimensions of a PDL based on the supplied list.
reshape PDL::Core Change the shape (i.e. dimensions) of a piddle, preserving contents.
rfits PDL::IO::FITS Simple piddle FITS reader.
rfitshdr PDL::IO::FITS Read only the header of a FITS file or an extension within it.
rgbtogr PDL::ImageRGB Converts an RGB image to a grey scale using standard transform
rint PDL::Math Round to integer values in floating-point format.
rld PDL::Slices Run-length decode a vector
rle PDL::Slices Run-length encode a vector
rotate PDL::Slices Shift vector elements along with wrap. Flows data back&forth.
rpic PDL::IO::Pic Read images in many formats with automatic format detection.
rpnm PDL::IO::Pnm Read a pnm (portable bitmap/pixmap, pbm/ppm) file into a piddle.
rvals PDL::Basic Fills a piddle with radial distance values from some centre.
s_identity PDL::Slices Internal vaffine identity function.
sclr PDL::Core return a single value from a piddle as a scalar
sequence PDL::Basic Create array filled with a sequence of values
set PDL::Core Set a single value inside a piddle
set_autopthread_size PDL::Core Set the minimum size (in M-elements or 2^20 elements) of the largest PDL
set_autopthread_targ PDL::Core Set the target number of processor threads (pthreads) for multi-threaded
set_inplace PDL::Core Set the in-place flag on a piddle
setbadat PDL::Bad Set the value to bad at a given position.
setbadif PDL::Bad Set elements bad based on the supplied mask, otherwise copy across the
setbadtonan PDL::Bad Sets Bad values to NaN
setbadtoval PDL::Bad Replace any bad values by a (non-bad) value.
sethdr PDL::Core Set header information of a piddle
setnantobad PDL::Bad Sets NaN/Inf values in the input piddle bad (only relevant for
setops PDL::Primitive Implements simple set operations like union and intersection
setvaltobad PDL::Bad Set bad all those elements which equal the supplied value.
sever PDL::Core sever any links of this piddle to parent piddles
shape PDL::Core Return piddle dimensions as a piddle
shiftleft PDL::Ops leftshift $a by $b
shiftright PDL::Ops rightshift $a by $b
short PDL::Core Convert to short datatype - see 'Datatype_conversions'
simq PDL::MatrixOps Solution of simultaneous linear equations, "a x = b".
sin PDL::Ops the sin function
sinh PDL::Math The standard hyperbolic function. Works inplace.
slice PDL::Slices $slice = $data->slice([2,3],'x',[2,2,0],"-1:1:-1", "*3");
sliceb PDL::Slices info not available
spaceship PDL::Ops elementwise "<=>" operation
splitdim PDL::Slices Splits a dimension in the parent piddle (opposite of clump)
sqrt PDL::Ops elementwise square root
squaretotri PDL::MatrixOps Convert a symmetric square matrix to triangular vector storage.
squeeze PDL::Core eliminate all singleton dimensions (dims of size 1)
stats PDL::Primitive Calculates useful statistics on a piddle - mean, median, minimum, maximum, average absolute deviation, RMS - root-mean-square deviation, population RMS deviation from the mean
statsover PDL::Primitive Calculate useful statistics over a dimension of a piddle
sum PDL::Ufunc Return the sum of all elements in a piddle.
sumover PDL::Ufunc Project via sum to N-1 dimensions
svd PDL::MatrixOps ($r1, $s, $r2) = svd($a);
swcols PDL::IO::Misc generate string list from "sprintf" format specifier and a list of
tan PDL::Math The usual trigonometric function. Works inplace.
tanh PDL::Math The standard hyperbolic function. Works inplace.
thread PDL::Core Use explicit threading over specified dimensions (see also
thread1 PDL::Core Explicit threading over specified dims using thread id 1.
thread2 PDL::Core Explicit threading over specified dims using thread id 2.
thread3 PDL::Core Explicit threading over specified dims using thread id 3.
threadI PDL::Slices Internal: Put some dimensions to a threadid.
thread_define PDL::Core define functions that support threading at the perl level
threadids PDL::Core Returns the piddle thread IDs as a perl list
topdl PDL::Core alternate piddle constructor - ensures arg is a piddle
transpose PDL::Basic transpose rows and columns.
type PDL::Core return the type of a piddle as a blessed type object
uniq PDL::Primitive return all unique elements of a piddle
uniqind PDL::Primitive Return the indices of all unique elements of a piddle The order is in
uniqvec PDL::Primitive Return all unique vectors out of a collection
unpdl PDL::Core Convert piddle to nested Perl array references
unthread PDL::Slices All threaded dimensions are made real again.
unwind PDL::Core Return a piddle which is the same as the argument except that all
upd_data PDL::Core Update the data pointer in a piddle to match its perl SV.
ushort PDL::Core Convert to ushort datatype - see 'Datatype_conversions'
using PDL::Slices Returns array of column numbers requested
vsearch PDL::Primitive routine for searching 1D values i.e. step-function interpolation.
wcols PDL::IO::Misc Write ASCII columns into file from 1D or 2D piddles and/or 1D listrefs efficiently.
wfits PDL::IO::FITS Simple PDL FITS writer
where PDL::Primitive Use a mask to select values from one or more data PDLs
whereND PDL::Primitive "where" with support for ND masks and threading
whichND PDL::Primitive Return the coordinates of non-zero values in a mask.
whist PDL::Basic Create a weighted histogram of a piddle
whistogram PDL::Primitive Calculates a histogram from weighted data for given stepsize and
whistogram2d PDL::Primitive double stepb; double minb; int mbsize => mb;)
wim PDL::IO::Pic Write a pdl to an image file with selected type (or using filename
wmpeg PDL::IO::Pic Write an image sequence (a (3,x,y,n) byte pdl) as an animation.
wpic PDL::IO::Pic Write images in many formats with automatic format selection.
wpnm PDL::IO::Pnm Write a pnm (portable bitmap/pixmap, pbm/ppm) file into a file.
wtstat PDL::Primitive Weighted statistical moment of given degree
xchg PDL::Slices exchange two dimensions
xlinvals PDL::Basic X axis values between endpoints (see xvals).
xlogvals PDL::Basic X axis values logarithmically spaced between endpoints (see xvals).
xor PDL::Ops binary exclusive or of two piddles
xvals PDL::Basic Fills a piddle with X index values. Uses similar specifications to
ylinvals PDL::Basic Y axis values between endpoints (see yvals).
ylogvals PDL::Basic Y axis values logarithmically spaced between endpoints (see yvals).
yvals PDL::Basic Fills a piddle with Y index values. See the CAVEAT for xvals.
zcheck PDL::Ufunc Return the check for zero of all elements in a piddle.
zcover PDL::Ufunc Project via == 0 to N-1 dimensions
zeroes PDL::Core construct a zero filled piddle from dimension list or template piddle.
zlinvals PDL::Basic Z axis values between endpoints (see zvals).
zlogvals PDL::Basic Z axis values logarithmically spaced between endpoints (see zvals).
zvals PDL::Basic Fills a piddle with Z index values. See the CAVEAT for xvals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment