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