1FAQ(1)                User Contributed Perl Documentation               FAQ(1)
2
3
4

NAME

6       PDL::FAQ - Frequently asked questions about PDL
7

VERSION

9       Current FAQ version:  1.008
10

DESCRIPTION

12       This is version 1.008 of the PDL FAQ, a collection of  frequently asked
13       questions about PDL - the Perl Data Language.
14

ABOUT THIS DOCUMENT

16   Q: 1.1    Where to find this document
17       You can find the latest version of this document at
18       <http://pdl.perl.org/?docs=FAQ&title=Frequently%20Asked%20Questions> .
19
20   Q: 1.2    How to contribute to this document
21       This is a considerably reworked version of the PDL FAQ. As such many
22       errors might have crept in and many updates might not have made it in.
23       You are explicitly encouraged to let us know about questions which you
24       think should be answered in this document but currently aren't.
25
26       Similarly, if you think parts of this document are unclear, please tell
27       the FAQ maintainer about it. Where a specific answer is taken in full
28       from someones posting the authorship should be indicated, let the FAQ
29       maintainer know if it isn't. For more general information explicit
30       acknowledgment is not made in the text, but rather there is an
31       incomplete list of contributors at the end of this document. Please
32       contact the FAQ maintainer if you feel hard done by.
33
34       Send your comments, additions, suggestions or corrections to the PDL
35       mailing list at pdl-general@lists.sourceforge.net.  See Q: 3.2 below
36       for instructions on how to join the mailing lists.
37

GENERAL QUESTIONS

39   Q: 2.1    What is PDL ?
40       PDL stands for Perl Data  Language . To say it with the words of Karl
41       Glazebrook, initiator of the PDL project:
42
43           The PDL concept is to give standard perl5 the ability
44           to COMPACTLY store and SPEEDILY manipulate the large
45           N-dimensional data sets which are the bread and butter
46           of scientific computing. e.g. $x=$y+$z can add two
47           2048x2048 images in only a fraction of a second.
48
49       It provides tons of useful functionality for scientific and numeric
50       analysis.
51
52       For readers familiar with other scientific data evaluation packages it
53       may be helpful to add that PDL is in many respects similar to IDL,
54       MATLAB and similar packages. However, it tries to improve on a number
55       of issues which were perceived (by the authors of PDL) as shortcomings
56       of those existing packages.
57
58   Q: 2.2    Who supports PDL? Who develops it?
59       PDL is supported by its users. General informal support for PDL is
60       provided through the PDL mailing list
61       (pdl-general@lists.sourceforge.net , see below).
62
63       As a Perl extension (see Q: 2.5 below) it is devoted to the idea of
64       free and open development put forth by the Perl community. PDL was and
65       is being actively developed by a loosely knit group of people around
66       the world who coordinate their activities through the PDL development
67       mailing list (pdl-devel@lists.sourceforge.net , see Q: 3.2 below). If
68       you would like to join in the ongoing efforts to improve PDL please
69       join this list.
70
71   Q: 2.3    Why yet another Data Language ?
72       There are actually several reasons and everyone should decide for
73       themselves which are the most important ones:
74
75       •   PDL is "free software". The authors of PDL think that this concept
76           has several advantages: everyone has access to the sources ->
77           better debugging, easily adaptable to your own needs, extensible
78           for your purposes, etc... In comparison with commercial packages
79           such as MATLAB and IDL this is of considerable importance for
80           workers who want to do some work at home and cannot afford the
81           considerable cost to buy commercial packages for personal use.
82
83       •   PDL is based on a powerful and well designed scripting language:
84           Perl. In contrast to other scientific/numeric data analysis
85           languages it has been designed using the features of a proven
86           language instead of having grown into existence from scratch.
87           Defining the control structures while features were added during
88           development leads to languages that often appear clumsy and badly
89           planned for most existing packages with similar scope as PDL.
90
91       •   Using Perl as the basis a PDL programmer has all the powerful
92           features of Perl at their hand, right from the start. This includes
93           regular expressions, associative arrays (hashes), well designed
94           interfaces to the operating system, network, etc. Experience has
95           shown that even in mainly numerically oriented programming it is
96           often extremely handy if you have easy access to powerful semi-
97           numerical or completely non-numerical functionality as well. For
98           example, you might want to offer the results of a complicated
99           computation as a server process to other processes on the network,
100           perhaps directly accepting input from other processes on the
101           network. Using Perl and existing Perl extension packages things
102           like this are no problem at all (and it all will fit into your "PDL
103           script").
104
105       •   Extremely easy extensibility and interoperability as PDL is a Perl
106           extension; development support for Perl extensions is an integral
107           part of Perl and there are already numerous extensions to standard
108           Perl freely available on the network.
109
110       •   Integral language features of Perl (regular expressions, hashes,
111           object modules) immensely facilitated development and
112           implementation of key concepts of PDL. One of the most striking
113           examples for this point is probably PDL::PP (see Q: 6.16 below), a
114           code generator/parser/pre-processor that generates PDL functions
115           from concise descriptions.
116
117       •   None of the existing data languages follow the Perl language rules,
118           which the authors firmly believe in:
119
120           •   TIMTOWTDI: There is more than one way to do it.  Minimalist
121               languages are interesting for computer scientists, but for
122               users, a little bit of redundancy makes things wildly easier to
123               cope with and allows individual programming styles - just as
124               people speak in different ways. For many people this will
125               undoubtedly be a reason to avoid PDL ;)
126
127           •   Simple things are simple, complicated things possible: Things
128               that are often done should be easy to do in the language,
129               whereas seldom done things shouldn't be too cumbersome.
130
131           All existing languages violate at least one of these rules.
132
133       •   As a project for the future PDL should be able to use super
134           computer features, e.g. vector capabilities/parallel processing,
135           GPGPU acceleration. This will probably be achieved by having
136           PDL::PP (see Q: 6.16 below) generate appropriate code on such
137           architectures to exploit these features.
138
139       •   [ fill in your personal 111 favourite reasons here...]
140
141   Q: 2.4    What is PDL good for ?
142       Just in case you do not yet know what the main features of PDL are and
143       what one could do with them, here is a (necessarily selective) list of
144       key features:
145
146       PDL is well suited for matrix computations, general handling of
147       multidimensional data, image processing, general scientific
148       computation, numerical applications. It supports I/O for many popular
149       image and data formats, 1D (line plots), 2D (images) and 3D (volume
150       visualization, surface plots via OpenGL - for instance implemented
151       using Mesa or video card OpenGL drivers), graphics display capabilities
152       and implements many numerical and semi-numerical algorithms.
153
154       Through the powerful pre-processor it is also easy to interface Perl to
155       your favorite C routines, more of that further below.
156
157   Q: 2.5    What is the connection between PDL and Perl ?
158       PDL is a Perl5 extension package. As such it needs an existing Perl5
159       installation (see below) to run. Furthermore, much of PDL is written in
160       Perl (+ some core functionality that is written in C). PDL programs are
161       (syntactically) just Perl scripts that happen to use some of the
162       functionality implemented by the package "PDL".
163
164   Q: 2.6    What do I need to run PDL on my machine ?
165       Since PDL is just a Perl5 package you need first of all an installation
166       of Perl5 on your machine. As of this writing PDL requires version
167       5.10.x of perl, or higher.  More information on where and how to get a
168       Perl installation can be found at the Perl home page
169       <http://www.perl.org> and at many CPAN sites (if you do not know what
170       CPAN is, check the answer to the next question).
171
172       To build PDL you also need a working C compiler, support for Xsubs, and
173       the package Extutils::MakeMaker. If you don't have a compiler there
174       might be a binary distribution available, see "Binary distributions"
175       below.
176
177       If you can (or cannot) get PDL working on a new (previously
178       unsupported) platform we would like to hear about it. Please, report
179       your success/failure to the PDL mailing list at
180       pdl-general@lists.sourceforge.net . We will do our best to assist you
181       in porting PDL to a new system.
182
183   Q: 2.7    Where do I get it?
184       PDL is available as source distribution in the Comprehensive Perl
185       Archive Network (or CPAN) and from the GitHub project page at
186       <https://github.com/PDLPorters/pdl>.  The CPAN archives contains not
187       only the PDL distribution but also just about everything else that is
188       Perl-related.  CPAN is mirrored by dozens of sites all over the world.
189       The main site is <http://www.cpan.org>, and local CPAN sites (mirrors)
190       can be found there. PDL's homepage is at <http://pdl.perl.org> and the
191       latest version can also be downloaded from there.
192
193   Q: 2.8    What do I have to pay to get PDL?
194       We are delighted to be able to give you the nicest possible answer on a
195       question like this: PDL is *free software* and all sources are publicly
196       available. But still, there are some copyrights to comply with. So
197       please, try to be as nice as we (the PDL authors) are and try to comply
198       with them.
199
200       Oh, before you think it is *completely* free: you have to invest some
201       time to pull the distribution from the net, compile and install it and
202       (maybe) read the manuals.
203

