COURSE(1)
๐ 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 likesequence,rvals, andlogxvalsto name a random few. Also covershistandtranspose. ๐งฑ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โ LikePDL::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 functionapprox. ๐ง
๐ ๏ธ Workflow ๐ ๏ธ
- The
perldlorpdl2Shell โ 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 usePDL::NiceSliceinstead), and also covers a bunch of dimension-handling functions likemv,xchg, andreorder. It thoroughly documents therangefunction, 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โ writingPDL::PPcode 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 inPDL::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, checkPDL::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 (setbadatandsetbadif). Among other places, bad values are used inPDL::Graphics::PLplot'sxyplotto 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 usingPDL::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 calledt_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 touse 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 onPDL::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 thepxfunction, which can be handy for debugging your PDL scripts and/orperldlshell 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::Optionsassists 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 theperldlshell just to look up the help for a particular function? You can usepdldocinstead. This shell script extracts information from the help index without needing to start theperldlshell. 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 foruse PDL, from the standpoint of namespace pollution and load time. โจInline::Pdlppโ this was mentioned earlier. Before you begin reading aboutPDL::PP(next), you should remind yourself about how to use this.Inline::Pdlppwill help you experiment withPDL::PPwithout having to go through the trouble of building a module and constructing makefiles (but seePDL::pptemplatefor 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 usingPDL::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 usePDL::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 usingPDL::PP. The major difference betweenPDL::PPandPDL::CallExtis that the former will handle broadcasting over implicit broadcast dimensions for you, whereasPDL::CallExtsimply calls an external function.PDL::PPis 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::Confighash, 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 theperldlshell and from calls tobarf. (Did you notice thatbarfused your documentation? Time to rereadPDL::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 howPDL::PPworks, you'll need to read this. ๐
๐ COPYRIGHT ๐
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
- epel 9: perl-PDL 2.78.0-1.el9 ยท GPL+ or Artistic
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms