PDL::Basic#
Provides sequence generators (sequence, xvals, yvals, zvals,
axisvals), coordinate helpers (ndcoords), and hist.
These are mostly pure Perl in the original PDL::Basic.pm.
We provide native implementations here for performance and correctness.
Synopsis#
use PDL;
my $a = sequence(10); # 0..9
my $x = xvals(5, 5);
my $y = yvals(5, 5);
my $z = zvals(3, 3, 3);
my $h = hist($a, 0, 10, 2);
Functions#
Other Functions#
sequence#
sequence(@dims) – create an ndarray filled with 0, 1, 2, ..., N-1.
xvals#
xvals(@dims)
yvals#
yvals(@dims)
zvals#
zvals(@dims)
axisvals#
axisvals($pdl_or_dims, $axis)
hist#
hist($pdl, $min?, $max?, $step?)
ndcoords#
ndcoords(@dims)
xlinvals#
xlinvals($pdl, $min, $max)
ylinvals#
ylinvals($pdl, $min, $max)
zlinvals#
zlinvals($pdl, $min, $max)
xlogvals#
xlogvals($pdl, $min, $max)
ylogvals#
ylogvals($pdl, $min, $max)
zlogvals#
zlogvals($pdl, $min, $max)
rvals#
rvals(@dims) — radial distance values. Creates a PDL where each element is the Euclidean distance from the center. For dims (W, H): center = (W/2, H/2), rvals[x,y] = sqrt((x-cx)^2 + (y-cy)^2). Options (last arg hashref): {center=>[x,y,…], squared=>1}
random#
grandom(@dims) — Gaussian random numbers using Box-Muller transform. random([type], $nx, $ny, $nz, ...) — uniform random PDL in [0, 1). Mirrors PDL::Basic::random (Primitive.pd wrapper).