"Fossies" - the Fresh Open Source Software Archive

Member "PDL-2.025/Basic/PDL.pm" (19 Nov 2020, 6441 Bytes) of package /linux/misc/PDL-2.025.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "PDL.pm" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.024_vs_2.025.

    1 =head1 NAME
    2 
    3 PDL - the Perl Data Language
    4 
    5 =head1 DESCRIPTION
    6 
    7 (For the exported PDL constructor, pdl(), see L<PDL::Core|PDL::Core>)
    8 
    9 PDL is the Perl Data Language, a perl extension that is designed for
   10 scientific and bulk numeric data processing and display.  It extends
   11 perl's syntax and includes fully vectorized, multidimensional array
   12 handling, plus several paths for device-independent graphics output.
   13 
   14 PDL is fast, comparable and often outperforming IDL and MATLAB in real
   15 world applications. PDL allows large N-dimensional data sets such as large
   16 images, spectra, etc to be stored efficiently and manipulated quickly. 
   17 
   18 
   19 =head1 VECTORIZATION 
   20 
   21 For a description of the vectorization (also called "threading"), see
   22 L<PDL::Core|PDL::Core>.
   23 
   24 
   25 =head1 INTERACTIVE SHELL
   26 
   27 The PDL package includes an interactive shell. You can learn about it,
   28 run C<perldoc perldl>, or run the shell C<perldl> or C<pdl2> and type
   29 C<help>.
   30 
   31 =head1 LOOKING FOR A FUNCTION?
   32 
   33 If you want to search for a function name, you should use the PDL
   34 shell along with the "help" or "apropos" command (to do a fuzzy search).
   35 For example:
   36 
   37  pdl> apropos xval
   38  xlinvals        X axis values between endpoints (see xvals).
   39  xlogvals        X axis values logarithmicly spaced...
   40  xvals           Fills a piddle with X index values...
   41  yvals           Fills a piddle with Y index values. See the CAVEAT for xvals.
   42  zvals           Fills a piddle with Z index values. See the CAVEAT for xvals.
   43 
   44 To learn more about the PDL shell, see L<perldl|perldl> or L<pdl2|pdl2>.
   45 
   46 =head1 LANGUAGE DOCUMENTATION
   47 
   48 Most PDL documentation describes the language features. The number of
   49 PDL pages is too great to list here. The following pages offer some
   50 guidance to help you find the documentation you need.
   51 
   52 
   53 =over 5
   54 
   55 =item L<PDL::FAQ|PDL::FAQ>
   56 
   57 Frequently asked questions about PDL. This page covers a lot of
   58 questions that do not fall neatly into any of the documentation
   59 categories.
   60 
   61 =item L<PDL::Tutorials|PDL::Tutorials>
   62 
   63 A guide to PDL's tutorial-style documentation. With topics from beginner
   64 to advanced, these pages teach you various aspects of PDL step by step.
   65 
   66 =item L<PDL::Modules|PDL::Modules>
   67 
   68 A guide to PDL's module reference. Modules are organized by level
   69 (foundation to advanced) and by category (graphics, numerical methods,
   70 etc) to help you find the module you need as quickly as possible.
   71 
   72 =item L<PDL::Course|PDL::Course>
   73 
   74 This page compiles PDL's tutorial and reference pages into a comprehensive
   75 course that takes you from a complete beginner level to expert.
   76 
   77 =item L<PDL::Index|PDL::Index>
   78 
   79 List of all available documentation, sorted alphabetically. If you
   80 cannot find what you are looking for, try here.
   81 
   82 =back
   83 
   84 
   85 =head1 MODULES
   86 
   87 PDL includes about a dozen perl modules that form the core of the
   88 language, plus additional modules that add further functionality.
   89 The perl module "PDL" loads all of the core modules automatically,
   90 making their functions available in the current perl namespace.
   91 Some notes:
   92 
   93 =over 5
   94 
   95 =item Modules loaded by default
   96 
   97 See the SYNOPSIS section at the end of this document for a list of
   98 modules loaded by default.
   99 
  100 =item L<PDL::Lite|PDL::Lite> and L<PDL::LiteF|PDL::LiteF>
  101 
  102 These are lighter-weight alternatives to the standard PDL module.
  103 Consider using these modules if startup time becomes an issue.
  104 
  105 =item Exports
  106 
  107 C<use PDL;> exports a large number of routines into the calling
  108 namespace.  If you want to avoid namespace pollution, you must instead 
  109 C<use PDL::Lite>, and include any additional modules explicitly.
  110 
  111 =item L<PDL::NiceSlice|PDL::NiceSlice>
  112 
  113 Note that the L<PDL::NiceSlice|PDL::NiceSlice> syntax is NOT automatically
  114 loaded by C<use PDL;>.  If you want to use the extended slicing syntax in 
  115 a standalone script, you must also say C<use PDL::NiceSlice;>.
  116 
  117 =item L<PDL::Math|PDL::Math>
  118 
  119 The L<PDL::Math|PDL::Math> module has been added to the list of modules
  120 for versions later than 2.3.1. Note that PDL::Math is still
  121 I<not> included in the L<PDL::Lite|PDL::Lite> and L<PDL::LiteF|PDL::LiteF>
  122 start-up modules.
  123 
  124 =back
  125 
  126 =head1 SYNOPSIS
  127 
  128  use PDL; # Is equivalent to the following:
  129 
  130    use PDL::Core;
  131    use PDL::Ops;
  132    use PDL::Primitive;
  133    use PDL::Ufunc;
  134    use PDL::Basic;
  135    use PDL::Slices;
  136    use PDL::Bad;
  137    use PDL::MatrixOps;
  138    use PDL::Math;
  139    use PDL::Version;
  140    use PDL::IO::Misc;
  141    use PDL::IO::FITS;
  142    use PDL::IO::Pic;
  143    use PDL::IO::Storable;
  144    use PDL::Lvalue;
  145 
  146 =cut
  147 
  148 
  149 # set the version:
  150 $PDL::VERSION = '2.025';
  151 
  152 # Main loader of standard PDL package
  153 
  154 sub PDL::import {
  155 
  156 my $pkg = (caller())[0];
  157 eval <<"EOD";
  158 
  159 package $pkg;
  160 
  161 # Load the fundamental packages
  162 
  163 use PDL::Core;
  164 use PDL::Ops;
  165 use PDL::Primitive;
  166 use PDL::Ufunc;
  167 use PDL::Basic;
  168 use PDL::Slices;
  169 use PDL::Bad;
  170 use PDL::Math;
  171 use PDL::MatrixOps;
  172 use PDL::Lvalue;
  173 
  174 # Load these for TPJ compatibility
  175 
  176 use PDL::IO::Misc;          # Misc IO (Ascii)
  177 use PDL::IO::FITS;          # FITS IO (rfits/wfits; used by rpic/wpic too)
  178 use PDL::IO::Pic;           # rpic/wpic
  179 
  180 # Load this so config/install info is available
  181 
  182 use PDL::Config;
  183 
  184 # Load this to avoid mysterious Storable segfaults
  185 
  186 use PDL::IO::Storable;
  187 
  188 EOD
  189 
  190 die $@ if $@;
  191 
  192 }
  193 
  194 
  195 # Dummy Package PDL Statement. This is only needed so CPAN
  196 # properly recognizes the PDL package.
  197 package PDL;
  198 
  199 # support: use Inline with => 'PDL';
  200 # Returns a hash containing parameters accepted by recent versions of
  201 # Inline, to tweak compilation.  Not normally called by anyone but
  202 # the Inline API.
  203 #
  204 # If you're trying to debug the actual code, you're looking for "IFiles.pm"
  205 # which is currently in the Core directory. --CED 23-Feb-2015
  206 sub Inline {
  207     require PDL::Install::Files;
  208     goto &PDL::Install::Files::Inline;
  209 }
  210 
  211 ##################################################
  212 # Rudimentary handling for multiple Perl threads #
  213 ##################################################
  214 my $clone_skip_should_be_quiet = 0;
  215 sub CLONE_SKIP {
  216     warn("* If you need to share PDL data across threads, use memory mapped data, or\n"
  217         . "* check out PDL::Parallel::threads, available on CPAN.\n"
  218         . "* You can silence this warning by saying `PDL::no_clone_skip_warning;'\n"
  219         . "* before you create your first thread.\n")
  220         unless $clone_skip_should_be_quiet;
  221     PDL::no_clone_skip_warning();
  222     # Whether we warned or not, always return 1 to tell Perl not to clone PDL data
  223     return 1;
  224 }
  225 sub no_clone_skip_warning {
  226     $clone_skip_should_be_quiet = 1;
  227 }
  228 
  229 # Exit with OK status
  230 1;