PDL::BadValues

PDL::BadValues contains a discussion of bad value support in PDL.
Download

PDL::BadValues Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Doug Burke
  • Publisher web site:
  • http://search.cpan.org/~djburke/Inline-SLang-1.00/SLang.pod

PDL::BadValues Tags


PDL::BadValues Description

PDL::BadValues contains a discussion of bad value support in PDL. PDL::BadValues contains a discussion of bad value support in PDL.What are bad values and why should I bother with them?Sometimes it's useful to be able to specify a certain value is 'bad' or 'missing'; for example CCDs used in astronomy produce 2D images which are not perfect since certain areas contain invalid data due to imperfections in the detector. Whilst PDL's powerful index routines and all the complicated business with dataflow, slices, etc etc mean that these regions can be ignored in processing, it's awkward to do. It would be much easier to be able to say $c = $a + $b and leave all the hassle to the computer.If you're not interested in this, then you may (rightly) be concerned with how this affects the speed of PDL, since the overhead of checking for a bad value at each operation can be large. Because of this, the code has been written to be as fast as possible - particularly when operating on piddles which do not contain bad values. In fact, you should notice essentially no speed difference when working with piddles which do not contain bad values.However, if you do not want bad values, then PDL's WITH_BADVAL configuration option comes to the rescue; if set to 0 or undef, the bad-value support is ignored. About the only time I think you'll need to use this - I admit, I'm biased ;) - is if you have limited disk or memory space, since the size of the code is increased (see below).You may also ask 'well, my computer supports IEEE NaN, so I already have this'. Well, yes and no - many routines, such as y=sin(x), will propogate NaN's without the user having to code differently, but routines such as qsort, or finding the median of an array, need to be re-coded to handle bad values. For floating-point datatypes, NaN and Inf are used to flag bad values IF the option BADVAL_USENAN is set to 1 in your config file. Otherwise special values are used (Default bad values). I do not have any benchmarks to see which option is faster.There is an experimental feadture BADVAL_PER_PDL which, if set, allows you to have different bad values for separate piddles of the same type. This currently does not work with the BADVAL_USENAN option; if both are set then PDL will ignore the BADVAL_USENAN value.Code increase due to bad valuesThe following comparison is out of date!On an i386 machine running linux and perl 5.005_03, I measured the following sizes (the Slatec code was compiled in, but none of the other options: eg Karma, FFTW, GSL, and 3d were):WITH_BADVAL = 0Size of blib directory after a successful make = 4963 kb: blib/arch = 2485 kb and blib/lib = 1587 kb.WITH_BADVAL = 1Size of blib directory after a successful make = 5723 kb: blib/arch = 3178 kb and blib/lib = 1613 kb.So, the overall increase is only 15% - not much to pay for all the wonders that bad values provides.The source code used for this test had the vast majority of the core routines (eg those in Basic/) converted to use bad values, whilst very few of the 'external' routines (ie everything else in the PDL distribution) had been changed.Requirements:· Perl Requirements: · Perl


PDL::BadValues Related Software