-
Notifications
You must be signed in to change notification settings - Fork 46
The PDL environment
The following assumes PDL is running on a Linux machine in the bash shell, but the ideas and commands can be adapted to other operating systems and shells.
There are two ways to use PDL. The first is just from a Perl script to which you add 'use PDL;' and then all of the basic PDL commands become available to you. The second way is through an interactive command line. You can start the command line with the command "perldl" or "pdl"--they are basically the same. Then you can enter commands and print variables and make plots.
When you run the interactive command line (also called the perldl shell), it will look for a file called ~/.perldlrc, and execute the commands in that file before starting up. See the perldlrc documentation for more details, and an Example perldlrc file for an example. At a minimum, this file should contain the line 'use PDL::AutoLoader;'. Add '$PDL::AutoLoader::Rescan = 1;' for increased convenience.
AutoLoader is assisted by the PDLLIB environment variable. An example (in a ~/.bash_profile file) is the following line:
export PDLLIB=".:+~/PDL:+~/pdl:+./pdl:+./PDL"
This adds ~/PDL, ~/pdl, ./pdl, and ./PDL (and all of their subdirectories) to a PDL-specific list of directories to search for programs (you can adapt it if you don't use bash). See PDL::AutoLoader for a full description and an example of using AutoLoader.
Unlike some other numerical software, PDL has no fully-integrated graphical development environment. However, with a combination of the perldl shell and PDL::AutoLoader (described above), and your favorite text editor, you can basically have the same thing. If you use the Emacs text editor, you are no doubt aware that it performs convenient syntax highlighting by guessing the language of your program. There is no PDL-mode, but you can tell Emacs to treat files ending in '.pdl' as Perl programs. If you add the following line to your ~/.emacs file, Emacs will treat files ending in '.pdl' as Perl, giving you the Perl syntax highlighting and checking that make Emacs so useful.
;; make sure .pdl files get treated as Perl
(setq auto-mode-alist
(cons '("\\.pdl$" . perl-mode) auto-mode-alist))