PDL::Course(3pm)

PDL::Course(3pm) πŸ¦‹πŸ’…βœ¨

okay bestie, this is the PDL study course β€” a whole journey through PDL's documentation, from beginner to advanced. Buckle up, it's giving main character energy. πŸŽ€


NAME πŸ’–

PDL::Course β€” A journey through PDL's documentation, from beginner to advanced.

AUTHOR, DATE 🫢

This is written by David Mertens with edits by Daniel Carrera.

Preface 🌸

okay so PDL's documentation is extensive. Some sections cover deep core magic while others cover more usual topics like IO and numerical computation. How are these related? Where should you begin?

This document is an attempt to pull all the key PDL documentation together in a coherent study course, starting from the beginner level, up to the expert.

The breakdown is by level of expertise, and within each level there are documentation, library, and workflow modules. The documentation modules are useful for what they tell you; the library modules are useful for the functions that they define for you; the workflow modules are useful for the way that they allow you to get your work done in new and different ways. periodt. ✨

Introductory 🌈

If you are new to PDL, these documentation modules will get you started down the right path for using PDL.

Documentation πŸ“šβœ¨

Modules that tell you how to start using PDL. Many of these are library modules technically, but they are included when you use PDL, so they're included here for their documentation.

After the first three, most of the docs listed below are rather dry. Perhaps they would be better summarized by tables or better synopses. You should at least scan through them to familiarize yourself with the basic capabilities of PDL.

  • PDL::Philosophy, PDL::QuickStart β€” a couple of brief introductions to PDL. The second one is a bit more hands-on. If you are new to PDL, you should start with these. πŸ’–
  • PDL::Basic β€” covers basic ndarray-creation routines like sequence, rvals, and logxvals to name a random few. Also covers hist and transpose. ✨
  • PDL::Ufunc β€” explains a large collection of built-in functions which, given an N-dimension ndarray, will create an ndarray with N-1 dimensions. πŸ”₯
  • PDL::NiceSlice β€” PDL came of age right around the turn of the millennium and NiceSlice came on the scene slightly after that. Some of the docs still haven't caught up. NiceSlice is the 'modern' way to slice and dice your ndarrays. Read the Synopsis, then scroll down to The New Slicing Syntax. After you've read to the bottom, return to and read the stuff at the top. πŸ‘‘
  • PDL::Ops β€” defines the standard Perl-overloadable operators, like + and .=, for example. Since pretty much all of these operators and functions are discussed elsewhere, there's usually no need to read this documentation or use this module. πŸ’€
  • PDL::Primitive β€” defines a whole slew of useful built-in functions. These are the sorts of things that beginners are likely to write to the list and say, "How do I do xxx?" You would be well on your way to learning the ropes after you've got through this document. 🫢
  • Selections from PDL::Core β€” like PDL::Primitive, defines a large set of useful functions. Unfortunately, some of the functions are quite esoteric, but are mixed in with the rest of the simple and easy ones. Skim the whole document, skipping over the complicated functions for now. I would point out in particular the function approx. πŸ’…

Workflow πŸ› οΈ

  • The perldl Shell β€” The Perldl Shell is a REPL (Read-Evaluate-Print-Loop, in other words, a prompt or shell) that allows you to work with PDL (or any Perl, for that matter) in 'real time', loading data from files, plotting, manipulating... Anything you can do in a script, you can do in the PDL Shell, with instant feedback! 🌈

Libraries πŸ“¦πŸ‘‘

  • PDL β€” the main workhorse module. You'll include this in nearly every PDL program you write. But if you don't use mathematical or I/O functions or matrix operations, you might get quicker startup with PDL::LiteF, or that plus no namespace pollution with PDL::Lite. πŸ‘‘

πŸ’– NORMAL USAGE πŸ’–

These are the modules you'll probably reach for all the time in your scripts or straight up from inside the perldl shell. Some of them? You may literally never use. But bestie, you should still know they exist, so that one day when you need that exact functionality you're not out here suffering. ✨

