| 1 | package PDL; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 73 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 73 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | # set the version - this is the real location again | ||||||||||||||
| 7 | 73 | our $VERSION = '2.106'; | |||||||||||||
| 8 | |||||||||||||||
| 9 | =head1 NAME | ||||||||||||||
| 10 | |||||||||||||||
| 11 | PDL - the Perl Data Language | ||||||||||||||
| 12 | |||||||||||||||
| 13 | =head1 SYNOPSIS | ||||||||||||||
| 14 | |||||||||||||||
| 15 | use PDL; | ||||||||||||||
| 16 | $x = zeroes 3,3; # 3x3 matrix | ||||||||||||||
| 17 | $y = $x + 0.1 * xvals($x) + 0.01 * yvals($x); | ||||||||||||||
| 18 | print $y; | ||||||||||||||
| 19 | print $y->slice(":,1"); # row 2 | ||||||||||||||
| 20 | print $diag = $y->diagonal(0,1), "\n"; # 0 and 1 are the dimensions | ||||||||||||||
| 21 | $diag += 100; | ||||||||||||||
| 22 | print "AFTER, y=$y"; | ||||||||||||||
| 23 | [ | ||||||||||||||
| 24 | [ 0 0.1 0.2] | ||||||||||||||
| 25 | [0.01 0.11 0.21] | ||||||||||||||
| 26 | [0.02 0.12 0.22] | ||||||||||||||
| 27 | ] | ||||||||||||||
| 28 | [ | ||||||||||||||
| 29 | [0.01 0.11 0.21] | ||||||||||||||
| 30 | ] | ||||||||||||||
| 31 | [0 0.11 0.22] | ||||||||||||||
| 32 | AFTER, y= | ||||||||||||||
| 33 | [ | ||||||||||||||
| 34 | [ 100 0.1 0.2] | ||||||||||||||
| 35 | [ 0.01 100.11 0.21] | ||||||||||||||
| 36 | [ 0.02 0.12 100.22] | ||||||||||||||
| 37 | ] | ||||||||||||||
| 38 | |||||||||||||||
| 39 | =head1 DESCRIPTION | ||||||||||||||
| 40 | |||||||||||||||
| 41 | (For the exported PDL constructor, pdl(), see L<PDL::Core>) | ||||||||||||||
| 42 | |||||||||||||||
| 43 | PDL is the Perl Data Language, a perl extension that is designed for | ||||||||||||||
| 44 | scientific and bulk numeric data processing and display. It extends | ||||||||||||||
| 45 | perl's syntax and includes fully vectorized, multidimensional array | ||||||||||||||
| 46 | handling, plus several paths for device-independent graphics output. | ||||||||||||||
| 47 | |||||||||||||||
| 48 | PDL is fast, comparable and often outperforming IDL and MATLAB in real | ||||||||||||||
| 49 | world applications. PDL allows large N-dimensional data sets such as large | ||||||||||||||
| 50 | images, spectra, etc to be stored efficiently and manipulated quickly. | ||||||||||||||
| 51 | |||||||||||||||
| 52 | =head1 VECTORIZATION | ||||||||||||||
| 53 | |||||||||||||||
| 54 | For a description of the vectorization (also called "broadcasting"), see | ||||||||||||||
| 55 | L<PDL::Core>. | ||||||||||||||
| 56 | |||||||||||||||
| 57 | =head1 INTERACTIVE SHELL | ||||||||||||||
| 58 | |||||||||||||||
| 59 | The PDL package includes an interactive shell. You can learn about it, | ||||||||||||||
| 60 | run C<perldoc perldl>, or run the shell C<perldl> and type | ||||||||||||||
| 61 | C<help>. | ||||||||||||||
| 62 | |||||||||||||||
| 63 | =head1 LOOKING FOR A FUNCTION? | ||||||||||||||
| 64 | |||||||||||||||
| 65 | If you want to search for a function name, you should use the PDL | ||||||||||||||
| 66 | shell along with the "help" or "apropos" command (to do a fuzzy search). | ||||||||||||||
| 67 | For example: | ||||||||||||||
| 68 | |||||||||||||||
| 69 | pdl> apropos xval | ||||||||||||||
| 70 | xlinvals X axis values between endpoints (see xvals). | ||||||||||||||
| 71 | xlogvals X axis values logarithmicly spaced... | ||||||||||||||
| 72 | xvals Fills an ndarray with X index values... | ||||||||||||||
| 73 | yvals Fills an ndarray with Y index values. See the CAVEAT for xvals. | ||||||||||||||
| 74 | zvals Fills an ndarray with Z index values. See the CAVEAT for xvals. | ||||||||||||||
| 75 | |||||||||||||||
| 76 | To learn more about the PDL shell, see L<perldl>. | ||||||||||||||
| 77 | |||||||||||||||
| 78 | =head1 LANGUAGE DOCUMENTATION | ||||||||||||||
| 79 | |||||||||||||||
| 80 | Most PDL documentation describes the language features. The number of | ||||||||||||||
| 81 | PDL pages is too great to list here. The following pages offer some | ||||||||||||||
| 82 | guidance to help you find the documentation you need. | ||||||||||||||
| 83 | |||||||||||||||
| 84 | =over 5 | ||||||||||||||
| 85 | |||||||||||||||
| 86 | =item L<PDL::FAQ> | ||||||||||||||
| 87 | |||||||||||||||
| 88 | Frequently asked questions about PDL. This page covers a lot of | ||||||||||||||
| 89 | questions that do not fall neatly into any of the documentation | ||||||||||||||
| 90 | categories. | ||||||||||||||
| 91 | |||||||||||||||
| 92 | =item L<PDL::Tutorials> | ||||||||||||||
| 93 | |||||||||||||||
| 94 | A guide to PDL's tutorial-style documentation. With topics from beginner | ||||||||||||||
| 95 | to advanced, these pages teach you various aspects of PDL step by step. | ||||||||||||||
| 96 | |||||||||||||||
| 97 | =item L<PDL::Modules> | ||||||||||||||
| 98 | |||||||||||||||
| 99 | A guide to PDL's module reference. Modules are organized by level | ||||||||||||||
| 100 | (foundation to advanced) and by category (graphics, numerical methods, | ||||||||||||||
| 101 | etc) to help you find the module you need as quickly as possible. | ||||||||||||||
| 102 | |||||||||||||||
| 103 | =item L<PDL::Course> | ||||||||||||||
| 104 | |||||||||||||||
| 105 | This page compiles PDL's tutorial and reference pages into a comprehensive | ||||||||||||||
| 106 | course that takes you from a complete beginner level to expert. | ||||||||||||||
| 107 | |||||||||||||||
| 108 | =item L<PDL::Index> | ||||||||||||||
| 109 | |||||||||||||||
| 110 | List of all available documentation, sorted alphabetically. If you | ||||||||||||||
| 111 | cannot find what you are looking for, try here. | ||||||||||||||
| 112 | |||||||||||||||
| 113 | =item L<PDL::DeveloperGuide> | ||||||||||||||
| 114 | |||||||||||||||
| 115 | A guide for people who want to contribute to PDL. Contributions are | ||||||||||||||
| 116 | very welcome! | ||||||||||||||
| 117 | |||||||||||||||
| 118 | =back | ||||||||||||||
| 119 | |||||||||||||||
| 120 | =head1 DATA TYPES | ||||||||||||||
| 121 | |||||||||||||||
| 122 | PDL comes with support for most native numeric data types available in C. | ||||||||||||||
| 123 | 2.027 added support for C99 complex numbers. See | ||||||||||||||
| 124 | L<PDL::Core>, L<PDL::Ops> and L<PDL::Math> for details on usage and | ||||||||||||||
| 125 | behaviour. | ||||||||||||||
| 126 | |||||||||||||||
| 127 | =head1 MODULES | ||||||||||||||
| 128 | |||||||||||||||
| 129 | PDL includes about a dozen perl modules that form the core of the | ||||||||||||||
| 130 | language, plus additional modules that add further functionality. | ||||||||||||||
| 131 | The perl module "PDL" loads all of the core modules automatically, | ||||||||||||||
| 132 | making their functions available in the current perl namespace. | ||||||||||||||
| 133 | Some notes: | ||||||||||||||
| 134 | |||||||||||||||
| 135 | =over 5 | ||||||||||||||
| 136 | |||||||||||||||
| 137 | =item Modules loaded by default | ||||||||||||||
| 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 | |||||||||||||||
| 155 | =cut | ||||||||||||||
| 156 | |||||||||||||||
| 157 | # Main loader of standard PDL package | ||||||||||||||
| 158 | |||||||||||||||
| 159 | 14 | ▶ | sub import { | ||||||||||||
|
Subroutine
import: called CC=2 SCAR=6.9
| |||||||||||||||
| 160 | 14 | my $pkg = (caller())[0]; | |||||||||||||
| 161 | 14 | ▶ | eval <<"EOD"; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 162 | package $pkg; | ||||||||||||||
| 163 | # Load the fundamental packages | ||||||||||||||
| 164 | use PDL::Core; | ||||||||||||||
| 165 | use PDL::Ops; | ||||||||||||||
| 166 | use PDL::Primitive; | ||||||||||||||
| 167 | use PDL::Ufunc; | ||||||||||||||
| 168 | use PDL::Basic; | ||||||||||||||
| 169 | use PDL::Slices; | ||||||||||||||
| 170 | use PDL::Bad; | ||||||||||||||
| 171 | use PDL::MatrixOps; | ||||||||||||||
| 172 | use PDL::Math; | ||||||||||||||
| 173 | # for TPJ compatibility | ||||||||||||||
| 174 | use PDL::IO::Misc; # Misc IO (Ascii) | ||||||||||||||
| 175 | use PDL::IO::FITS; # FITS IO (rfits/wfits; used by rpic/wpic too) | ||||||||||||||
| 176 | use PDL::IO::Pic; # rpic/wpic | ||||||||||||||
| 177 | # end TPJ bit | ||||||||||||||
| 178 | use PDL::IO::Storable; # to avoid mysterious Storable segfaults | ||||||||||||||
| 179 | EOD | ||||||||||||||
| 180 | 14 | ▶ | die $@ if $@; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 181 | } | ||||||||||||||
| 182 | |||||||||||||||
| 183 | =item L<PDL::Lite> and L<PDL::LiteF> | ||||||||||||||
| 184 | |||||||||||||||
| 185 | These are lighter-weight alternatives to the standard PDL module. | ||||||||||||||
| 186 | Consider using these modules if startup time becomes an issue. | ||||||||||||||
| 187 | |||||||||||||||
| 188 | Note that L<PDL::Math> and L<PDL::MatrixOps> are | ||||||||||||||
| 189 | I<not> included in the L<PDL::Lite> and L<PDL::LiteF> | ||||||||||||||
| 190 | start-up modules. | ||||||||||||||
| 191 | |||||||||||||||
| 192 | =item Exports | ||||||||||||||
| 193 | |||||||||||||||
| 194 | C<use PDL;> exports a large number of routines into the calling | ||||||||||||||
| 195 | namespace. If you want to avoid namespace pollution, you must instead | ||||||||||||||
| 196 | C<use PDL::Lite>, and include any additional modules explicitly. | ||||||||||||||
| 197 | |||||||||||||||
| 198 | =item L<PDL::NiceSlice> | ||||||||||||||
| 199 | |||||||||||||||
| 200 | Note that the L<PDL::NiceSlice> syntax is NOT automatically | ||||||||||||||
| 201 | loaded by C<use PDL;>. If you want to use the extended slicing syntax in | ||||||||||||||
| 202 | a standalone script, you must also say C<use PDL::NiceSlice;>. | ||||||||||||||
| 203 | |||||||||||||||
| 204 | =back | ||||||||||||||
| 205 | |||||||||||||||
| 206 | =head1 INTERNATIONALIZATION | ||||||||||||||
| 207 | |||||||||||||||
| 208 | PDL currently does not have internationalization support for | ||||||||||||||
| 209 | its error messages although Perl itself does support i18n | ||||||||||||||
| 210 | and locales. Some of the tests for names and strings are | ||||||||||||||
| 211 | specific to ASCII and English. Please report any issues | ||||||||||||||
| 212 | regarding internationalization to the perldl mailing lists. | ||||||||||||||
| 213 | |||||||||||||||
| 214 | Of course, volunteers to implement this or help with the | ||||||||||||||
| 215 | translations would be welcome. | ||||||||||||||
| 216 | |||||||||||||||
| 217 | =head1 INSTALLATION | ||||||||||||||
| 218 | |||||||||||||||
| 219 | See L<PDL::InstallGuide> for help. | ||||||||||||||
| 220 | |||||||||||||||
| 221 | =cut | ||||||||||||||
| 222 | |||||||||||||||
| 223 | # support: use Inline with => 'PDL'; | ||||||||||||||
| 224 | # Returns a hash containing parameters accepted by recent versions of | ||||||||||||||
| 225 | # Inline, to tweak compilation. Not normally called by anyone but | ||||||||||||||
| 226 | # the Inline API. | ||||||||||||||
| 227 | 3 | ▶ | sub Inline { | ||||||||||||
|
Subroutine
Inline: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||
| 228 | 3 | ▶ | require PDL::Install::Files; | ||||||||||||
|
Pod
undocumented
| |||||||||||||||
| 229 | 3 | goto &PDL::Install::Files::Inline; | |||||||||||||
| 230 | } | ||||||||||||||
| 231 | |||||||||||||||
| 232 | ################################################## | ||||||||||||||
| 233 | # Rudimentary handling for multiple Perl threads # | ||||||||||||||
| 234 | ################################################## | ||||||||||||||
| 235 | 73 | our $no_clone_skip_warning = 0; | |||||||||||||
| 236 | 2 | ▶ | sub CLONE_SKIP { | ||||||||||||
|
Subroutine
CLONE_SKIP: called CC=2 SCAR=10.1
| |||||||||||||||
| 237 | 2 | ▶ | warn <<'EOF' if !$no_clone_skip_warning; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 238 | * If you need to share PDL data across threads, use memory mapped data, or | ||||||||||||||
| 239 | * check out PDL::Parallel::threads, available on CPAN. | ||||||||||||||
| 240 | * You can silence this warning by saying `$PDL::no_clone_skip_warning = 1;' | ||||||||||||||
| 241 | * before you create your first thread. | ||||||||||||||
| 242 | EOF | ||||||||||||||
| 243 | 2 | $no_clone_skip_warning = 1; | |||||||||||||
| 244 | # always return 1 to tell Perl not to clone PDL data | ||||||||||||||
| 245 | 2 | return 1; | |||||||||||||
| 246 | } | ||||||||||||||
| 247 | |||||||||||||||
| 248 | 73 | 1; | |||||||||||||