GETTING HELP/MORE INFORMATION

205   Q: 3.1    Where can I get information on PDL?
206       The complete PDL documentation is available with the PDL distribution.
207       Use the command "perldoc PDL" to start learning about PDL.
208
209       The easiest way by far, however, to get familiar with PDL is to use the
210       PDL on-line help facility from within the PDL shell, "pdl2"  Just type
211       "pdl2" at your system prompt. Once you are inside the "pdl2" shell type
212       "help" .  Using the "help" and "apropos" commands inside the shell you
213       should be able to find the way round the documentation.
214
215       Even better, you can immediately try your newly acquired knowledge
216       about PDL by issuing PDL/Perl commands directly at the command line. To
217       illustrate this process, here is the record of a typical "pdl2" session
218       of a PDL beginner (lengthy output is only symbolically reproduced in
219       braces ( <... ...> ) ):
220
221           unix> pdl2
222           pdl> help
223           < ... help output ... >
224           pdl> help PDL::QuickStart
225           < ... perldoc page ... >
226           pdl> $x = pdl (1,5,7.3,1.0)
227           pdl> $y = sequence float, 4, 4
228           pdl> help inner
229           < ... help on the 'inner' function ... >
230           pdl> $c = inner $x, $y
231           pdl> p $c
232           [22.6 79.8 137 194.2]
233
234       For further sources of information that are accessible through the
235       Internet see next question.
236
237   Q: 3.2    Are there other PDL information sources on the Internet?
238       First of all, for all purely Perl-related questions there are tons of
239       sources on the net. Good points to start are <http://www.perl.com> and
240       <http://www.perl.org> .
241
242       The PDL home site can be accessed by pointing your web browser to
243       <http://pdl.perl.org> . It has tons of goodies for anyone interested in
244       PDL:
245
246       •   PDL distributions
247
248       •   On-line documentation
249
250       •   Pointers to an HTML archive of the PDL mailing lists
251
252       •   A list of platforms on which PDL has been successfully tested.
253
254       •   News about recently added features, ported libraries, etc.
255
256       •   Name of the current pumpkin holders for the different PDL modules
257           (if you want to know what that means you better had a look at the
258           web pages).
259
260       If you are interested in PDL in general you can join the pdl-general
261       mailing list. This is a forum to discuss programming issues in PDL,
262       report bugs, seek assistance with PDL related problems, etc.
263
264       If you are interested in all the technical details of the ongoing PDL
265       development you can join the pdl-devel mailing list.
266
267       Subscription and current archive links to both mailing lists can be
268       found at <http://pdl.perl.org/?page=mailing-lists>.
269
270       Cross-posting between these lists should be avoided unless there is a
271       very good reason for doing that.
272
273       The PDL project, begun in the late 1990s, has undergone considerable
274       evolution since that time, and the support for it has as well. Thus
275       mailing-list archives are in several places.  Originally pdl-general
276       was called 'perldl', and pdl-devel was called 'pdl-porters'.
277
278       |Time Period | URL                                                   |
279       |------------|-------------------------------------------------------|
280       |1996 - 2004 | http://www.xray.mpe.mpg.de/mailing-lists/perldl/      |
281       |1997 - 2004 | http://www.xray.mpe.mpg.de/mailing-lists/pdl-porters/ |
282       |2005 - 2015 | http://perldl.jach.hawaii.narkive.com/                |
283       |2005 - 2015 | http://pdl-porters.jach.hawaii.narkive.com/           |
284       |2015 -      | https://sourceforge.net/p/pdl/mailman/pdl-general/    |
285       |2015 -      | https://sourceforge.net/p/pdl/mailman/pdl-devel/      |
286       |--------------------------------------------------------------------|
287
288   Q: 3.3    What is the current version of PDL ?
289       As of this writing (FAQ version 1.008 of 21 May 2017) the latest stable
290       version is 2.018.  The latest stable version should always be available
291       from a CPAN mirror site near you (see Question 2.7 for info on where to
292       get PDL).
293
294       The most current (possibly unstable) version of PDL can be obtained
295       from the Git repository, see Question 4.10 and periodic CPAN developers
296       releases of the Git code will be made for testing purposes and more
297       general availability.
298
299   Q: 3.4  How can PDL-2.2 be older than PDL-2.007?
300       Over its development, PDL has used both a single floating point version
301       number (from the versions 1.x through 2.005) at which point it switched
302       to a dotted triple version for 2.1.1 onward---EXCEPT for version 2.2
303       which came out which should have been 2.2.0.  To simplify and unify
304       things, PDL has reverted to a single float version representation with
305       PDL-2.006.  This can cause dependency problems for modules that set a
306       minimum PDL version of 2.2.  The work around it, note that all extant
307       PDL releases have version numbers greater than 2.2.1 so that using 0 as
308       the minimum version will work.
309
310   Q: 3.5    I want to contribute to the further development of PDL. How can I
311       help?
312       Two ways that you could help almost immediately are (1) participate in
313       CPAN Testers for PDL and related modules, and (2) proofreading and
314       clarifying the PDL documentation so that it is most useable for PDL
315       users, especially new users.
316
317       To participate in CPAN Testers and contribute test reports, the page
318       <http://wiki.cpantesters.org/wiki/QuickStart> has instructions for
319       starting for either "CPAN" or "CPANPLUS" users.
320
321       If you have a certain project in mind you should check if somebody else
322       is already working on it or if you could benefit from existing modules.
323       Do so by posting your planned project to the PDL developers mailing
324       list at pdl-devel@lists.sourceforge.net . See the subscription
325       instructions in Question 3.2.  We are always looking for people to
326       write code and/or documentation ;).
327
328   Q: 3.6    I think I have found a bug in the current version of PDL. What
329       shall I do?
330       First, make sure that the bug/problem you came across has not already
331       been dealt with somewhere else in this FAQ.  Secondly, you can check
332       the searchable archive of the PDL mailing lists to find whether this
333       bug has already been discussed.  If you still haven't found any
334       explanations you can post a bug report to
335       pdl-general@lists.sourceforge.net , or through the Bugs link on
336       <http://pdl.perl.org> .  See the BUGS file in the PDL distribution for
337       what information to include.  If you are unsure, discussions via the
338       perldl mailing list can be most helpful.
339

