COURSE(1)

๐Ÿ“ฆ version 2.78.0, in epel 9

๐ŸŒˆ NAME ๐ŸŒˆ

Okay bestie, this is the COURSE(1) manual page โ€” User Contributed Perl Documentation โ€” and it's all about 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 ๐Ÿ’ญ

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. No cap.

I've broken down everything by level of expertise, and within expertise I've covered 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 I've included them 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. Fr fr. ๐Ÿ‘‘

  • 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::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 gotten 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 or pdl2 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. ๐ŸŽ๐Ÿ‘‘

๐ŸŒˆ Normal Usage ๐ŸŒˆ

Okay so these are the modules you'll lowkey use on a normal basis in scripts or from inside the perldl shell. Some of them you may literally never touch โ€” but bestie, still know they exist, just in case you need their functionality. ๐Ÿ’…

๐ŸŽ€ Documentation ๐ŸŽ€

  • PDL::Slices โ€” explains the original slicing-and-dicing functions (for which you can usually use PDL::NiceSlice instead), and also covers a bunch of dimension-handling functions like mv, xchg, and reorder. It thoroughly documents the range function, which can be very powerful, and it covers a number of internal functions that you can probably skip. โœจ
  • PDL::Indexing โ€” this one covers a lot of the deeper conceptual ground you'll need to really use PDL to its full potential. It gets more complex as you go along, so don't be troubled if you find yourself losing interest halfway through. No cap, reading this document all the way through will bring you much closer to PDL enlightenment. ๐ŸŒˆ
  • PDL::IO โ€” PDL has quite a few IO modules, and most of them are discussed in this summary module. ๐Ÿ“
  • PDL::Tips โ€” a collection of some of Tuomas's ideas for making good use of PDL. Iconic behavior, honestly. ๐Ÿ‘‘
  • PDL::BadValues โ€” explains what bad values are and how and why they are implemented. ๐Ÿ’€
  • Selections from Inline::Pdlpp โ€” writing PDL::PP code is considered an Advanced topic and is covered in the next section, but you should be aware that it is 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, you should read everything up through the first example. A copy of this documentation is contained in PDL::PP-Inline. ๐Ÿงš
  • PDL::Objects โ€” explains how to subclass an ndarray object. Main character energy for your custom classes. ๐Ÿ’–
  • PDL::Index โ€” this was discussed in the Preface. It is an automatically generated file that lists all of the PDL modules on your computer. There are many modules that may be on your machine but which are not documented here, such as bindings to the FFTW library, or GSL. Give it a read! ๐Ÿ‘€

๐Ÿงช Libraries ๐Ÿงช

  • PDL::FFT โ€” PDL's own Fast Fourier Transform. If you have FFTW, then you should probably make use of it; this is PDL's internal implementation and should always be available. ๐Ÿ”ฅ
  • GSL โ€” PDL does not have bindings for every sub-library in the GNU Scientific Library, but it has quite a few. If you have GSL installed on your machine then chances are decent that your PDL has the GSL bindings. For a full list of the GSL bindings, check PDL::Index. ๐ŸŒธ
  • 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 if an ndarray has bad values (isbad) and functions to set certain elements as bad (setbadat and setbadif). Among other places, bad values are used in PDL::Graphics::PLplot's xyplot to make a gap in a line plot. ๐Ÿ“‰
  • PDL::DiskCache โ€” a cool module that allows you to tie a Perl array to a collection of files on your disk, which will be loaded into and out of memory as ndarrays. If you find yourself writing scripts to process many data files, especially if that data processing is not necessarily in sequential order, you should consider using PDL::DiskCache. Fr fr, it's a lifesaver. ๐Ÿฆ‹
  • PDL::Char โ€” a PDL subclass that allows you to 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. These include 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 allows you to create various 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::Opt::Simplex โ€” this package states that it โ€œimplements the commonly used simplex optimization algorithm.โ€ I'm going to assume that if you need this algorithm then you already know what it is. ๐Ÿ˜Œ
  • 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 that this module has not 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 that you may develop). โš ๏ธ Ngl, fair warning. ๐Ÿ™ˆ
  • PDL::MatrixOps โ€” provides many standard matrix operations for ndarrays, such as computing eigenvalues, inverting square matrices, LU-decomposition, and solving a system of linear equations. Though it is 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 Slatec 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. Slay. โœจ

๐ŸŒ€ 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. Obsessed. ๐Ÿ’–

๐Ÿ”ฅ Advanced Usage ๐Ÿ”ฅ

These are 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. No cap, this is where things get spicy. ๐ŸŒถ๏ธ

  • 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 PDL::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. ๐Ÿ”ฅ
  • PDL::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::CallExt โ€” allows you to call functions using external shared libraries. This is an alternative to using PDL::PP. The major difference between PDL::PP and PDL::CallExt is that the former will handle broadcasting over implicit broadcast dimensions for you, whereas PDL::CallExt simply calls an external function. PDL::PP is generally the recommended way to interface your code with PDL, but it wouldn't be Perl if there wasn't another way to do it. ๐Ÿ˜ญ
  • PDL::Config โ€” defines the %PDL::Config hash, which has lots of useful information pertinent to your PDL build. ๐Ÿ› ๏ธ
  • 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. ๐Ÿ‘‘

Okay bestie, legal bit but make it cute โ€” this is the part where we give credit where credit is so due. โœจ

This whole document โ€” every single iconic word of it โ€” is Copyright 2010 David Mertens (dcmertens.perl@gmail.com). Give him his flowers, fr fr. ๐Ÿ‘‘๐ŸŒธ

You can distribute and/or modify this document under the same terms as the current Perl license. That's the whole vibe check: same terms, same license, no extra hoops. ๐ŸŽ€

And if you wanna read the actual license yourself (respect, honestly), it's right here:

That's it, that's the whole section. Legal but make it slay. ๐Ÿ’…


And that's a wrap on the whole page, bestie!! ๐Ÿซถ You made it all the way to the end โ€” main character energy honestly. ๐ŸŒˆ This edition is perl v5.32.1, dated 2022-04-11, and the page itself is COURSE(1) if you ever need to cite it in your group chat. ๐Ÿฆ‹ Go forth and lowkey flex that you read the entire thing. ๐Ÿ’œโœจ

๐Ÿ“ฆ where this page comes from