1Ops(3)                User Contributed Perl Documentation               Ops(3)
2
3
4

NAME

6       PDL::Ops - Fundamental mathematical operators
7

DESCRIPTION

9       This module provides the functions used by PDL to overload the basic
10       mathematical operators ("+ - / *" etc.) and functions ("sin sqrt" etc.)
11
12       It also includes the function "log10", which should be a perl function
13       so that we can overload it!
14
15       Matrix multiplication (the operator "x") is handled by the module
16       PDL::Primitive.
17

SYNOPSIS

19       none
20

FUNCTIONS

22       plus
23
24         Signature: (a(); b(); [o]c(); int swap)
25
26       add two piddles
27
28          $c = plus $a, $b, 0;     # explicit call with trailing 0
29          $c = $a + $b;           # overloaded call
30          $a->inplace->plus($b,0);  # modify $a inplace
31
32       It can be made to work inplace with the "$a->inplace" syntax.  This
33       function is used to overload the binary "+" operator.  Note that when
34       calling this function explicitly you need to supply a third argument
35       that should generally be zero (see first example).  This restriction is
36       expected to go away in future releases.
37
38       mult
39
40         Signature: (a(); b(); [o]c(); int swap)
41
42       multiply two piddles
43
44          $c = mult $a, $b, 0;     # explicit call with trailing 0
45          $c = $a * $b;           # overloaded call
46          $a->inplace->mult($b,0);  # modify $a inplace
47
48       It can be made to work inplace with the "$a->inplace" syntax.  This
49       function is used to overload the binary "*" operator.  Note that when
50       calling this function explicitly you need to supply a third argument
51       that should generally be zero (see first example).  This restriction is
52       expected to go away in future releases.
53
54       minus
55
56         Signature: (a(); b(); [o]c(); int swap)
57
58       subtract two piddles
59
60          $c = minus $a, $b, 0;     # explicit call with trailing 0
61          $c = $a - $b;           # overloaded call
62          $a->inplace->minus($b,0);  # modify $a inplace
63
64       It can be made to work inplace with the "$a->inplace" syntax.  This
65       function is used to overload the binary "-" operator.  Note that when
66       calling this function explicitly you need to supply a third argument
67       that should generally be zero (see first example).  This restriction is
68       expected to go away in future releases.
69
70       divide
71
72         Signature: (a(); b(); [o]c(); int swap)
73
74       divide two piddles
75
76          $c = divide $a, $b, 0;     # explicit call with trailing 0
77          $c = $a / $b;           # overloaded call
78          $a->inplace->divide($b,0);  # modify $a inplace
79
80       It can be made to work inplace with the "$a->inplace" syntax.  This
81       function is used to overload the binary "/" operator.  Note that when
82       calling this function explicitly you need to supply a third argument
83       that should generally be zero (see first example).  This restriction is
84       expected to go away in future releases.
85
86       gt
87
88         Signature: (a(); b(); [o]c(); int swap)
89
90       the binary > (greater than) operation
91
92          $c = gt $a, $b, 0;     # explicit call with trailing 0
93          $c = $a > $b;           # overloaded call
94          $a->inplace->gt($b,0);  # modify $a inplace
95
96       It can be made to work inplace with the "$a->inplace" syntax.  This
97       function is used to overload the binary ">" operator.  Note that when
98       calling this function explicitly you need to supply a third argument
99       that should generally be zero (see first example).  This restriction is
100       expected to go away in future releases.
101
102       lt
103
104         Signature: (a(); b(); [o]c(); int swap)
105
106       the binary < (less than) operation
107
108          $c = lt $a, $b, 0;     # explicit call with trailing 0
109          $c = $a < $b;           # overloaded call
110          $a->inplace->lt($b,0);  # modify $a inplace
111
112       It can be made to work inplace with the "$a->inplace" syntax.  This
113       function is used to overload the binary "<" operator.  Note that when
114       calling this function explicitly you need to supply a third argument
115       that should generally be zero (see first example).  This restriction is
116       expected to go away in future releases.
117
118       le
119
120         Signature: (a(); b(); [o]c(); int swap)
121
122       the binary <= (less equal) operation
123
124          $c = le $a, $b, 0;     # explicit call with trailing 0
125          $c = $a <= $b;           # overloaded call
126          $a->inplace->le($b,0);  # modify $a inplace
127
128       It can be made to work inplace with the "$a->inplace" syntax.  This
129       function is used to overload the binary "<=" operator.  Note that when
130       calling this function explicitly you need to supply a third argument
131       that should generally be zero (see first example).  This restriction is
132       expected to go away in future releases.
133
134       ge
135
136         Signature: (a(); b(); [o]c(); int swap)
137
138       the binary >= (greater equal) operation
139
140          $c = ge $a, $b, 0;     # explicit call with trailing 0
141          $c = $a >= $b;           # overloaded call
142          $a->inplace->ge($b,0);  # modify $a inplace
143
144       It can be made to work inplace with the "$a->inplace" syntax.  This
145       function is used to overload the binary ">=" operator.  Note that when
146       calling this function explicitly you need to supply a third argument
147       that should generally be zero (see first example).  This restriction is
148       expected to go away in future releases.
149
150       eq
151
152         Signature: (a(); b(); [o]c(); int swap)
153
154       binary equal to operation ("==")
155
156          $c = eq $a, $b, 0;     # explicit call with trailing 0
157          $c = $a == $b;           # overloaded call
158          $a->inplace->eq($b,0);  # modify $a inplace
159
160       It can be made to work inplace with the "$a->inplace" syntax.  This
161       function is used to overload the binary "==" operator.  Note that when
162       calling this function explicitly you need to supply a third argument
163       that should generally be zero (see first example).  This restriction is
164       expected to go away in future releases.
165
166       ne
167
168         Signature: (a(); b(); [o]c(); int swap)
169
170       binary not equal to operation ("!=")
171
172          $c = ne $a, $b, 0;     # explicit call with trailing 0
173          $c = $a != $b;           # overloaded call
174          $a->inplace->ne($b,0);  # modify $a inplace
175
176       It can be made to work inplace with the "$a->inplace" syntax.  This
177       function is used to overload the binary "!=" operator.  Note that when
178       calling this function explicitly you need to supply a third argument
179       that should generally be zero (see first example).  This restriction is
180       expected to go away in future releases.
181
182       shiftleft
183
184         Signature: (a(); b(); [o]c(); int swap)
185
186       leftshift "a$" by $b
187
188          $c = shiftleft $a, $b, 0;     # explicit call with trailing 0
189          $c = $a << $b;           # overloaded call
190          $a->inplace->shiftleft($b,0);  # modify $a inplace
191
192       It can be made to work inplace with the "$a->inplace" syntax.  This
193       function is used to overload the binary "<<" operator.  Note that when
194       calling this function explicitly you need to supply a third argument
195       that should generally be zero (see first example).  This restriction is
196       expected to go away in future releases.
197
198       shiftright
199
200         Signature: (a(); b(); [o]c(); int swap)
201
202       leftshift "a$" by $b
203
204          $c = shiftright $a, $b, 0;     # explicit call with trailing 0
205          $c = $a >> $b;           # overloaded call
206          $a->inplace->shiftright($b,0);  # modify $a inplace
207
208       It can be made to work inplace with the "$a->inplace" syntax.  This
209       function is used to overload the binary ">>" operator.  Note that when
210       calling this function explicitly you need to supply a third argument
211       that should generally be zero (see first example).  This restriction is
212       expected to go away in future releases.
213
214       or2
215
216         Signature: (a(); b(); [o]c(); int swap)
217
218       binary or of two piddles
219
220          $c = or2 $a, $b, 0;     # explicit call with trailing 0
221          $c = $a ⎪ $b;           # overloaded call
222          $a->inplace->or2($b,0);  # modify $a inplace
223
224       It can be made to work inplace with the "$a->inplace" syntax.  This
225       function is used to overload the binary "⎪" operator.  Note that when
226       calling this function explicitly you need to supply a third argument
227       that should generally be zero (see first example).  This restriction is
228       expected to go away in future releases.
229
230       and2
231
232         Signature: (a(); b(); [o]c(); int swap)
233
234       binary and of two piddles
235
236          $c = and2 $a, $b, 0;     # explicit call with trailing 0
237          $c = $a & $b;           # overloaded call
238          $a->inplace->and2($b,0);  # modify $a inplace
239
240       It can be made to work inplace with the "$a->inplace" syntax.  This
241       function is used to overload the binary "&" operator.  Note that when
242       calling this function explicitly you need to supply a third argument
243       that should generally be zero (see first example).  This restriction is
244       expected to go away in future releases.
245
246       xor
247
248         Signature: (a(); b(); [o]c(); int swap)
249
250       binary exclusive or of two piddles
251
252          $c = xor $a, $b, 0;     # explicit call with trailing 0
253          $c = $a ^ $b;           # overloaded call
254          $a->inplace->xor($b,0);  # modify $a inplace
255
256       It can be made to work inplace with the "$a->inplace" syntax.  This
257       function is used to overload the binary "^" operator.  Note that when
258       calling this function explicitly you need to supply a third argument
259       that should generally be zero (see first example).  This restriction is
260       expected to go away in future releases.
261
262       bitnot
263
264         Signature: (a(); [o]b())
265
266       unary bit negation
267
268          $b = ~ $a;
269          $a->inplace->bitnot;  # modify $a inplace
270
271       It can be made to work inplace with the "$a->inplace" syntax.  This
272       function is used to overload the unary "~" operator/function.
273
274       power
275
276         Signature: (a(); b(); [o]c(); int swap)
277
278       raise piddle $a to the power "b"
279
280          $c = $a->power($b,0); # explicit function call
281          $c = $a ** $b;    # overloaded use
282          $a->inplace->power($b,0);     # modify $a inplace
283
284       It can be made to work inplace with the "$a->inplace" syntax.  This
285       function is used to overload the binary "**" function.  Note that when
286       calling this function explicitly you need to supply a third argument
287       that should generally be zero (see first example).  This restriction is
288       expected to go away in future releases.
289
290       atan2
291
292         Signature: (a(); b(); [o]c(); int swap)
293
294       elementwise "atan2" of two piddles
295
296          $c = $a->atan2($b,0); # explicit function call
297          $c = atan2 $a, $b;    # overloaded use
298          $a->inplace->atan2($b,0);     # modify $a inplace
299
300       It can be made to work inplace with the "$a->inplace" syntax.  This
301       function is used to overload the binary "atan2" function.  Note that
302       when calling this function explicitly you need to supply a third argu‐
303       ment that should generally be zero (see first example).  This restric‐
304       tion is expected to go away in future releases.
305
306       modulo
307
308         Signature: (a(); b(); [o]c(); int swap)
309
310       elementwise "modulo" operation
311
312          $c = $a->modulo($b,0); # explicit function call
313          $c = $a % $b;    # overloaded use
314          $a->inplace->modulo($b,0);     # modify $a inplace
315
316       It can be made to work inplace with the "$a->inplace" syntax.  This
317       function is used to overload the binary "%" function.  Note that when
318       calling this function explicitly you need to supply a third argument
319       that should generally be zero (see first example).  This restriction is
320       expected to go away in future releases.
321
322       spaceship
323
324         Signature: (a(); b(); [o]c(); int swap)
325
326       elementwise "~" operation
327
328          $c = $a->spaceship($b,0); # explicit function call
329          $c = $a <=> $b;    # overloaded use
330          $a->inplace->spaceship($b,0);     # modify $a inplace
331
332       It can be made to work inplace with the "$a->inplace" syntax.  This
333       function is used to overload the binary "<=>" function.  Note that when
334       calling this function explicitly you need to supply a third argument
335       that should generally be zero (see first example).  This restriction is
336       expected to go away in future releases.
337
338       sqrt
339
340         Signature: (a(); [o]b())
341
342       elementwise square root
343
344          $b = sqrt $a;
345          $a->inplace->sqrt;  # modify $a inplace
346
347       It can be made to work inplace with the "$a->inplace" syntax.  This
348       function is used to overload the unary "sqrt" operator/function.
349
350       abs
351
352         Signature: (a(); [o]b())
353
354       elementwise absolute value
355
356          $b = abs $a;
357          $a->inplace->abs;  # modify $a inplace
358
359       It can be made to work inplace with the "$a->inplace" syntax.  This
360       function is used to overload the unary "abs" operator/function.
361
362       sin
363
364         Signature: (a(); [o]b())
365
366       the sin function
367
368          $b = sin $a;
369          $a->inplace->sin;  # modify $a inplace
370
371       It can be made to work inplace with the "$a->inplace" syntax.  This
372       function is used to overload the unary "sin" operator/function.
373
374       cos
375
376         Signature: (a(); [o]b())
377
378       the cos function
379
380          $b = cos $a;
381          $a->inplace->cos;  # modify $a inplace
382
383       It can be made to work inplace with the "$a->inplace" syntax.  This
384       function is used to overload the unary "cos" operator/function.
385
386       not
387
388         Signature: (a(); [o]b())
389
390       the elementwise not operation
391
392          $b = ! $a;
393          $a->inplace->not;  # modify $a inplace
394
395       It can be made to work inplace with the "$a->inplace" syntax.  This
396       function is used to overload the unary "!" operator/function.
397
398       exp
399
400         Signature: (a(); [o]b())
401
402       the exponential function
403
404          $b = exp $a;
405          $a->inplace->exp;  # modify $a inplace
406
407       It can be made to work inplace with the "$a->inplace" syntax.  This
408       function is used to overload the unary "exp" operator/function.
409
410       log
411
412         Signature: (a(); [o]b())
413
414       the natural logarithm
415
416          $b = log $a;
417          $a->inplace->log;  # modify $a inplace
418
419       It can be made to work inplace with the "$a->inplace" syntax.  This
420       function is used to overload the unary "log" operator/function.
421
422       log10
423
424         Signature: (a(); [o]b())
425
426       the base 10 logarithm
427
428          $b = log10 $a;
429          $a->inplace->log10;  # modify $a inplace
430
431       It can be made to work inplace with the "$a->inplace" syntax.  This
432       function is used to overload the unary "log10" operator/function.
433
434       assgn
435
436         Signature: (a(); [o]b())
437
438       Plain numerical assignment. This is used to implement the ".=" operator
439

AUTHOR

441       Tuomas J. Lukka (lukka@fas.harvard.edu), Karl Glazebrook
442       (kgb@aaoepp.aao.gov.au), Doug Hunt (dhunt@ucar.edu), Christian Soeller
443       (c.soeller@auckland.ac.nz), Doug Burke (burke@ifa.hawaii.edu), and
444       Craig DeForest (deforest@boulder.swri.edu).
445
446
447
448perl v5.8.8                       2006-12-02                            Ops(3)
Impressum