INSTALLATION

341   Q: 4.1    I have problems installing PDL. What shall I do?
342       First make sure you have read the file INSTALL in the distribution.
343       This contains a list of common problems which are unnecessary to repeat
344       here.
345
346       Next, check the file perldl.conf to see if by editing the configuration
347       options in that file you will be able to successfully build PDL. Some
348       of the modules need additional software installed, please refer to the
349       file DEPENDENCIES for further details. Make sure to edit the location
350       of these packages in perldl.conf if you have them in non-standard
351       locations.
352
353       N.B. Unix shell specific: If you would like to save an edited
354       perldl.conf for future builds just copy it as ~/.perldl.conf into your
355       home directory where it will be picked up automatically during the PDL
356       build process.
357
358       Also, check for another, pre-existing version of PDL on the build
359       system.  Multiple PDL installs in the same PATH or @INC can cause
360       puzzling test or build failures.
361
362       If you still can't make it work properly please submit a bug report
363       including detailed information on the problems you encountered to the
364       perldl mailing list ( pdl-general@lists.sourceforge.net , see also
365       above). Response is often rapid.
366
367   Q: 4.2    Are there configuration files for PDL I have to edit?
368       Most users should not have to edit any configuration files manually.
369       However, in some cases you might have to supply some information about
370       awkwardly placed include files/libraries or you might want to
371       explicitly disable building some of the optional PDL modules.  Check
372       the files INSTALL and perldl.conf for details.
373
374       If you had to manually edit perldl.conf and are happy with the results
375       you can keep the file handy for future reference. Place it in
376       ~/.perldl.conf where it will be picked up automatically or use "perl
377       Makefile.PL  PDLCONF=your_file_name" next time you build PDL.
378
379   Q: 4.3    Do I need other software for successful operation?
380       For the basic PDL functionality you don't need any additional software.
381       However, some of the optional PDL modules included in the distribution
382       (notably most graphics and some I/O modules) require certain other
383       libraries/programs to be installed. Check the file DEPENDENCIES in the
384       distribution for details and directions on how to get these.
385
386   Q: 4.4    How can I install PDL in a non-standard location?
387       To install PDL in a non-standard location, use the INSTALL_BASE option
388       in the "perl Makefile.PL" configure step.  For example, "perl
389       Makefile.PL INSTALL_BASE=/mydir/perl5" will configure PDL to install
390       into the tree rooted at "/mydir/perl5".  For more details see "How do I
391       keep my own module/library directory?" in perlfaq8 and subsequent
392       sections.  Another alternative is to use local::lib to do the heavy
393       lifting for the needed configuration.
394
395   Q: 4.5    How can I force a completely clean installation?
396       To guarantee a completely clean installation of PDL, you will need to
397       first delete the current installation files and folders.  These will be
398       all directories named "PDL" in the Perl @INC path, files named
399       "*Pdlpp*" in any "Inline" directories, and the programs "pdl, pdldoc,
400       pdl2, perldl, and pptemplate".  Then just build and install as usual.
401       This is much easier to keep track of if you always install "PDL" into a
402       non-standard location.  See Q: 4.4 above.
403

BINARY DISTRIBUTIONS

