--- a/PDL/Book/Operations.pod +++ b/PDL/Book/Operations.pod @@ -1,5 +1,4 @@ =head1 Operating on PDLs - PDL variables are structured (conventional) arrays of numbers. The most basic operations on them are the familiar numerical @@ -18,7 +17,7 @@ with). A few operators, notably matrix multiplication, have more than one active dimension. -=head1 Expressions with PDLs +=head2 Expressions with PDLs All of the standard Perl operators apply to PDLs, with the usual precedence rules. They are listed in Table [tab:Perl-operators]. @@ -28,7 +27,7 @@ operators (like multiplication), the scalar is promoted to a PDL, so the result is a PDL with appropriate threading. -=head2 PDLs as boolean values; logicals and masks +=head3 PDLs as boolean values; logicals and masks @@ -163,7 +162,7 @@ element because both sides of the C<&> operator have been converted to true boolean values (0 or 1). -=head2 Collapse/reduce: Summarizing by row +=head3 Collapse/reduce: Summarizing by row The simplest operators have no active dimensions, simply @@ -203,7 +202,7 @@ the threading engine if there is sufficient demand. You might be the person to demand and/or implement it... -=head2 Arithmetic collapse: C<prodover> and C<sumover> +=head3 Arithmetic collapse: C<prodover> and C<sumover> The C<sumover> and C<prodover> functions perform summing and product, respectively, along the 0 dim of a PDL. For example, to take the @@ -219,7 +218,7 @@ The related functions C<sum> and C<prod> work on the whole of $pdl and return a single Perl scalar. -=head2 Logical collapse: C<andover> and C<orover> +=head3 Logical collapse: C<andover> and C<orover> The C<andover> and C<orover> operators provide true boolean (not bitwise) masking of elements across rows. They are complementary @@ -231,7 +230,7 @@ M-PDL mask indicating whether each row contains even a single nonzero value. -=head2 Statistical collapse: C<average> and C<statsover> +=head3 Statistical collapse: C<average> and C<statsover> The C<average> collapse is complementary to C<avg>, which takes the average of an entire PDL. For slightly more comprehensive @@ -240,7 +239,7 @@ standard deviation, and population RMS) as separate PDLs in list context; see the online documentation for more details. -=head2 General purpose collapse/reduction: C<reduce> +=head3 General purpose collapse/reduction: C<reduce> PDL comes with an ancillary module, C<PDL::reduce>, that supplies a general-purpose C<reduce> function. C<reduce> is useful for collapsing @@ -254,7 +253,7 @@ C<< $mask->mv(1,0)->orover >>). You must explicitly use C<PDL::reduce> before you can invoke the reduce operator. -=head1 Combination operators: PDLs and Perl lists +=head2 Combination operators: PDLs and Perl lists Perl arrays/lists are different than PDLs, but often you will want to assemble a PDL from a list of values (or other PDLs), or @@ -265,7 +264,7 @@ into lists of smaller chunks, that are appropriate for looping over. -=head2 Global glomming / shredding: pdl and list +=head3 Global glomming / shredding: pdl and list The PDL constructor, C<pdl()>, can combine multiple PDLs into one, glomming a bunch of stuff together into a single data array. For @@ -295,7 +294,7 @@ problem with C<list> is that it loses all dimensional information, so you might prefer to have more control. Read on! -=head2 Gathering/scattering: C<cat> and C<dog> +=head3 Gathering/scattering: C<cat> and C<dog> If you have a collection of same-sized, same-type PDLs, you can concatenate them with C<cat>: @@ -317,7 +316,7 @@ exactly undoes the effect of catting a collection of PDLs together. -=head2 Extending a PDL: C<append> +=head3 Extending a PDL: C<append> You can extend a PDL along the 0 dimension with C<append>. All other dimensions must agree, thread-wise, between the original PDL and @@ -343,7 +342,7 @@ ) to append along any dimension of the input PDL, but read on: there is a better way to do that... -=head2 Finer control - use C<glue> +=head3 Finer control - use C<glue> The C<glue> method acts just like C<append>, but along a specified @@ -362,7 +361,7 @@ which eliminates the dimensional gymnastics you would have to do with C<append>. -=head1 Interpolation +=head2 Interpolation Interpolation of values between integer array locations is a @@ -380,7 +379,7 @@ in Chapter [cha:Coordinate-Transformations], to do optimized resampling under a variety of coordinate transformations. -=head2 Interpolate virtually any regular grid: C<interpND> +=head3 Interpolate virtually any regular grid: C<interpND> The workhorse interpolator for PDL is C<interpND>. It works almost exactly like the C<indexND> operator described in [sub:IndexND], @@ -430,7 +429,7 @@ pdl> print $image->interpND($coords, {bound=>'forbid'}); index out-of-bounds in range -=head2 Interpolate on a 1-D irregular grid: interpol, interpolate +=head3 Interpolate on a 1-D irregular grid: interpol, interpolate For simple linear interpolation on a non-uniform grid, you can use C<interpolate> or C<interpol>. They will both use linear