PHILOSOPHY(1p)
π NAME π
PDL::Philosophy β why did we even write PDL, bestie?? like genuinely why
β¨ DESCRIPTION β¨
Okay so this is some history straight from the person who made PDL, and it leads into the whole philosophy and the ~motivation~ behind this data language. It's basically an attempt to summarise the common spirit shared between pdl developers, so we can finally answer the question "Why PDL?"
π¦ The Start of PDL π¦
"Why is it that we entertain the belief that for every purpose odd numbers are the most effectual?" - Pliny the Elder
The PDL project started in February 1996, when the author decided to mess around and write his own Data Language. He's an astronomer, okay? His day job is literally analysing a ton of digital data accumulated over many nights observing on telescopes all around the world. Think: images with millions of pixels, and thousands of images of distant stars and galaxies. Or, even more abstrusely, many hundreds of digital spectra spilling the secrets of the composition and properties of those distant objects. π«
Obviously loads of astronomers had already dealt with these problems before, and a huge amount of software had been built to help with the analysis. But β like many of his colleagues β he was constantly frustrated by how not general and not flexible these programs were, and by how hard it was to do anything even slightly out of the ordinary quickly and easily. What he wanted already had a name: "Data Language", i.e. a language that lets you manipulate large amounts of data with simple arithmetic expressions. Some commercial software actually worked like that, and he was impressed by the capabilities β just not by the price tag. And he thought he could do better. π
As a fairly computer-literate astronomer (read "nerd" or "geek", depending on your local argot), he was very familiar with "Perl", a computer language that now seems to fill the shelves of bookstores everywhere. He was impressed by its power and flexibility, and especially its ease of use. He'd even gone deep into its internals and written an interface to allow graphics β and the ease with which he could then create charts and graphs for his papers was, honestly, refreshing. β¨
Version 5 of Perl had just been released, and he was fascinated by the new features available. Especially the support of arbitrary data structures (or "objects", in modern parlance) and the ability to "overload" operators β i.e. make mathematical symbols like "+-*/" do literally whatever you felt like. It seemed to him it ought to be possible to write an extension to Perl where you could play with your data in a general way: for example, using the maths operators to manipulate whole images at once. π
One slow night at an observatory, he thought he'd try a little experiment. In a bored moment he fired up a text editor and started creating a file called PDL.xs β a Perl extension module to manipulate data vectors. A few hours later he actually had something half decent working, where he could add two images in the Perl language, fast! This was not something he could let rest, and it probably cost him one or two scientific papers' worth of productivity. A few weeks later, the Perl Data Language version 1.0 was born. It was a pretty bare infant: very little was there apart from the basic arithmetic operators. But encouraged, he made it available on the Internet to see what people thought. πΌ
People were fairly critical β among the most vocal were Tuomas Lukka and Christian Soeller. Unfortunately for them, they were both Perl enthusiasts too, and soon found themselves improving his code to implement all the features they thought PDL ought to have and that he had heinously neglected. PDL is a prime example of that modern phenomenon of authoring large free software packages via the Internet. Large numbers of people, most of whom have never met, have made contributions ranging from core functionality to large modules to the smallest of bug patches. PDL version 2.0 is now here (though it should perhaps have been called version 10 to reflect the amount of growth in size and functionality) and the phenomenon continues. He firmly believes that PDL is a great tool for tackling general problems of data analysis. It is powerful, fast, easy to add to, and freely available to anyone. He wishes he'd had it when he was a graduate student! He hopes you too will find it of immense value, and that it'll save you from heaps of time and frustration solving complex problems. Of course it can't do everything, but it provides the framework, the hammers and the nails for building solutions without having to reinvent wheels or levers. π¨
--- Karl Glazebook, the creator of PDL
π Major ideas π
The first tenet of our philosophy is the "free software" idea: software being free has several advantages (fewer bugs because more people see the code, you can have the source and port it to your own working environment with you, ... and of course, that you don't need to pay anything). π«Ά
The second idea is a pet peeve of many: lots of languages like Matlab are pretty well suited for their specific tasks, but for a different application you need to switch to an entirely different tool and regear yourself mentally. Not to mention doing an application that does two things at once... π Because we use Perl, we have the power and ease of Perl syntax, regular expressions, hash tables, etc. at our fingertips at all times. By extending an existing language, we start from a much healthier base than languages like Matlab, which have grown into existence from a very small functionality at first and expanded little by little, making things look badly planned. We stand by the Perl sayings: "simple things should be simple but complicated things should be possible" and "There is more than one way to do it" (TIMTOWTDI). periodt.
The third idea is interoperability: we want to be able to use PDL to drive as many tools as possible β we can connect to OpenGL or Mesa for graphics, or whatever. There isn't anything out there that's really satisfactory as a tool and can do everything we want easily. And be portable. π§
The fourth idea is related to "PDL::PP" and is Tuomas's personal favorite: code should only specify as little redundant info as possible. If you find yourself writing very similar-looking code much of the time, all that code could probably be generated by a simple Perl script. The PDL C preprocessor takes this to an extreme. π
β Minor goals and purposes β
We want speed. Optimally, it should ultimately (e.g. with the Perl compiler) be possible to compile "PDL::PP" subs to C and obtain the top vectorized speeds on supercomputers. Also, we want to be able to calculate things at near top speed from inside Perl, by using dataflow to avoid memory allocation and deallocation (the overhead should ultimately be only a little over one indirect function call plus couple of ifs per function in the pipe). π
π Go on, try it! π
Well, that's the philosophy behind PDL β speed, conciseness, free, expandable, and integrated with the wide base of modules and libraries that Perl provides. Feel free to download it, install it, run through some of the tutorials and introductions and have a play with it. πΈ
Enjoy! π
π AUTHOR π
Copyright(C) 1997 Tuomas J. Lukka (lukka@fas.harvard.edu). Same terms as the rest of PDL.
Added Karl Glazebrook (2001), contributions by Matthew Kenworthy
okay that's the whole page, bestie!! this was shipped with perl v5.38.2, dated 2024-04-10, and it lives in the User Contributed Perl Documentation section as PHILOSOPHY(1p) β go forth and manipulate some data vectors, you got this π β¨
π¦ where this page comes from
- ubuntu noble: pdl 1:2.085-1ubuntu1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms