... module0.1
The PGPLOT module for perl is an interface to the pgplot graphics library (written in C and Fortran) created by Tim Pearson of Caltech. More information about this library can be obtained from: http://astro.caltech.edu/ $\tilde{\hspace{0.4em}}$tjp/pgplot/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Inc.0.2
www.rsinc.com
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Inc.0.3
www.mathworks.com
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Octave0.4
www.octave.org
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Perl?0.5
Of course the real reason we chose Perl was because we were using it already and liked it a lot. These `reasons' are really `compelling rationalisations'!
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... NumPy0.6
www.pfdubois.com/numpy/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... RLAB0.7
rlab.sourceforge.net
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... image.1.1
Try `imag(rvals(200,200))' and you will see better what we mean!
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... filename.1.2
In fact there are many ways of running it, most systems allows it to be setup so you can just type filename. See your local Perl documentation -- the the perlrun manual page.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... this!1.3
Alright. KGB confesses: he faked this up.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... galaxy.1.4
Answer: about 2%
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... zero.1.5
For reasons of efficiency complex numbers are represented in PDL by seperate real and imaginary arrays -- more about this in Chapter 2.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... function:2.1
Object methods such as $a->copy are also available, more on this later
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... speed.2.2
This is about 7 million numbers per second on Karl's state-of-the-art laptop. Which by the time you are reading this is probably a rather daggy laptop.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... memory!2.3
PDL has the power to make your computer go all weak at the knees, with minimal typing. But if you really need to have everything in memory you can memory map your hard disk directly with mapfraw in PDL::Io::FastRaw.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... dimensions'2.4
No one to one relation to threads of execution on parallel computers though some versions of PDL will actually implement threading this way!
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... dimension'3.1
No relation to the Dungeon Dimensions in Terry Pratchett's `Discworld'!
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...$ piddles$3.2
If you want to know more about the info method check Appendix XX or try help info from within the perldl shell
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...maximum3.3
remember, quickest way: at the perldl shell prompt type ? maximum
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... piddle3.4
An N-dimensional piddle can be viewed as an (N-1)-dimensional array of one-dimensional subslices.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... want3.5
mv would have been another possible choice: $im3d->mv(1,0)->maximum
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...Yorick3.6
Yorick referenceXXX
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... J3.7
XXXrefs for both, although well hidden by a wealth of terminology and notation very different from that of most other conventional computer languages
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... involved3.8
maybe you would like to write such a routine as an exercise to entertain yourself, well, maybe not
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...Benchmark3.9
for more details see perldoc Benchmark
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... generates3.10
exact numbers obviously depend on the actual computer used
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... general3.11
mymax only deals with 2D input
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... loops3.12
using the POSIX pthread software interface. See XXX
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... execution3.13
multithreading will only be used if your hardware platform supports this and PDL is set up accordingly, check Appendix XX
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Pearson4.1
PGPLOT can be obtained from http://www.astro.caltech.edu/tjp/pgplot/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... in4.2
Note that it is actually not necessary to do this manually as PDL::Graphics::PGPLOT will do this automatically for you as in the previous section, but very often you would want to modify this.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... approach4.3
It is possible to have several plot windows without using the OO approach, although more cumbersome, see the on-line documentation for details.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... PGPLOT4.4
Written and maintained by Karl Glazebrook, and can be downloaded at any CPAN mirror (it is a prerequisite for the PDL package).
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... KISS4.5
Keep It Simple, Stupid
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Program''.4.6
The official GIMP webpage is http://www.gimp.org/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...gimp-perl.4.7
The ``official'' and only homepage for gimp perl can be found at http://gimp.pages.de/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... GMT6.1
GMT (Generic Mapping Tools), is a suite of UNIX tools for drawing maps and plotting data on them. Included is a scrupulously assembled set of world coastline databases at various resolutions. GMT was created by Paul Wessel and Walter H. F. Smith.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... data6.2
These data are generally available in a compact yet obtuse binary format called 'GRIB' which is distributed via the Internet Data Distribution system (see http://www.unidata.ucar.edu /projects/idd/index.html) and then converted to the nicer netCDF format (see http://www.unidata.ucar.edu /packages/netcdf/index.html) via the Unidata Decoders (info at http://www.unidata.ucar.edu /packages/decoders/index.html).
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... documentation6.3
on the web at http://astro.caltech.edu /tjp/pgplot/subroutines.html#PGCONT
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... matrices6.4
Of course, PDL objects can have any number of dimensions.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... hash6.5
Actually it can be any type, but if you expect to work well with others you should use a hash.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... difficult6.6
''Hopefully nobody else called her function shift... Oops.''
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... objects6.7
e.g. for objects not representing numbers, like an audio signal or an image.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... piddles6.8
which makes sense in a lot of cases where the derived class just adds new data or new methods but does not alter semantics.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... (addition)6.9
Of course Csub is the same as the normal subtraction operator. However, for reasons that will be explained shortly, the subtraction operator must be overloaded, so it doesn't hurt to implement it for completeness or symmetry, or whatever. Csub might also be slightly faster in case the compiler doesn't do loop unrolling
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... sine):6.10
If you are not interested in PP code you can safely skip this example
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... neccessary6.11
The manpage to the overload pragma explains this in greater detail.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... cases6.12
The Complex module was already used for some projects when Christian Söller pointed out that something must be badly broken somewhere.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... operation6.13
One could argue that this is not very helpful, but at least it sounds consistent.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... module6.14
e.g. by perldoc -m Complex
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.