"Fossies" - the Fresh Open Source Software Archive

Member "PDL-2.080/Basic/PDL.pm" (28 May 2022, 6187 Bytes) of package /linux/misc/PDL-2.080.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.079_vs_2.080.

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