πŸ“š Documentation

  • PDL::Slices β€” besides walking you through the original slicing-and-dicing functions (for which you can usually just use PDL::NiceSlice), this also covers a whole bunch of dimension-handling functions like mv, xchg, and reorder. It thoroughly documents the range function too, which can be super powerful, and it also covers a number of internal functions that you can probably just skip. πŸ’…
  • PDL::Dataflow β€” covers data flow, which is kind of a somewhat unique feature of PDL. πŸ¦‹
  • PDL::Indexing β€” this is where a LOT of the deeper conceptual ground lives, the stuff you genuinely have to grasp to use PDL to its full potential. It gets more complex as you go, so don't be troubled if you find yourself losing interest halfway through, no cap. That said, reading it all the way to the end will bring you so much closer to PDL enlightenment. 🌈
  • PDL::IO β€” PDL has quite a few IO modules, and most of them get discussed in this summary module.
  • PDL::Tips β€” a little collection of some of Tuomas's ideas for making good use of PDL. πŸŽ€
  • PDL::BadValues β€” explains what bad values are, and how and why they're implemented.
  • Selections from Inline::Pdlpp β€” okay so writing PDL::PP code counts as an Advanced topic and it's covered in the next section, but you should be aware that it's possible (and surprisingly simple!) to write PDL-aware code. You needn't read the whole thing at this point β€” but to get some feel for how it works, read everything up through the first example. πŸ’œ
  • PDL::Objects β€” explains how to subclass an ndarray object. πŸ‘‘
  • PDL::Index β€” this one got a mention back in the Preface. It's an automatically generated file that lists all of the PDL modules on your computer. There are lots of modules that might be sitting on your machine but which aren't documented here, like bindings to the FFTW library, or GSL. Give it a read! πŸ™ˆ

