Subject: PDL (Perl Data Language) 1.9902, numeric programming in Perl
From: [email-masked] (Tuomas Lukka)
Date: 19 Mar 1998 19:34:45 GMT
Newsgroups: comp.lang.perl.announce,comp.lang.perl.modules

The beta version 1.9902 of PDL is now available on CPAN. 

PDL is a freely-available number-crunching extension for perl, which
allows fast and memory-efficient manipulation of large numerical
datasets.  You can write normal perl syntax ($c = $a + $b) to
manipulate vectors or matrices or N-dimensional data. Sample
applications (in which PDL has already been used) include image
processing, two and three dimensional plotting, pipeline data
reduction, quick-look data visualisation, neural networks, machine
learning, medical visualization, hydrodynamics and quantum-mechanical
simulations.  While these have historically been the domain of special
purpose matrix-oriented languages such as IDL(R/Tm)* and MatLab(R/Tm)*,
PDL allows Perl to be used in just such a manner. PDL has a very
open-architecture and is easy to interface to new subroutine and
graphics libraries.

One of the main advantages of PDL over similar packages is the
availability of the enormous, and heavily used, perl software base.
Available to PDL users are powerful string and file handling, well
developed interfaces to C, Fortran, and Java, to GUI toolkits such as
tk and gtk, to databases, ftp, the web, etc.  The user will find that
these features offer indispensable support to the number crunching
routines.

See http://www.aao.gov.au/local/www/kgb/perldl/ for more info
and links.

New features after 1.11 are countless but here is an overview:
	 - a simple but powerful interface to 3-dimensional OpenGL
	   visualization routines with animation (PDL::Graphics::TriD),
	   also supports VRML to some degree.

	 - assigning to slices of piddles / indexed piddles (e.g.
	   after
		$a = zeroes 100,100; 
		$b = $a->diagonal(0,1); # diagonal between dims 0 and 1 
		$b .= 1; # PDL special assignment operator 
	   $a contains a unit matrix). Also to piddles indexed
	   by other piddles.

	 - efficient manipulation of multidimensional data.

	 - preprocessor for interfacing external C routines with
	   little work for multiple datatypes and writing new fast
	   routines while avoiding loop index bugs.

	 - new IO formats, e.g. netCDF, NDF, GIF, TIFF, JPG.
	   Also, flexible access to raw binary data from C and
	   FORTRAN programs.

	 - many new routines for data processing

	 - online help in the perldl shell

	 - interactive matrix browser using curses
	   (PDL::IO::Browser)

	 - quick random access to data by mmapping it from the disk
	   (PDL::IO::FastRaw::mapfraw)

	 - interface to Karma applications toolkit for alternative 3d
	   visualisation (PDL::Graphics::Karma)

	 - object-oriented internal design allowing users to
	   derive their own objects from piddles.

People interested in doing numeric processing are encouraged to pick
this software up and give it a test run.

Because this is beta-stage software, the documentation, although quite
extensive, may not always be the most informative possible to help
beginners get going in PDL. We will be glad to answer your questions
(and add the instructions to the FAQ and to the documentation for other
users) at our mailinglist [email-masked]

KNOWN PROBLEMS WITH 1.9902:

 - picrgb tests fail on some platforms due to unavailable converters
 - Graphics/TriD/OpenGL compilation may fail - try generate.pl 
   in that directory

PLEASE READ THE FILES "INSTALL", "README" and "DEPENDENCIES" 
in the distribution for other possible problems.

=== From introduction to PDL:

Perl is an extremely good and versatile scripting language, well suited
to beginners and allows rapid prototyping. However until recently it
did not support data structures which allowed it to do fast number
crunching.

However with the development of Perl v5, Perl acquired 'Objects'. To
put it simply users can define their own special data types, and write
custom routines to manipulate them either in low level languages (C and
Fortran) or in Perl itself.

This has been fully exploited by the PerlDL developers. The 'PDL'
module is a complete Object-Oriented extension to Perl (although you
don't have to know what an object is to use it) which allows large
N-dimensional data sets, such as large images, spectra, time series,
etc to be stored  B<efficiently> and manipulated B<en masse>.  For
example  with the PDL module we can write the perl code C<$a=$b+$c>,
where $b and $c are large datasets (e.g. 2048x2048 images), and get the
result in only a fraction of a second.

PDL variables (or 'piddles' as they have come to be known) support a
wide range of fundamental data types - arrays can be bytes, short
integers (signed or unsigned), long integers, floats or double
precision floats. And because of the Object-Oriented nature of PDL new
customised datatypes can be derived from them.

As well as the PDL modules, that can be used by normal perl programs,
PerlDL comes with a command line perl shell, called 'perldl', which
supports command line editing. In combination with the various PDL
graphics modules this allows data to be easily played with and
visualised.

* all trademarks are owned by their owners.

+ THERE IS ABSOLUTELY NO WARRANTY WITH THIS SOFTWARE - SEE THE FILE
'COPYING' IN THE DISTRIBUTION FOR DETAILS.
-- 
#!/usr/bin/perl -MPDL -MPDL::Graphics::TriD
$s=150;$a=zeroes $s,$s;$r=$a->xvals/$s*2-1.5;$i=$a->yvals/$s*2-1;$t=$r;
$u=$i;for(0..20){$q=$r**2-$i**2+$t;$h=2*$r*$i+$u;($r,$i)=map{$_->hclip(
5)->lclip(-5)}($q,$h);}imagrgb[($r**2+$i**2)>2.0];