line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
PDL - the Perl Data Language |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 DESCRIPTION |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
(For the exported PDL constructor, pdl(), see L) |
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. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 INTERACTIVE SHELL |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
The PDL package includes an interactive shell. You can learn about it, |
28
|
|
|
|
|
|
|
run C, or run the shell C or C and type |
29
|
|
|
|
|
|
|
C. |
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 or L. |
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 |
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 |
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 |
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 |
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 |
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 and L |
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 |
108
|
|
|
|
|
|
|
namespace. If you want to avoid namespace pollution, you must instead |
109
|
|
|
|
|
|
|
C |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item L |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Note that the L syntax is NOT automatically |
114
|
|
|
|
|
|
|
loaded by C |
115
|
|
|
|
|
|
|
a standalone script, you must also say C |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
The L 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 included in the L and L |
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.026_02'; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# Main loader of standard PDL package |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub PDL::import { |
155
|
|
|
|
|
|
|
|
156
|
61
|
|
|
61
|
|
139848
|
my $pkg = (caller())[0]; |
157
|
61
|
|
|
54
|
|
3652
|
eval <<"EOD"; |
|
54
|
|
|
54
|
|
29611
|
|
|
54
|
|
|
54
|
|
197
|
|
|
54
|
|
|
54
|
|
470
|
|
|
54
|
|
|
54
|
|
23048
|
|
|
54
|
|
|
54
|
|
170
|
|
|
54
|
|
|
54
|
|
497
|
|
|
54
|
|
|
54
|
|
29472
|
|
|
54
|
|
|
54
|
|
222
|
|
|
54
|
|
|
54
|
|
443
|
|
|
54
|
|
|
54
|
|
28698
|
|
|
54
|
|
|
47
|
|
207
|
|
|
54
|
|
|
47
|
|
433
|
|
|
54
|
|
|
47
|
|
21028
|
|
|
54
|
|
|
47
|
|
190
|
|
|
54
|
|
|
|
|
546
|
|
|
54
|
|
|
|
|
437
|
|
|
54
|
|
|
|
|
137
|
|
|
54
|
|
|
|
|
392
|
|
|
54
|
|
|
|
|
23856
|
|
|
54
|
|
|
|
|
165
|
|
|
54
|
|
|
|
|
1356
|
|
|
54
|
|
|
|
|
401
|
|
|
54
|
|
|
|
|
126
|
|
|
54
|
|
|
|
|
367
|
|
|
54
|
|
|
|
|
397
|
|
|
54
|
|
|
|
|
115
|
|
|
54
|
|
|
|
|
411
|
|
|
54
|
|
|
|
|
27144
|
|
|
54
|
|
|
|
|
181
|
|
|
54
|
|
|
|
|
1570
|
|
|
54
|
|
|
|
|
32540
|
|
|
54
|
|
|
|
|
203
|
|
|
54
|
|
|
|
|
606
|
|
|
54
|
|
|
|
|
37061
|
|
|
54
|
|
|
|
|
243
|
|
|
54
|
|
|
|
|
785
|
|
|
47
|
|
|
|
|
33343
|
|
|
47
|
|
|
|
|
205
|
|
|
47
|
|
|
|
|
543
|
|
|
47
|
|
|
|
|
394
|
|
|
47
|
|
|
|
|
121
|
|
|
47
|
|
|
|
|
1375
|
|
|
47
|
|
|
|
|
25269
|
|
|
47
|
|
|
|
|
167
|
|
|
47
|
|
|
|
|
349
|
|
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
|
61
|
50
|
|
|
|
6399
|
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
|
8
|
|
|
8
|
0
|
155204
|
require PDL::Install::Files; |
208
|
8
|
|
|
|
|
27
|
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
|
7
|
0
|
|
7
|
|
57
|
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
|
7
|
|
|
|
|
50
|
PDL::no_clone_skip_warning(); |
222
|
|
|
|
|
|
|
# Whether we warned or not, always return 1 to tell Perl not to clone PDL data |
223
|
7
|
|
|
|
|
18
|
return 1; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
sub no_clone_skip_warning { |
226
|
7
|
|
|
7
|
0
|
70
|
$clone_skip_should_be_quiet = 1; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
# Exit with OK status |
230
|
|
|
|
|
|
|
1; |