🧰 Libraries

  • PDL::FFT β€” PDL's very own Fast Fourier Transform. If you have FFTW, you should probably be making use of it; this is PDL's internal implementation and it should always be available.
  • PDL::Func β€” a somewhat uniform interface to the different interpolation modules in PDL.
  • PDL::Bad β€” includes some basic bad-value functionality, including functions to query whether an ndarray has bad values (isbad) and functions to set certain elements as bad (setbadat and setbadif). Among other places, bad values get used in PDL::Graphics::PLplot's xyplot to make a gap in a line plot.
  • PDL::DiskCache β€” a cool module that lets you tie a Perl array to a collection of files on your disk, which get loaded into and out of memory as ndarrays. If you keep finding yourself writing scripts to process many data files β€” especially if that data processing isn't necessarily in sequential order β€” you should consider PDL::DiskCache. πŸ”₯
  • PDL::Char β€” a PDL subclass that lets you store and manipulate collections of fixed-length character strings using PDL.
  • PDL::Image2D β€” a whole collection of methods for manipulating images whose image data are stored in an ndarray. We're talking methods for convolutions (smoothing), polygon fills, scaling, rotation, and warping, among others.
  • PDL::ImageND β€” contains a few functions that are conceptually related to image processing but which can be defined for higher-dimensional data. For example, this module defines high-dimensional convolution and interpolation, among others.
  • PDL::ImageRGB β€” defines some useful functions for working with RBG image data. It's not very feature-full, but it may have something you need β€” and if not, you can always add more! πŸ’…
  • PDL::Transform β€” creates the transform class, which lets you create all kinds of coordinate transforms. For example, if your data is a collection of Cartesian coordinates, you could create a transform object to convert them to Spherical-Polar coordinates (although many such standard coordinate transformations are predefined for you β€” in this case it's called t_spherical). ✨
  • PDL::Math β€” a collection of fairly standard math functions, like the inverse trigonometric functions, hyperbolic functions and their inverses, and others. This module is included in the standard call to use PDL, but not in the Lite versions.
  • PDL::Matrix β€” provides a few functions that use the standard mathematical Matrix notation of row-column indexing rather than the PDL-standard column-row. It appears this module hasn't been heavily tested with other modules, so although it should work with other modules, don't be surprised if something breaks when you use it (and feel free to offer any fixes you may develop). 🫢
  • PDL::MatrixOps β€” provides many standard matrix operations for ndarrays, like computing eigenvalues, inverting square matrices, LU-decomposition, and solving a system of linear equations. Though it's not built on PDL::Matrix, it should generally work with that module. Also, the methods provided by this module do not depend on external libraries such as LAPACK or GSL.
  • PDL::Reduce β€” implements an interface to all the functions that return ndarrays with one less dimension (for example, sumover), such that they can be called by supplying their name, as a string.

πŸ”§ Workflow

  • PDL::AutoLoader β€” enables Matlab-style autoloading. When you call an unknown function, instead of complaining and croaking, PDL will go hunt around in the directories you specify in search of a like-named file. Particularly useful when used with the Perldl Shell. πŸ’€
  • PDL::Dbg β€” declares the px function, which can be handy for debugging your PDL scripts and/or perldl shell commands.
  • PDL::Options β€” suppose you define a powerful, versatile function. Chances are good that you'll accept the arguments in the form of a hash or hashref. Now you face the problem of processing that hashref. PDL::Options assists you in writing code to process those options. (You'd think Perl would have tons of these sorts of modules lying around, but I couldn't find any.) Note this module does not depend on PDL for its usage or installation.
  • PDL::pdldoc β€” ever fired up the perldl shell just to look up the help for a particular function? You can use pdldoc instead. This shell script extracts information from the help index without needing to start the perldl shell. πŸŽ€

πŸš€ ADVANCED USAGE πŸš€

The sorts of modules and documentation you'll use if you write modules that use PDL, or if you work on PDL maintenance. These modules can be difficult to use, but they enable you to tackle some of your harder problems. πŸ‘‘

  • PDL::Lite, PDL::LiteF β€” Lite-weight replacements for use PDL, from the standpoint of namespace pollution and load time.
  • Inline::Pdlpp β€” this was mentioned earlier. Before you begin reading about PDL::PP (next), you should remind yourself about how to use this. Inline::Pdlpp will help you experiment with PDL::PP without having to go through the trouble of building a module and constructing makefiles (but see pptemplate for help on that).
  • PDL::PP β€” the PDL Pre-Processor, which vastly simplifies making your C or Fortran code play with Perl and ndarrays. Most of PDL's basic functionality is written using PDL::PP, so if you're thinking about how you might integrate some numerical library written in C, look no further.
  • pptemplate β€” a script that automates the creation of modules that use PDL::PP, which should make your life as a module author a bit simpler.
  • PDL::Doc β€” explanation of the PDL documentation conventions, and an interface to the PDL Documentation parser. Following these guidelines when writing documentation for PDL functions will ensure that your wonderful documentation is accessible from the perldl shell and from calls to barf. (Did you notice that barf used your documentation? Time to reread PDL::Core...) πŸ‘€
  • PDL::Exporter β€” a simple replacement for the standard Exporter module. The only major difference is that the default imported modules are those marked :Func.
  • PDL::Types β€” defines some useful functions for getting an ndarray's type, as well as getting information about that type.

πŸ’Ž EXPERT USAGE πŸ’Ž

  • PDL::Core::Dev β€” provides some decently useful functions that are pretty much only needed by the PDL Porters.
  • PDL::API β€” explains how to make an ndarray by hand, from Perl or your C source code, using the PDL API.
  • PDL::Internals β€” explains the nitty-gritty of the PDL data structures. After reading this (a few times :)) you should be able to create an ndarray completely from scratch (i.e. without using the PDL API). Put a little differently: if you want to understand how PDL::PP works, you'll need to read this. 🌟

Copyright 2010 David Mertens (dcmertens.perl@gmail.com). You can distribute and/or modify this document under the same terms as the current Perl license.

See: http://dev.perl.org/licenses/


and that's the whole course, bestie!! πŸŽ“βœ¨ this page is PDL::Course(3pm), shipped with perl v5.42.3 and dated 2026-08-20 β€” go forth and slay your ndarrays πŸ’…πŸ¦‹

πŸ“¦ where this page comes from