405   Q: 4.5    What binary distributions are available?
406       Information about binary distributions of PDL can be found on
407       <http://pdl.perl.org> .  At present there are binary distributions of
408       PDL for Linux (RedHat and Debian), FreeBSD, Mac OS X and Windows,
409       though they might not be the most recent version.
410
411       If someone is interested in providing binary distributions for other
412       architectures, that would be very welcome. Let us know on the
413       pdl-devel@lists.sourceforge.net mailing list. Also check your Linux
414       distribution's package manager as many now include PDL.  PPMs for win32
415       versions (both 32bit and 64bit) are also available.
416
417   Q: 4.6    Does PDL run on Linux? (And what about packages?)
418       Yes, PDL does run on Linux and indeed much of the development has been
419       done under Linux. On <http://pdl.perl.org> you can find links to
420       packages for some of the major distributions. Also check your
421       distribution's package manager (yum, apt, urpmi, ...)  as PDL is now
422       found by many of these.
423
424   Q: 4.7    Does PDL run under Windows?
425       PDL builds fine on Win32 using MinGW or Microsoft compilers.  See the
426       win32/INSTALL file in the PDL source distribution for details.  Other
427       compilers have not been tested--input is welcome.  There is also a
428       distribution of PDL through ActiveState's ppm, though it might not
429       always be the latest version.  PDL-2.018 builds out of the box on
430       Strawberry Perl and ActiveState Perl and there are distributions of
431       Strawberry Perl with bundled PDL (see
432       <http://strawberryperl.com/releases.html>).
433

CVS, GIT, AND ON-GOING DEVELOPMENT

435   Q: 4.8    Can I get PDL via CVS?
436       No.  PDL development was conducted with a CVS repository from December
437       1999 to April 2009.  In April 2009 the project switched to the Git
438       version control system (see <http://git-scm.com>).
439
440   Q: 4.9    How do I get PDL via Git?
441       Assume you have Git installed on your system and want to download the
442       project source code into the directory "PDL". To get read-only access
443       to the repository, you type at the command line
444
445          git clone git://github.com/PDLPorters/pdl
446
447       If you wish to submit changes to PDL, you should "fork" the repository
448       from <https://github.com/PDLPorters/pdl>, then clone your fork in the
449       normal fashion.
450
451       To become an official PDL developer, you will need to be added to the
452       GitHub "PDLPorters" organisation.
453
454       For official PDL developers, to get read/write access to the repository
455       type at the command line
456
457          git clone git://github.com/PDLPorters/pdl
458
459       They can still use their own fork; at least one active developer uses
460       that model rather than branches on the main repository.
461
462   Q: 4.10   I had a problem with the Git version, how do I check if someone
463       has submitted a patch?
464       The best way is to check <https://github.com/PDLPorters/pdl/pulls> to
465       see if somebody has submitted a pull request related to your problem.
466
467       In addition, if you are not subscribing to the mailing list, check the
468       archive of the "pdl-devel" and "pdl-general" mailing lists.  See
469       Question 3.2 for details.
470
471   Q: 4.11   I have gotten developer access to Git, how do I upload my
472       changes?
473       The first thing you should do is to read the Git documentation and
474       learn the basics about Git. There are many sources available online.
475       It is very important that you use Git "best practice", with branches,
476       but fortunately this is very easy! Here are the basics.
477
478       Make sure your copy is up to date with the main repo:
479
480          git checkout master
481          git pull --rebase # rebase in case you wrongly changed your own master
482
483       Make a branch:
484
485          git checkout -b mybranch-name
486
487       Commit your changes locally:
488
489          git add <file1> <file2> ...
490          git commit
491
492       or combine these two with:
493
494          git commit -a
495
496       Test the PDL before you push it to the main repository.  If the code is
497       broken for you, then it is most likely broken for others.  Luckily, the
498       rest of this process will test that automatically to help you catch
499       such errors.
500
501       Then update the shared repository with your changes:
502
503          git push -u origin mybranch-name
504
505       This will still leave your changes on a branch, but this is good. Now
506       go to the GitHub page, <https://github.com/PDLPorters/pdl>. It will ask
507       you whether you want to make a "pull request" - you do. Follow the
508       prompts. This will then initiate the automated "continuous integration"
509       tests, on Linux and Windows, with various versions of Perl, with
510       various compilers. You will also want to get at least one other
511       developer to review your changes.
512
513       Once this review process is successfully completed, you can merge your
514       changes to the master branch!
515

PDL JARGON

517   Q: 5.1    What is broadcasting (is PDL a newsreader)?
518       Until 2.075, "threading" was used to refer to two ideas, but that
519       ambiguity has now been resolved by using the now (as of 2022) industry-
520       standard term "broadcasting" for the vectorisation / array-programming
521       concept.
522
523       •   When mentioned in the INSTALL directions and possibly during the
524           build process we have the usual computer science meaning of multi-
525           threading in mind (useful mainly on multiprocessor machines or
526           clusters), currently (as of 2.074) POSIX threads (see
527           PDL::ParallelCPU).
528
529       •   PDL broadcasting of operations on ndarrays (as mentioned in the
530           indexing docs) is the iteration of a basic operation over
531           appropriate sub-slices of ndarrays, e.g. the inner product "inner
532           $x, $y" of a (3) pdl $x and a (3,5,4) pdl $y results in a (5,4)
533           ndarray where each value is the result of an inner product of the
534           (3) pdl with a (3) sub-slice of the (3,5,4) ndarray.  For details
535           check PDL::Indexing
536
537       The connection is that broadcasting divides up independent operations
538       that can be done in parallel.
539
540   Q: 5.2    What is an ndarray?
541       Well, PDL scalar variables (which are instances of a particular class
542       of Perl objects, i.e. blessed thingies (see "perldoc perlobj" )) are in
543       common PDL parlance often called ndarrays (for example, check the
544       mailing list archives).  Err, clear?  If not, simply use the term
545       ndarray when you refer to a PDL variable (an instance of a PDL object
546       as you might remember) regardless of what actual data the PDL variable
547       contains.
548

TECHNICAL QUESTIONS

550   Q: 6.1    What is perldl?   What is pdl2?
551       Sometimes "perldl" ("pdl2") is used as a synonym for PDL. Strictly
552       speaking, however, the name "perldl" ("pdl2") is reserved for the
553       little shell that comes with the PDL distribution and is supposed to be
554       used for the interactive prototyping of PDL scripts. For details check
555       perldl or pdl2.
556
557   Q: 6.2    How do I get on-line help for PDL?
558       Just type "help" (shortcut = "?") at the "pdl2" shell prompt and
559       proceed from there. Another useful command is the "apropos" (shortcut =
560       "??") command.  Also try the "demo" command in the "perldl" or "pdl2"
561       shell if you are new to PDL.
562

MANIPULATION OF NDARRAYS

564   Q: 6.3    I want to access the third element of a pdl but $x[2] doesn't
565       work ?!
566       See answer to the next question why the normal Perl array syntax
567       doesn't work for ndarrays.
568
569   Q: 6.4    The docs say ndarrays are some kind of array. But why doesn't the
570       Perl array syntax work with ndarrays then ?
571       OK, you are right in a way. The docs say that ndarrays can be thought
572       of arrays.  More specifically, it says ( PDL::QuickStart ):
573
574           I find when using the Perl Data Language it is most useful
575           to think of standard Perl @x variables as "lists" of generic
576           "things" and PDL variables like $x as "arrays" which can be
577           contained in lists or hashes.
578
579       So, while ndarrays can be thought of as some kind of multi-dimensional
580       array they are  not arrays in the Perl sense. Rather, from the point of
581       view of Perl they are some special class (which is currently
582       implemented as an opaque pointer to some stuff in memory) and therefore
583       need special functions (or 'methods' if you are using the OO version)
584       to access individual elements or a range of elements. The
585       functions/methods to check are "at" / "set" (see the section 'Sections'
586       in PDL::QuickStart ) or the powerful "slice" function and friends (see
587       PDL::Slices and PDL::Indexing and especially PDL::NiceSlice ).
588
589       Finally, to confuse you completely, you can have Perl arrays of
590       ndarrays, e.g. $spec[3] can refer to a pdl representing ,e.g, a
591       spectrum, where $spec[3] is the fourth element of the Perl list (or
592       array ;) @spec .  This may be confusing but is very useful !
593
594   Q: 6.5    How do I concatenate ndarrays?
595       Most people will try to form new ndarrays from old ndarrays using some
596       variation over the theme: "$x =  pdl([$y, 0, 2])".  This does work, but
597       may not work in the way that a novice user would expect. (If $y has N
598       dimensions then $x will have N+1 dimensions.) Other ways to concatenate
599       ndarrays are to use the functions "cat", "append", and "glue".
600       Similarly you can split ndarrays using the command "dog".
601
602   Q: 6.6    Sometimes I am getting these strange results when using inplace
603       operations?
604       This question is related to the "inplace" function. From the
605       documentation (see PDL::QuickStart):
606
607           Most functions, e.g. log(), return a result which is a
608           transformation of their argument. This makes for good
609           programming practice. However many operations can be done
610           "in-place" and this may be required when large arrays are in
611           use and memory is at a premium. For these circumstances the
612           operator inplace() is provided which prevents the extra copy
613           and allows the argument to be modified. e.g.:
614
615           $x = log($array);          # $array unaffected
616           log( inplace($bigarray) ); # $bigarray changed in situ
617
618       And also from the doc !!:
619
620           Obviously when used with some functions which can not be
621           applied in situ (e.g. convolve()) unexpected effects may
622           occur!
623
624   Q: 6.7    What is this strange usage of the string concatenation operator
625       ".="  in PDL scripts?
626       See next question on assignment in PDL.
627
628   Q: 6.8    Why are there two different kinds of assignment in PDL ?
629       This is caused by the fact that currently the assignment operator "="
630       allows only restricted overloading. For some purposes of PDL it turned
631       out to be necessary to have more control over the overloading of an
632       assignment operator. Therefore, PDL peruses the operator ".=" for
633       certain types of assignments.
634
635   Q: 6.9    How do I set a set of values in an ndarray?
636       In Perl 5.6.7 and higher this assignment can be made using lvalue
637       subroutines:
638
639           pdl> $x = sequence(5); p $x
640           [0 1 2 3 4]
641           pdl> $x->slice('1:2') .= pdl([5,6])
642           pdl> p $x
643           [0 5 6 3 4]
644
645       see PDL::Lvalue for more info.  PDL also supports a more matrix-like
646       slice syntax via the PDL::NiceSlice module:
647
648           pdl> $x(1:2) .= pdl([5,6])
649           pdl> p $x
650           [0 5 6 3 4]
651
652       With versions of Perl prior to 5.6.7 or when running under the perl
653       debugger this has to be done using a temporary variable:
654
655           pdl> $x = sequence(5); p $x
656           [0 1 2 3 4]
657           pdl> $tmp = $x->slice('1:2'); p $tmp;
658           [1 2]
659           pdl> $tmp .= pdl([5, 6]);    # Note .= !!
660           pdl> p $x
661           [0 5 6 3 4]
662
663       This can also be made into one expression, which is often seen in PDL
664       code:
665
666           pdl> ($tmp = $x->slice('1:2')) .= pdl([5,6])
667           pdl> p $x
668           [0 5 6 3 4]
669
670   Q: 6.10   Can I use an ndarray in a conditional expression?
671       Yes you can, but not in the way you probably tried first. It is not
672       possible to use an ndarray directly in a conditional expression since
673       this is usually poorly defined. Instead PDL has two very useful
674       functions: "any" and "all" . Use these to test if any or all elements
675       in an ndarray fulfills some criterion:
676
677           pdl> $x=pdl ( 1, -2, 3);
678           pdl> print '$x has at least one element < 0' if (any $x < 0);
679           $x has at least one element < 0
680
681           pdl> print '$x is not positive definite' unless (all $x > 0);
682           $x is not positive definite
683
684   Q: 6.11   Logical operators and ndarrays -  '||' and '&&' don't work!
685       It is a common problem that you try to make a mask array or something
686       similar using a construct such as
687
688           $mask = which($ndarray > 1 && $ndarray < 2);   # incorrect
689
690       This  does not work! What you are looking for is the  bitwise logical
691       operators '|' and '&' which work on an element-by-element basis. So it
692       is really very simple: Do not use logical operators on multi-element
693       ndarrays since that really doesn't make sense, instead write the
694       example as:
695
696           $mask = which($ndarray > 1 & $ndarray < 2);
697
698       which works correctly.
699

ADVANCED TOPICS

701   Q: 6.12   What is a null pdl ?
702       "null" is a special token for 'empty ndarray'. A null pdl can be used
703       to flag to a PDL function that it should create an appropriately sized
704       and typed ndarray. Null ndarrays can be used in places where a PDL
705       function expects an output or temporary argument. Output and temporary
706       arguments are flagged in the signature of a PDL function with the "[o]"
707       and "[t]" qualifiers (see next question if you don't know what the
708       signature of a PDL function is).  For example, you can invoke the
709       "sumover" function as follows:
710
711           sumover $x, $y=null;
712
713       which is equivalent to
714
715           $y = sumover $x;
716
717       If this seems still a bit murky check PDL::Indexing and PDL::PP for
718       details about calling conventions, the signature and broadcasting (see
719       also below).
720
721   Q: 6.13   What is the signature of a PDL function ?
722       The signature of a function is an important concept in PDL.  Many (but
723       not all) PDL function have a signature which specifies the arguments
724       and their (minimal) dimensionality. As an example, look at the
725       signature of the "maximum" function:
726
727           'a(n); [o] b;'
728
729       this says that "maximum" takes two arguments, the first of which is (at
730       least) one-dimensional while the second one is zero-dimensional and an
731       output argument (flagged by the "[o]" qualifier). If the function is
732       called with ndarrays of higher dimension the function will be
733       repeatedly called with slices of these ndarrays of appropriate
734       dimension(this is called broadcasting in PDL).
735
736       For details and further explanations consult PDL::Indexing and PDL::PP
737       .
738
739   Q: 6.14   How can I subclass (inherit from) ndarrays?
740       The short answer is: read PDL::Objects (e.g. type "help PDL::Objects"
741       in the perldl or pdl2 shell).
742
743       The longer answer (extracted from PDL::Objects ): Since a PDL object is
744       an opaque reference to a C struct, it is not possible to extend the PDL
745       class by e.g. extra data via sub-classing (as you could do with a hash
746       based Perl object).  To circumvent this problem PDL has built-in
747       support to extend the PDL class via the has-a relation for blessed
748       hashes. You can get the HAS-A to behave like IS-A simply in that you
749       assign the PDL object to the attribute named "PDL" and redefine the
750       method initialize(). For example:
751
752           package FOO;
753
754           @FOO::ISA = qw(PDL);
755           sub initialize {
756              my $class = shift;
757              my $self = {
758                 creation_time => time(),  # necessary extension :-)
759                 PDL => PDL->null,         # used to store PDL object
760              };
761              bless $self, $class;
762           }
763
764       For another example check the script t/subclass.t in the PDL
765       distribution.
766
767   Q: 6.15   What on earth is this dataflow stuff ?
768       Dataflow is an experimental project that you don't need to concern
769       yourself with (it should not interfere with your usual programming).
770       However, if you want to know, have a look at PDL::Dataflow . There are
771       applications which will benefit from this feature (and it is already at
772       work behind the scenes).
773
774   Q: 6.16   What is PDL::PP?
775       Simple answer: PDL::PP is both a glue between external libraries and
776       PDL and a concise language for writing PDL functions.
777
778       Slightly longer answer: PDL::PP is used to compile very concise
779       definitions into XSUB routines implemented in C that can easily be
780       called from PDL and which automatically support broadcasting, dataflow
781       and other things without you having to worry about it.
782
783       For further details check PDL::PP and the section below on Extensions
784       of PDL.
785
786   Q: 6.17   What happens when I have several references to the same PDL
787       object in different variables (cloning, etc?) ?
788       ndarrays behave like Perl references in many respects. So when you say
789
790           $x = pdl [0,1,2,3];
791           $y = $x;
792
793       then both $y and $x point to the same object, e.g. then saying
794
795           $y++;
796
797       will *not* create a copy of the original ndarray but just increment in
798       place, of which you can convince yourself by saying
799
800           print $x;
801           [1 2 3 4]
802
803       This should not be mistaken for dataflow which connects several
804       *different* objects so that data changes are propagated between the so
805       linked ndarrays (though, under certain circumstances, dataflowed
806       ndarrays can share physically the same data).
807
808       It is important to keep the "reference nature" of ndarrays in mind when
809       passing ndarrays into subroutines. If you modify the input ndarrays you
810       modify the original argument, not a copy of it. This is different from
811       some other array processing languages but makes for very efficient
812       passing of ndarrays between subroutines. If you do not want to modify
813       the original argument but rather a copy of it just create a copy
814       explicitly (this example also demonstrates how to properly check for an
815       explicit request to process inplace, assuming your routine can work
816       inplace):
817
818           sub myfunc {
819              my $pdl = shift;
820              if ($pdl->is_inplace) {
821                 $pdl->set_inplace(0)
822              } else {
823                 # modify a copy by default
824                 $pdl = $pdl->copy
825              }
826              $pdl->set(0,0);
827              return $pdl;
828           }
829

MISCELLANEOUS

831   Q: 6.18   What I/O formats are supported by PDL ?
832       The current versions of PDL already support quite a number of different
833       I/O formats.  However, it is not always obvious which module implements
834       which formats.  To help you find the right module for the format you
835       require, here is a short list of the current list of I/O formats and a
836       hint in which module to find the implementation:
837
838       •   A home brew fast raw (binary) I/O format for PDL is implemented by
839           the FastRaw module
840
841       •   The FlexRaw module implements generic methods for the input and
842           output of `raw' data arrays.  In particular, it is designed to read
843           output from FORTRAN 77 UNFORMATTED files and the low-level C
844           "write" function, even if the files are compressed or gzipped.
845
846           It is possible that the FastRaw functionality will be included in
847           the FlexRaw module at some time in the future.
848
849       •   FITS I/O is implemented by the "wfits"/"rfits" functions in
850           PDL::IO::FITS .
851
852       •   ASCII file I/O in various formats can be achieved by using the
853           "rcols" and "rgrep" functions, also in PDL::IO::Misc .
854
855       •   PDL::IO::Pic implements an interface to the NetPBM/PBM+ filters to
856           read/write several popular image formats; also supported is output
857           of image sequences as MPEG movies, animated GIFs and a wide variety
858           of other video formats.
859
860       •   On CPAN you can find the PDL::NetCDF module that works with PDL
861           2.007.
862
863       For further details consult the more detailed list in the PDL::IO
864       documentation or the documentation for the individual modules.
865
866   Q: 6.19   How can I stack a set of 2D arrays (images) into a 3D ndarray?
867       Assuming all arrays are of the same size and in some format recognized
868       by "rpic" (see PDL::IO::Pic ) you could say:
869
870           use PDL::IO::Pic;
871           @names = qw/name1.tif .... nameN.tif/;  # some file names
872           $dummy = PDL->rpic($names[0]);
873           $cube = PDL->zeroes($dummy->type,$dummy->dims,$#names+1); # make 3D ndarray
874           for (0..$#names) {
875               # this is the slice assignment
876               ($tmp = $cube->slice(":,:,($_)")) .= PDL->rpic($names[$_]);
877           }
878
879       or
880
881           $cube(:,:,($_)) .= PDL->rpic($names[$_]);
882
883       for the slice assignment using the new PDL::NiceSlice syntax and Lvalue
884       assignments.
885
886       The for loop reads the actual images into a temporary 2D ndarray whose
887       values are then assigned (using the overloaded ".=" operator) to the
888       appropriate slices of the 3D ndarray $cube .
889
890   Q: 6.20   Where are test files for the graphics modules?
891       This answer applies mainly to PDL::Graphics::TriD (PDL's device
892       independent 3D graphics model) which is the trickiest one in this
893       respect. You find some test scripts in Demos/TriD in the distribution.
894       There are also 3dtest.pl and line3d.pl in the PDL/Example/TriD
895       directory.  After you have built PDL you can do:
896
897           perl -Mblib Example/TriD/3dtest.pl
898
899           perl -Mblib Example/TriD/line3d.pl
900
901       to try the two TriD test programs.  They only exercise one TriD
902       function each but their simplicity makes it easy to debug if needed
903       with the Perl debugger, see perldebug.
904
905       The programs in the Demo directory can be run most easily from the
906       "perldl" or "pdl2" interactive shell:
907
908           perl -Mblib perldl  or  perl -Mblib Perldl2/pdl2
909
910       followed by "demo 3d" or "demo 3d2" at the prompt.  "demo" by itself
911       will give you a list of the available PDL demos.
912
913       You can run the test scripts in the Demos/TriD directory manually by
914       changing to that directory and running
915
916           perl -Mblib <testfile>
917
918       where "testfile" ; should match the pattern "test[3-9].p" and watch the
919       results. Some of the tests should bring up a window where you can
920       control (twiddle) the 3D objects with the mouse. Try using mouse button
921       1 for turning the objects in 3D space, mouse button 3 to zoom in and
922       out, and 'q' to advance to the next stage of the test.
923
924   Q: 6.21   What is TriD or PDL::TriD or PDL::Graphics::TriD?
925       Questions like this should be a thing of the past with the PDL on-line
926       help system in place. Just try (after installation):
927
928           un*x> pdl2
929           pdl> apropos trid
930
931       Check the output for promising hits and then try to look up some of
932       them, e.g.
933
934           pdl> help PDL::Graphics::TriD
935
936       Note that case matters with "help" but not with "apropos" .
937
938   Q: 6.22   PGPLOT does not write out PNG files.
939       There are a few sources of trouble with PGPLOT and PNG files. First,
940       when compiling the pgplot libraries, make sure you uncomment the PNG
941       entries in the drivers.list file. Then when running 'make' you probably
942       got an error like
943
944         C<make: *** No rule to make target `png.h', needed by `pndriv.o'.  Stop.>
945
946       To fix this, find the line in the 'makefile' that starts with
947       'pndriv.o:' (it's near the bottom). Change, for example, ./png.h to
948       /usr/include/png.h, if that is where your header files are (you do have
949       the libpng and libz devel packages, don't you?).  Do this for all four
950       entries on that line, then go back and run "make".
951
952       Second, if you already have the PGPLOT Perl module and PDL installed,
953       you probably tried to write out a PNG file and got fatal error message
954       like:
955
956         C<undefined symbol: png_create_write_struct>
957
958       This is because the PGPLOT Perl module does not automatically link
959       against the png and z libraries. So when you are installing the PGPLOT
960       Perl module (version 2.19) from CPAN, don't do "install PGPLOT", but
961       just do "get PGPLOT". Then exit from CPAN and manually install PGPLOT,
962       calling the makefile thusly:
963
964         C<perl Makefile.PL EXLIB=png,z EXDIR=/usr/lib>
965
966       assuming that there exist files such as /usr/lib/libpng.so.*,
967       /usr/lib/libz.so.*. Then do the standard "make;make test;make install;"
968       sequence. Now you can write png files from PDL!
969

EXTENSIONS OF PDL

971   Q: 7.1    I am looking for a package to do XXX in PDL. Where shall I look
972       for it?
973       The first stop is again "perldl" or "pdl2" and the on-line help or the
974       PDL documentation. There is already a lot of functionality in PDL which
975       you might not be aware of.  The easiest way to look for functionality
976       is to use the "apropos" command:
977
978           pdl> apropos 'integral'
979           ceil            Round to integral values in floating-point format
980           floor           Round to integral values in floating-point format
981           intover         Project via integral to N-1 dimensions
982           rint            Round to integral values in floating-point format
983
984       Since the apropos command is no sophisticated search engine make sure
985       that you search on a couple of related topics and use short phrases.
986
987       However there is a good chance that what you need is not part of the
988       PDL distribution. You are then well advised to check out
989       <http://pdl.perl.org> where there is a list of packages using PDL. If
990       that does not solve your problem, ask on the mailing-list, if nothing
991       else you might get assistance which will let you interface your package
992       with PDL yourself, see also the next question.
993
994   Q: 7.2    Can I access my C/FORTRAN library routines in  PDL?
995       Yes, you can, in fact it is very simple for many simple applications.
996       What you want is the PDL pre-processor PP (PDL::PP ). This will allow
997       you to make a simple interface to your C routine.
998
999       The two functions you need to learn (at least first) are "pp_def" which
1000       defines the calling interface to the function, specifying input and
1001       output parameters, and contains the code that links to the external
1002       library. The other command is "pp_end" which finishes the PP
1003       definitions.  For details see the PDL::PP man-page, but we also have a
1004       worked example here.
1005
1006           double eight_sum(int n)
1007           {
1008                int i;
1009                double sum, x;
1010
1011                sum = 0.0; x=0.0;
1012                for (i=1; i<=n; i++) {
1013                  x++;
1014                  sum += x/((4.0*x*x-1.0)*(4.0*x*x-1.0));
1015                }
1016                return 1.0/sum;
1017           }
1018
1019       We will here show you an example of how you interface C code with PDL.
1020       This is the first example and will show you how to approximate the
1021       number 8...
1022
1023       The C code is shown above and is a simple function returning a double,
1024       and expecting an integer - the number of terms in the sum - as input.
1025       This function could be defined in a library or, as we do here, as an
1026       inline function.
1027
1028       We will postpone the writing of the Makefile till later. First we will
1029       construct the ".pd" file. This is the file containing PDL::PP code. We
1030       call this "eight.pd" .
1031
1032           #
1033           # pp_def defines a PDL function.
1034           #
1035           pp_addhdr (
1036           '
1037           double eight_sum(int n)
1038           {
1039             int i;
1040             double sum, x;
1041
1042             sum = 0.0; x=0.0;
1043             for (i=1; i<=n; i++) {
1044              x++;
1045              sum += x/((4.0*x*x-1.0)*(4.0*x*x-1.0));
1046             }
1047            return 1.0/sum;
1048
1049           }
1050           ');
1051
1052           pp_def (
1053                   'eight',
1054                Pars => 'int a(); double [o]b();',
1055                   Code => '$b()=eight_sum($a());'
1056                  );
1057
1058           # Always make sure that you finish your PP declarations with
1059           # pp_done
1060
1061           pp_done();
1062
1063       A peculiarity with our example is that we have included the entire code
1064       with "pp_addhdr" instead of linking it in. This is only for the
1065       purposes of example, in a typical application you will use "pp_addhdr"
1066       to include header files. Note that the argument to "pp_addhdr" is
1067       enclosed in quotes.
1068
1069       What is most important in this example is however the "pp_def" command.
1070       The first argument to this is the name of the new function eight  ,
1071       then comes a hash which the real meat:
1072
1073       •   This gives the input parameters (here  "a") and the output
1074           parameters (here  "b"). The latter are indicated by the  "[o]"
1075           specifier. Both arguments can have a type specification as shown
1076           here.
1077
1078           Many variations and further flexibility in the interface can be
1079           specified. See "perldoc PDL::PP" for details.
1080
1081       •   This switch contains the code that should be executed. As you can
1082           see this is a rather peculiar mix of C and Perl, but essentially it
1083           is just as you would write it in C, but the variables that are
1084           passed from PDL are treated differently and have to be referred to
1085           with a preceding '$'.
1086
1087           There are also simple macros to pass pointers to data and to obtain
1088           the values of other Perl quantities, see the manual page for
1089           further details.
1090
1091       Finally note the call to pp_done() at the end of the file. This is
1092       necessary in all PP files.
1093
1094       OK. So now we have a file with code that we dearly would like to use in
1095       Perl via PDL. To do this we need to compile the function, and to do
1096       that we need a Makefile.
1097
1098           use PDL::Core::Dev;
1099           use ExtUtils::MakeMaker;
1100           PDL::Core::Dev->import();
1101
1102           $package = ["eight.pd",Eight,PDL::Eight,'',1];
1103           %hash = pdlpp_stdargs($package);
1104
1105           WriteMakefile( %hash );
1106
1107           sub MY::postamble {pdlpp_postamble($package)}
1108
1109       The code above should go in a file called Makefile.PL, which should
1110       subsequently be called in  the standard Perl way: "perl Makefile.PL" .
1111       This should give you a Makefile and running "make" should compile the
1112       module for you and "make install" will install it for you.
1113
1114       The fifth element in the $package array-ref is true. This tells PDL to
1115       generate one C file per PP function, which with the right "make"
1116       options can be compiled in parallel, for a useful speedup of
1117       development / installation.
1118
1119   Q: 7.3    How can I interface package XXX in PDL?
1120       This question is closely related to the previous one, and as we said
1121       there, the PDL::PP pre-processor is the standard way of interfacing
1122       external packages with PDL. The most usual way to use PDL::PP is to
1123       write a short interface routine, see the PDL::PP perldoc page and the
1124       answer to the previous question for examples.
1125
1126       However it is also possible to interface a package to PDL by re-writing
1127       your function in PDL::PP directly. This can be convenient in certain
1128       situations, in particular if you have a routine that expects a function
1129       as input and you would like to pass the function a Perl function for
1130       convenience.
1131
1132       The PDL::PP perldoc page is the main source of information for writing
1133       PDL::PP extensions, but it is very useful to look for files in the
1134       distribution of PDL as many of the core functions are written in
1135       PDL::PP. Look for files that end in ".pd" which is the generally
1136       accepted suffix for PDL::PP files. But we also have a simple example
1137       here.
1138
1139       The following example will show you how to write a simple function that
1140       automatically allows broadcasting. To make this concise the example is
1141       of an almost trivial function, but the intention is to show the basics
1142       of writing a PDL::PP interface.
1143
1144       We will write a simple function that calculates the minimum, maximum
1145       and average of an ndarray. On my machine the resulting function is 8
1146       times faster than the built-in function "stats" (of course the latter
1147       also calculates the median).
1148
1149       Let's jump straight in. Here is the code (from a file called
1150       "quickstats.pd" )
1151
1152           #
1153           pp_def('quickstats',
1154                Pars => 'a(n); [o]avg(); [o]max(); [o]min()',
1155                Code => '$GENERIC(a) curmax, curmin;
1156                         $GENERIC(a) tmp=0;
1157                            loop(n) %{
1158                              tmp += $a();
1159                              if (!n || $a() > curmax) { curmax = $a();}
1160                              if (!n || $a() < curmin) { curmin = $a();}
1161                            %}
1162                            $avg() = tmp/$SIZE(n);
1163                         $max() = curmax;
1164                         $min() = curmin;
1165                           '
1166                );
1167
1168           pp_done();
1169
1170       The above might look like a confusing mixture of C and Perl, but behind
1171       the peculiar syntax lies a very powerful language. Let us take it line
1172       by line.
1173
1174       The first line declares that we are starting the definition of a PDL:PP
1175       function called "quickstats" .
1176
1177       The second line is very important as it specifies the input and output
1178       parameters of the function.  a(n) tells us that there is one input
1179       parameter that we will refer to as "a" which is expected to be a vector
1180       of length n (likewise matrices, both square and rectangular would be
1181       written as "a(n,n)" and "a(n,m)" respectively). To indicate that
1182       something is an output parameter we put "[o]" in front of their names,
1183       so referring back to the code we see that avg, max and min are three
1184       output parameters, all of which are scalar (since they have no
1185       dimensional size indicated.
1186
1187       The third line starts the code definition which is essentially pure C
1188       but with a couple of convenient functions.  $GENERIC is a function that
1189       returns the C type of its argument - here the input parameter a. Thus
1190       the first two lines of the code section are variable declarations.
1191
1192       The loop(n) construct is a convenience function that loops over the
1193       dimension called n in the parameter section. Inside this loop we
1194       calculate the cumulative sum of the input vector and keep track of the
1195       maximum and minimum values. Finally we assign the resulting values to
1196       the output parameters.
1197
1198       Finally we finish our function declaration with pp_done() .
1199
1200       To compile our new function we need to create a Makefile, which we will
1201       just list since its creation is discussed in an earlier question.
1202
1203           use PDL::Core::Dev;
1204           use ExtUtils::MakeMaker;
1205           PDL::Core::Dev->import();
1206
1207           $package = ["quickstats.pd",Quickstats,PDL::Quickstats,'',1];
1208           %hash = pdlpp_stdargs($package);
1209
1210           WriteMakefile( %hash );
1211
1212           sub MY::postamble {pdlpp_postamble($package)}
1213
1214       An example Makefile.PL
1215
1216       Our new statistic function should now compile using the tried and
1217       tested Perl way: "perl Makefile.PL; make" .
1218
1219       You should experiment with this function, changing the calculations and
1220       input and output parameters. In conjunction with the PDL::PP perldoc
1221       page this should allow you to quickly write more advanced routines
1222       directly in PDL::PP.
1223

BUGS

1225       If you find any inaccuracies in this document (or dis-functional URLs)
1226       please report to the perldl mailing list
1227       pdl-general@lists.sourceforge.net.
1228

ACKNOWLEDGMENTS

1230       Achim Bohnet (ach@mpe.mpg.de ) for suggesting CoolHTML as a
1231       prettypodder (although we have switched to XML now) and various other
1232       improvements. Suggestions for some questions were taken from Perl FAQ
1233       and adapted for PDL.
1234

CONTRIBUTORS

1236       Many people have contributed or given feedback on the current version
1237       of the FAQ, here is an incomplete list of individuals whose
1238       contributions or posts to the mailing-list have improved this FAQ at
1239       some point in time alphabetically listed by first name: Christian
1240       Soeller, Chris Marshall, Doug Burke, Doug Hunt, Frank Schmauder, Jarle
1241       Brinchmann, John Cerney, Karl Glazebrook, Kurt Starsinic, Thomas
1242       Yengst, Tuomas J. Lukka.
1243
1245       This document emerged from a joint effort of several PDL developers
1246       (Karl Glazebrook, Tuomas J. Lukka, Christian Soeller) to compile a list
1247       of the most frequently asked questions about PDL with answers.
1248       Permission is granted for verbatim copying (and formatting) of this
1249       material as part of PDL.
1250
1251       Permission is explicitly not granted for distribution in book or any
1252       corresponding form. Ask on the PDL mailing list
1253       pdl-general@lists.sourceforge.net if some of the issues covered in here
1254       are unclear.
1255
1256
1257
1258perl v5.38.0                      2023-07-21                            FAQ(1)
Impressum