| 1 | |||||||||||||||
| 2 | # | ||||||||||||||
| 3 | # GENERATED WITH PDL::PP! Don't modify! | ||||||||||||||
| 4 | # | ||||||||||||||
| 5 | package PDL::Ops; | ||||||||||||||
| 6 | |||||||||||||||
| 7 | 120 | @EXPORT_OK = qw( PDL::PP log10 PDL::PP assgn PDL::PP ipow ); | |||||||||||||
| 8 | 120 | %EXPORT_TAGS = (Func=>[@EXPORT_OK]); | |||||||||||||
| 9 | |||||||||||||||
| 10 | 120 | ▶ | use PDL::Core; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | 120 | ▶ | use PDL::Exporter; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | 120 | ▶ | use DynaLoader; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 13 | |||||||||||||||
| 14 | |||||||||||||||
| 15 | |||||||||||||||
| 16 | |||||||||||||||
| 17 | 120 | @ISA = ( 'PDL::Exporter','DynaLoader' ); | |||||||||||||
| 18 | 120 | push @PDL::Core::PP, __PACKAGE__; | |||||||||||||
| 19 | 120 | bootstrap PDL::Ops ; | |||||||||||||
| 20 | |||||||||||||||
| 21 | |||||||||||||||
| 22 | |||||||||||||||
| 23 | |||||||||||||||
| 24 | |||||||||||||||
| 25 | =head1 NAME | ||||||||||||||
| 26 | |||||||||||||||
| 27 | PDL::Ops - Fundamental mathematical operators | ||||||||||||||
| 28 | |||||||||||||||
| 29 | =head1 DESCRIPTION | ||||||||||||||
| 30 | |||||||||||||||
| 31 | This module provides the functions used by PDL to | ||||||||||||||
| 32 | overload the basic mathematical operators (C<+ - / *> | ||||||||||||||
| 33 | etc.) and functions (C<sin sqrt> etc.) | ||||||||||||||
| 34 | |||||||||||||||
| 35 | It also includes the function C<log10>, which should | ||||||||||||||
| 36 | be a perl function so that we can overload it! | ||||||||||||||
| 37 | |||||||||||||||
| 38 | Matrix multiplication (the operator C<x>) is handled | ||||||||||||||
| 39 | by the module L<PDL::Primitive|PDL::Primitive>. | ||||||||||||||
| 40 | |||||||||||||||
| 41 | =head1 SYNOPSIS | ||||||||||||||
| 42 | |||||||||||||||
| 43 | none | ||||||||||||||
| 44 | |||||||||||||||
| 45 | =cut | ||||||||||||||
| 46 | |||||||||||||||
| 47 | |||||||||||||||
| 48 | |||||||||||||||
| 49 | |||||||||||||||
| 50 | |||||||||||||||
| 51 | |||||||||||||||
| 52 | |||||||||||||||
| 53 | =head1 FUNCTIONS | ||||||||||||||
| 54 | |||||||||||||||
| 55 | |||||||||||||||
| 56 | |||||||||||||||
| 57 | =cut | ||||||||||||||
| 58 | |||||||||||||||
| 59 | |||||||||||||||
| 60 | |||||||||||||||
| 61 | |||||||||||||||
| 62 | |||||||||||||||
| 63 | |||||||||||||||
| 64 | =head2 plus | ||||||||||||||
| 65 | |||||||||||||||
| 66 | =for sig | ||||||||||||||
| 67 | |||||||||||||||
| 68 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 69 | |||||||||||||||
| 70 | =for ref | ||||||||||||||
| 71 | |||||||||||||||
| 72 | add two piddles | ||||||||||||||
| 73 | |||||||||||||||
| 74 | =for example | ||||||||||||||
| 75 | |||||||||||||||
| 76 | $c = plus $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 77 | $c = $a + $b; # overloaded call | ||||||||||||||
| 78 | $a->inplace->plus($b,0); # modify $a inplace | ||||||||||||||
| 79 | |||||||||||||||
| 80 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 81 | This function is used to overload the binary C<+> operator. | ||||||||||||||
| 82 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 83 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 84 | This restriction is expected to go away in future releases. | ||||||||||||||
| 85 | |||||||||||||||
| 86 | |||||||||||||||
| 87 | |||||||||||||||
| 88 | =for bad | ||||||||||||||
| 89 | |||||||||||||||
| 90 | plus processes bad values. | ||||||||||||||
| 91 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 92 | |||||||||||||||
| 93 | |||||||||||||||
| 94 | =cut | ||||||||||||||
| 95 | |||||||||||||||
| 96 | |||||||||||||||
| 97 | |||||||||||||||
| 98 | |||||||||||||||
| 99 | |||||||||||||||
| 100 | |||||||||||||||
| 101 | 120 | *plus = \&PDL::plus; | |||||||||||||
| 102 | |||||||||||||||
| 103 | |||||||||||||||
| 104 | |||||||||||||||
| 105 | |||||||||||||||
| 106 | |||||||||||||||
| 107 | =head2 mult | ||||||||||||||
| 108 | |||||||||||||||
| 109 | =for sig | ||||||||||||||
| 110 | |||||||||||||||
| 111 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 112 | |||||||||||||||
| 113 | =for ref | ||||||||||||||
| 114 | |||||||||||||||
| 115 | multiply two piddles | ||||||||||||||
| 116 | |||||||||||||||
| 117 | =for example | ||||||||||||||
| 118 | |||||||||||||||
| 119 | $c = mult $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 120 | $c = $a * $b; # overloaded call | ||||||||||||||
| 121 | $a->inplace->mult($b,0); # modify $a inplace | ||||||||||||||
| 122 | |||||||||||||||
| 123 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 124 | This function is used to overload the binary C<*> operator. | ||||||||||||||
| 125 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 126 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 127 | This restriction is expected to go away in future releases. | ||||||||||||||
| 128 | |||||||||||||||
| 129 | |||||||||||||||
| 130 | |||||||||||||||
| 131 | =for bad | ||||||||||||||
| 132 | |||||||||||||||
| 133 | mult processes bad values. | ||||||||||||||
| 134 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 135 | |||||||||||||||
| 136 | |||||||||||||||
| 137 | =cut | ||||||||||||||
| 138 | |||||||||||||||
| 139 | |||||||||||||||
| 140 | |||||||||||||||
| 141 | |||||||||||||||
| 142 | |||||||||||||||
| 143 | |||||||||||||||
| 144 | 120 | *mult = \&PDL::mult; | |||||||||||||
| 145 | |||||||||||||||
| 146 | |||||||||||||||
| 147 | |||||||||||||||
| 148 | |||||||||||||||
| 149 | |||||||||||||||
| 150 | =head2 minus | ||||||||||||||
| 151 | |||||||||||||||
| 152 | =for sig | ||||||||||||||
| 153 | |||||||||||||||
| 154 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 155 | |||||||||||||||
| 156 | =for ref | ||||||||||||||
| 157 | |||||||||||||||
| 158 | subtract two piddles | ||||||||||||||
| 159 | |||||||||||||||
| 160 | =for example | ||||||||||||||
| 161 | |||||||||||||||
| 162 | $c = minus $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 163 | $c = $a - $b; # overloaded call | ||||||||||||||
| 164 | $a->inplace->minus($b,0); # modify $a inplace | ||||||||||||||
| 165 | |||||||||||||||
| 166 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 167 | This function is used to overload the binary C<-> operator. | ||||||||||||||
| 168 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 169 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 170 | This restriction is expected to go away in future releases. | ||||||||||||||
| 171 | |||||||||||||||
| 172 | |||||||||||||||
| 173 | |||||||||||||||
| 174 | =for bad | ||||||||||||||
| 175 | |||||||||||||||
| 176 | minus processes bad values. | ||||||||||||||
| 177 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 178 | |||||||||||||||
| 179 | |||||||||||||||
| 180 | =cut | ||||||||||||||
| 181 | |||||||||||||||
| 182 | |||||||||||||||
| 183 | |||||||||||||||
| 184 | |||||||||||||||
| 185 | |||||||||||||||
| 186 | |||||||||||||||
| 187 | 120 | *minus = \&PDL::minus; | |||||||||||||
| 188 | |||||||||||||||
| 189 | |||||||||||||||
| 190 | |||||||||||||||
| 191 | |||||||||||||||
| 192 | |||||||||||||||
| 193 | =head2 divide | ||||||||||||||
| 194 | |||||||||||||||
| 195 | =for sig | ||||||||||||||
| 196 | |||||||||||||||
| 197 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 198 | |||||||||||||||
| 199 | =for ref | ||||||||||||||
| 200 | |||||||||||||||
| 201 | divide two piddles | ||||||||||||||
| 202 | |||||||||||||||
| 203 | =for example | ||||||||||||||
| 204 | |||||||||||||||
| 205 | $c = divide $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 206 | $c = $a / $b; # overloaded call | ||||||||||||||
| 207 | $a->inplace->divide($b,0); # modify $a inplace | ||||||||||||||
| 208 | |||||||||||||||
| 209 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 210 | This function is used to overload the binary C</> operator. | ||||||||||||||
| 211 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 212 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 213 | This restriction is expected to go away in future releases. | ||||||||||||||
| 214 | |||||||||||||||
| 215 | |||||||||||||||
| 216 | |||||||||||||||
| 217 | =for bad | ||||||||||||||
| 218 | |||||||||||||||
| 219 | divide processes bad values. | ||||||||||||||
| 220 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 221 | |||||||||||||||
| 222 | |||||||||||||||
| 223 | =cut | ||||||||||||||
| 224 | |||||||||||||||
| 225 | |||||||||||||||
| 226 | |||||||||||||||
| 227 | |||||||||||||||
| 228 | |||||||||||||||
| 229 | |||||||||||||||
| 230 | 120 | *divide = \&PDL::divide; | |||||||||||||
| 231 | |||||||||||||||
| 232 | |||||||||||||||
| 233 | |||||||||||||||
| 234 | |||||||||||||||
| 235 | |||||||||||||||
| 236 | =head2 gt | ||||||||||||||
| 237 | |||||||||||||||
| 238 | =for sig | ||||||||||||||
| 239 | |||||||||||||||
| 240 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 241 | |||||||||||||||
| 242 | =for ref | ||||||||||||||
| 243 | |||||||||||||||
| 244 | the binary E<gt> (greater than) operation | ||||||||||||||
| 245 | |||||||||||||||
| 246 | =for example | ||||||||||||||
| 247 | |||||||||||||||
| 248 | $c = gt $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 249 | $c = $a > $b; # overloaded call | ||||||||||||||
| 250 | $a->inplace->gt($b,0); # modify $a inplace | ||||||||||||||
| 251 | |||||||||||||||
| 252 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 253 | This function is used to overload the binary C<E<gt>> operator. | ||||||||||||||
| 254 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 255 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 256 | This restriction is expected to go away in future releases. | ||||||||||||||
| 257 | |||||||||||||||
| 258 | |||||||||||||||
| 259 | |||||||||||||||
| 260 | =for bad | ||||||||||||||
| 261 | |||||||||||||||
| 262 | gt processes bad values. | ||||||||||||||
| 263 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 264 | |||||||||||||||
| 265 | |||||||||||||||
| 266 | =cut | ||||||||||||||
| 267 | |||||||||||||||
| 268 | |||||||||||||||
| 269 | |||||||||||||||
| 270 | |||||||||||||||
| 271 | |||||||||||||||
| 272 | |||||||||||||||
| 273 | 120 | *gt = \&PDL::gt; | |||||||||||||
| 274 | |||||||||||||||
| 275 | |||||||||||||||
| 276 | |||||||||||||||
| 277 | |||||||||||||||
| 278 | |||||||||||||||
| 279 | =head2 lt | ||||||||||||||
| 280 | |||||||||||||||
| 281 | =for sig | ||||||||||||||
| 282 | |||||||||||||||
| 283 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 284 | |||||||||||||||
| 285 | =for ref | ||||||||||||||
| 286 | |||||||||||||||
| 287 | the binary E<lt> (less than) operation | ||||||||||||||
| 288 | |||||||||||||||
| 289 | =for example | ||||||||||||||
| 290 | |||||||||||||||
| 291 | $c = lt $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 292 | $c = $a < $b; # overloaded call | ||||||||||||||
| 293 | $a->inplace->lt($b,0); # modify $a inplace | ||||||||||||||
| 294 | |||||||||||||||
| 295 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 296 | This function is used to overload the binary C<E<lt>> operator. | ||||||||||||||
| 297 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 298 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 299 | This restriction is expected to go away in future releases. | ||||||||||||||
| 300 | |||||||||||||||
| 301 | |||||||||||||||
| 302 | |||||||||||||||
| 303 | =for bad | ||||||||||||||
| 304 | |||||||||||||||
| 305 | lt processes bad values. | ||||||||||||||
| 306 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 307 | |||||||||||||||
| 308 | |||||||||||||||
| 309 | =cut | ||||||||||||||
| 310 | |||||||||||||||
| 311 | |||||||||||||||
| 312 | |||||||||||||||
| 313 | |||||||||||||||
| 314 | |||||||||||||||
| 315 | |||||||||||||||
| 316 | 120 | *lt = \&PDL::lt; | |||||||||||||
| 317 | |||||||||||||||
| 318 | |||||||||||||||
| 319 | |||||||||||||||
| 320 | |||||||||||||||
| 321 | |||||||||||||||
| 322 | =head2 le | ||||||||||||||
| 323 | |||||||||||||||
| 324 | =for sig | ||||||||||||||
| 325 | |||||||||||||||
| 326 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 327 | |||||||||||||||
| 328 | =for ref | ||||||||||||||
| 329 | |||||||||||||||
| 330 | the binary E<lt>= (less equal) operation | ||||||||||||||
| 331 | |||||||||||||||
| 332 | =for example | ||||||||||||||
| 333 | |||||||||||||||
| 334 | $c = le $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 335 | $c = $a <= $b; # overloaded call | ||||||||||||||
| 336 | $a->inplace->le($b,0); # modify $a inplace | ||||||||||||||
| 337 | |||||||||||||||
| 338 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 339 | This function is used to overload the binary C<E<lt>=> operator. | ||||||||||||||
| 340 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 341 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 342 | This restriction is expected to go away in future releases. | ||||||||||||||
| 343 | |||||||||||||||
| 344 | |||||||||||||||
| 345 | |||||||||||||||
| 346 | =for bad | ||||||||||||||
| 347 | |||||||||||||||
| 348 | le processes bad values. | ||||||||||||||
| 349 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 350 | |||||||||||||||
| 351 | |||||||||||||||
| 352 | =cut | ||||||||||||||
| 353 | |||||||||||||||
| 354 | |||||||||||||||
| 355 | |||||||||||||||
| 356 | |||||||||||||||
| 357 | |||||||||||||||
| 358 | |||||||||||||||
| 359 | 120 | *le = \&PDL::le; | |||||||||||||
| 360 | |||||||||||||||
| 361 | |||||||||||||||
| 362 | |||||||||||||||
| 363 | |||||||||||||||
| 364 | |||||||||||||||
| 365 | =head2 ge | ||||||||||||||
| 366 | |||||||||||||||
| 367 | =for sig | ||||||||||||||
| 368 | |||||||||||||||
| 369 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 370 | |||||||||||||||
| 371 | =for ref | ||||||||||||||
| 372 | |||||||||||||||
| 373 | the binary E<gt>= (greater equal) operation | ||||||||||||||
| 374 | |||||||||||||||
| 375 | =for example | ||||||||||||||
| 376 | |||||||||||||||
| 377 | $c = ge $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 378 | $c = $a >= $b; # overloaded call | ||||||||||||||
| 379 | $a->inplace->ge($b,0); # modify $a inplace | ||||||||||||||
| 380 | |||||||||||||||
| 381 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 382 | This function is used to overload the binary C<E<gt>=> operator. | ||||||||||||||
| 383 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 384 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 385 | This restriction is expected to go away in future releases. | ||||||||||||||
| 386 | |||||||||||||||
| 387 | |||||||||||||||
| 388 | |||||||||||||||
| 389 | =for bad | ||||||||||||||
| 390 | |||||||||||||||
| 391 | ge processes bad values. | ||||||||||||||
| 392 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 393 | |||||||||||||||
| 394 | |||||||||||||||
| 395 | =cut | ||||||||||||||
| 396 | |||||||||||||||
| 397 | |||||||||||||||
| 398 | |||||||||||||||
| 399 | |||||||||||||||
| 400 | |||||||||||||||
| 401 | |||||||||||||||
| 402 | 120 | *ge = \&PDL::ge; | |||||||||||||
| 403 | |||||||||||||||
| 404 | |||||||||||||||
| 405 | |||||||||||||||
| 406 | |||||||||||||||
| 407 | |||||||||||||||
| 408 | =head2 eq | ||||||||||||||
| 409 | |||||||||||||||
| 410 | =for sig | ||||||||||||||
| 411 | |||||||||||||||
| 412 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 413 | |||||||||||||||
| 414 | =for ref | ||||||||||||||
| 415 | |||||||||||||||
| 416 | binary I<equal to> operation (C<==>) | ||||||||||||||
| 417 | |||||||||||||||
| 418 | =for example | ||||||||||||||
| 419 | |||||||||||||||
| 420 | $c = eq $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 421 | $c = $a == $b; # overloaded call | ||||||||||||||
| 422 | $a->inplace->eq($b,0); # modify $a inplace | ||||||||||||||
| 423 | |||||||||||||||
| 424 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 425 | This function is used to overload the binary C<==> operator. | ||||||||||||||
| 426 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 427 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 428 | This restriction is expected to go away in future releases. | ||||||||||||||
| 429 | |||||||||||||||
| 430 | |||||||||||||||
| 431 | |||||||||||||||
| 432 | =for bad | ||||||||||||||
| 433 | |||||||||||||||
| 434 | eq processes bad values. | ||||||||||||||
| 435 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 436 | |||||||||||||||
| 437 | |||||||||||||||
| 438 | =cut | ||||||||||||||
| 439 | |||||||||||||||
| 440 | |||||||||||||||
| 441 | |||||||||||||||
| 442 | |||||||||||||||
| 443 | |||||||||||||||
| 444 | |||||||||||||||
| 445 | 120 | *eq = \&PDL::eq; | |||||||||||||
| 446 | |||||||||||||||
| 447 | |||||||||||||||
| 448 | |||||||||||||||
| 449 | |||||||||||||||
| 450 | |||||||||||||||
| 451 | =head2 ne | ||||||||||||||
| 452 | |||||||||||||||
| 453 | =for sig | ||||||||||||||
| 454 | |||||||||||||||
| 455 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 456 | |||||||||||||||
| 457 | =for ref | ||||||||||||||
| 458 | |||||||||||||||
| 459 | binary I<not equal to> operation (C<!=>) | ||||||||||||||
| 460 | |||||||||||||||
| 461 | =for example | ||||||||||||||
| 462 | |||||||||||||||
| 463 | $c = ne $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 464 | $c = $a != $b; # overloaded call | ||||||||||||||
| 465 | $a->inplace->ne($b,0); # modify $a inplace | ||||||||||||||
| 466 | |||||||||||||||
| 467 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 468 | This function is used to overload the binary C<!=> operator. | ||||||||||||||
| 469 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 470 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 471 | This restriction is expected to go away in future releases. | ||||||||||||||
| 472 | |||||||||||||||
| 473 | |||||||||||||||
| 474 | |||||||||||||||
| 475 | =for bad | ||||||||||||||
| 476 | |||||||||||||||
| 477 | ne processes bad values. | ||||||||||||||
| 478 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 479 | |||||||||||||||
| 480 | |||||||||||||||
| 481 | =cut | ||||||||||||||
| 482 | |||||||||||||||
| 483 | |||||||||||||||
| 484 | |||||||||||||||
| 485 | |||||||||||||||
| 486 | |||||||||||||||
| 487 | |||||||||||||||
| 488 | 120 | *ne = \&PDL::ne; | |||||||||||||
| 489 | |||||||||||||||
| 490 | |||||||||||||||
| 491 | |||||||||||||||
| 492 | |||||||||||||||
| 493 | |||||||||||||||
| 494 | =head2 shiftleft | ||||||||||||||
| 495 | |||||||||||||||
| 496 | =for sig | ||||||||||||||
| 497 | |||||||||||||||
| 498 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 499 | |||||||||||||||
| 500 | =for ref | ||||||||||||||
| 501 | |||||||||||||||
| 502 | leftshift C<$a> by C<$b> | ||||||||||||||
| 503 | |||||||||||||||
| 504 | =for example | ||||||||||||||
| 505 | |||||||||||||||
| 506 | $c = shiftleft $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 507 | $c = $a << $b; # overloaded call | ||||||||||||||
| 508 | $a->inplace->shiftleft($b,0); # modify $a inplace | ||||||||||||||
| 509 | |||||||||||||||
| 510 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 511 | This function is used to overload the binary C<E<lt>E<lt>> operator. | ||||||||||||||
| 512 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 513 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 514 | This restriction is expected to go away in future releases. | ||||||||||||||
| 515 | |||||||||||||||
| 516 | |||||||||||||||
| 517 | |||||||||||||||
| 518 | =for bad | ||||||||||||||
| 519 | |||||||||||||||
| 520 | shiftleft processes bad values. | ||||||||||||||
| 521 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 522 | |||||||||||||||
| 523 | |||||||||||||||
| 524 | =cut | ||||||||||||||
| 525 | |||||||||||||||
| 526 | |||||||||||||||
| 527 | |||||||||||||||
| 528 | |||||||||||||||
| 529 | |||||||||||||||
| 530 | |||||||||||||||
| 531 | 120 | *shiftleft = \&PDL::shiftleft; | |||||||||||||
| 532 | |||||||||||||||
| 533 | |||||||||||||||
| 534 | |||||||||||||||
| 535 | |||||||||||||||
| 536 | |||||||||||||||
| 537 | =head2 shiftright | ||||||||||||||
| 538 | |||||||||||||||
| 539 | =for sig | ||||||||||||||
| 540 | |||||||||||||||
| 541 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 542 | |||||||||||||||
| 543 | =for ref | ||||||||||||||
| 544 | |||||||||||||||
| 545 | rightshift C<$a> by C<$b> | ||||||||||||||
| 546 | |||||||||||||||
| 547 | =for example | ||||||||||||||
| 548 | |||||||||||||||
| 549 | $c = shiftright $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 550 | $c = $a >> $b; # overloaded call | ||||||||||||||
| 551 | $a->inplace->shiftright($b,0); # modify $a inplace | ||||||||||||||
| 552 | |||||||||||||||
| 553 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 554 | This function is used to overload the binary C<E<gt>E<gt>> operator. | ||||||||||||||
| 555 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 556 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 557 | This restriction is expected to go away in future releases. | ||||||||||||||
| 558 | |||||||||||||||
| 559 | |||||||||||||||
| 560 | |||||||||||||||
| 561 | =for bad | ||||||||||||||
| 562 | |||||||||||||||
| 563 | shiftright processes bad values. | ||||||||||||||
| 564 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 565 | |||||||||||||||
| 566 | |||||||||||||||
| 567 | =cut | ||||||||||||||
| 568 | |||||||||||||||
| 569 | |||||||||||||||
| 570 | |||||||||||||||
| 571 | |||||||||||||||
| 572 | |||||||||||||||
| 573 | |||||||||||||||
| 574 | 120 | *shiftright = \&PDL::shiftright; | |||||||||||||
| 575 | |||||||||||||||
| 576 | |||||||||||||||
| 577 | |||||||||||||||
| 578 | |||||||||||||||
| 579 | |||||||||||||||
| 580 | =head2 or2 | ||||||||||||||
| 581 | |||||||||||||||
| 582 | =for sig | ||||||||||||||
| 583 | |||||||||||||||
| 584 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 585 | |||||||||||||||
| 586 | =for ref | ||||||||||||||
| 587 | |||||||||||||||
| 588 | binary I<or> of two piddles | ||||||||||||||
| 589 | |||||||||||||||
| 590 | =for example | ||||||||||||||
| 591 | |||||||||||||||
| 592 | $c = or2 $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 593 | $c = $a | $b; # overloaded call | ||||||||||||||
| 594 | $a->inplace->or2($b,0); # modify $a inplace | ||||||||||||||
| 595 | |||||||||||||||
| 596 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 597 | This function is used to overload the binary C<|> operator. | ||||||||||||||
| 598 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 599 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 600 | This restriction is expected to go away in future releases. | ||||||||||||||
| 601 | |||||||||||||||
| 602 | |||||||||||||||
| 603 | |||||||||||||||
| 604 | =for bad | ||||||||||||||
| 605 | |||||||||||||||
| 606 | or2 processes bad values. | ||||||||||||||
| 607 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 608 | |||||||||||||||
| 609 | |||||||||||||||
| 610 | =cut | ||||||||||||||
| 611 | |||||||||||||||
| 612 | |||||||||||||||
| 613 | |||||||||||||||
| 614 | |||||||||||||||
| 615 | |||||||||||||||
| 616 | |||||||||||||||
| 617 | 120 | *or2 = \&PDL::or2; | |||||||||||||
| 618 | |||||||||||||||
| 619 | |||||||||||||||
| 620 | |||||||||||||||
| 621 | |||||||||||||||
| 622 | |||||||||||||||
| 623 | =head2 and2 | ||||||||||||||
| 624 | |||||||||||||||
| 625 | =for sig | ||||||||||||||
| 626 | |||||||||||||||
| 627 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 628 | |||||||||||||||
| 629 | =for ref | ||||||||||||||
| 630 | |||||||||||||||
| 631 | binary I<and> of two piddles | ||||||||||||||
| 632 | |||||||||||||||
| 633 | =for example | ||||||||||||||
| 634 | |||||||||||||||
| 635 | $c = and2 $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 636 | $c = $a & $b; # overloaded call | ||||||||||||||
| 637 | $a->inplace->and2($b,0); # modify $a inplace | ||||||||||||||
| 638 | |||||||||||||||
| 639 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 640 | This function is used to overload the binary C<&> operator. | ||||||||||||||
| 641 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 642 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 643 | This restriction is expected to go away in future releases. | ||||||||||||||
| 644 | |||||||||||||||
| 645 | |||||||||||||||
| 646 | |||||||||||||||
| 647 | =for bad | ||||||||||||||
| 648 | |||||||||||||||
| 649 | and2 processes bad values. | ||||||||||||||
| 650 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 651 | |||||||||||||||
| 652 | |||||||||||||||
| 653 | =cut | ||||||||||||||
| 654 | |||||||||||||||
| 655 | |||||||||||||||
| 656 | |||||||||||||||
| 657 | |||||||||||||||
| 658 | |||||||||||||||
| 659 | |||||||||||||||
| 660 | 120 | *and2 = \&PDL::and2; | |||||||||||||
| 661 | |||||||||||||||
| 662 | |||||||||||||||
| 663 | |||||||||||||||
| 664 | |||||||||||||||
| 665 | |||||||||||||||
| 666 | =head2 xor | ||||||||||||||
| 667 | |||||||||||||||
| 668 | =for sig | ||||||||||||||
| 669 | |||||||||||||||
| 670 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 671 | |||||||||||||||
| 672 | =for ref | ||||||||||||||
| 673 | |||||||||||||||
| 674 | binary I<exclusive or> of two piddles | ||||||||||||||
| 675 | |||||||||||||||
| 676 | =for example | ||||||||||||||
| 677 | |||||||||||||||
| 678 | $c = xor $a, $b, 0; # explicit call with trailing 0 | ||||||||||||||
| 679 | $c = $a ^ $b; # overloaded call | ||||||||||||||
| 680 | $a->inplace->xor($b,0); # modify $a inplace | ||||||||||||||
| 681 | |||||||||||||||
| 682 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 683 | This function is used to overload the binary C<^> operator. | ||||||||||||||
| 684 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 685 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 686 | This restriction is expected to go away in future releases. | ||||||||||||||
| 687 | |||||||||||||||
| 688 | |||||||||||||||
| 689 | |||||||||||||||
| 690 | =for bad | ||||||||||||||
| 691 | |||||||||||||||
| 692 | xor processes bad values. | ||||||||||||||
| 693 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 694 | |||||||||||||||
| 695 | |||||||||||||||
| 696 | =cut | ||||||||||||||
| 697 | |||||||||||||||
| 698 | |||||||||||||||
| 699 | |||||||||||||||
| 700 | |||||||||||||||
| 701 | |||||||||||||||
| 702 | |||||||||||||||
| 703 | 120 | *xor = \&PDL::xor; | |||||||||||||
| 704 | |||||||||||||||
| 705 | |||||||||||||||
| 706 | |||||||||||||||
| 707 | |||||||||||||||
| 708 | |||||||||||||||
| 709 | =head2 bitnot | ||||||||||||||
| 710 | |||||||||||||||
| 711 | =for sig | ||||||||||||||
| 712 | |||||||||||||||
| 713 | Signature: (a(); [o]b()) | ||||||||||||||
| 714 | |||||||||||||||
| 715 | =for ref | ||||||||||||||
| 716 | |||||||||||||||
| 717 | unary bit negation | ||||||||||||||
| 718 | |||||||||||||||
| 719 | =for example | ||||||||||||||
| 720 | |||||||||||||||
| 721 | $b = ~ $a; | ||||||||||||||
| 722 | $a->inplace->bitnot; # modify $a inplace | ||||||||||||||
| 723 | |||||||||||||||
| 724 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 725 | This function is used to overload the unary C<~> operator/function. | ||||||||||||||
| 726 | |||||||||||||||
| 727 | |||||||||||||||
| 728 | |||||||||||||||
| 729 | =for bad | ||||||||||||||
| 730 | |||||||||||||||
| 731 | bitnot processes bad values. | ||||||||||||||
| 732 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 733 | |||||||||||||||
| 734 | |||||||||||||||
| 735 | =cut | ||||||||||||||
| 736 | |||||||||||||||
| 737 | |||||||||||||||
| 738 | |||||||||||||||
| 739 | |||||||||||||||
| 740 | |||||||||||||||
| 741 | |||||||||||||||
| 742 | 120 | *bitnot = \&PDL::bitnot; | |||||||||||||
| 743 | |||||||||||||||
| 744 | |||||||||||||||
| 745 | |||||||||||||||
| 746 | |||||||||||||||
| 747 | |||||||||||||||
| 748 | =head2 power | ||||||||||||||
| 749 | |||||||||||||||
| 750 | =for sig | ||||||||||||||
| 751 | |||||||||||||||
| 752 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 753 | |||||||||||||||
| 754 | =for ref | ||||||||||||||
| 755 | |||||||||||||||
| 756 | raise piddle C<$a> to the power C<$b> | ||||||||||||||
| 757 | |||||||||||||||
| 758 | =for example | ||||||||||||||
| 759 | |||||||||||||||
| 760 | $c = $a->power($b,0); # explicit function call | ||||||||||||||
| 761 | $c = $a ** $b; # overloaded use | ||||||||||||||
| 762 | $a->inplace->power($b,0); # modify $a inplace | ||||||||||||||
| 763 | |||||||||||||||
| 764 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 765 | This function is used to overload the binary C<**> function. | ||||||||||||||
| 766 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 767 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 768 | This restriction is expected to go away in future releases. | ||||||||||||||
| 769 | |||||||||||||||
| 770 | |||||||||||||||
| 771 | |||||||||||||||
| 772 | =for bad | ||||||||||||||
| 773 | |||||||||||||||
| 774 | power processes bad values. | ||||||||||||||
| 775 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 776 | |||||||||||||||
| 777 | |||||||||||||||
| 778 | =cut | ||||||||||||||
| 779 | |||||||||||||||
| 780 | |||||||||||||||
| 781 | |||||||||||||||
| 782 | |||||||||||||||
| 783 | |||||||||||||||
| 784 | |||||||||||||||
| 785 | 120 | *power = \&PDL::power; | |||||||||||||
| 786 | |||||||||||||||
| 787 | |||||||||||||||
| 788 | |||||||||||||||
| 789 | |||||||||||||||
| 790 | |||||||||||||||
| 791 | =head2 atan2 | ||||||||||||||
| 792 | |||||||||||||||
| 793 | =for sig | ||||||||||||||
| 794 | |||||||||||||||
| 795 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 796 | |||||||||||||||
| 797 | =for ref | ||||||||||||||
| 798 | |||||||||||||||
| 799 | elementwise C<atan2> of two piddles | ||||||||||||||
| 800 | |||||||||||||||
| 801 | =for example | ||||||||||||||
| 802 | |||||||||||||||
| 803 | $c = $a->atan2($b,0); # explicit function call | ||||||||||||||
| 804 | $c = atan2 $a, $b; # overloaded use | ||||||||||||||
| 805 | $a->inplace->atan2($b,0); # modify $a inplace | ||||||||||||||
| 806 | |||||||||||||||
| 807 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 808 | This function is used to overload the binary C<atan2> function. | ||||||||||||||
| 809 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 810 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 811 | This restriction is expected to go away in future releases. | ||||||||||||||
| 812 | |||||||||||||||
| 813 | |||||||||||||||
| 814 | |||||||||||||||
| 815 | =for bad | ||||||||||||||
| 816 | |||||||||||||||
| 817 | atan2 processes bad values. | ||||||||||||||
| 818 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 819 | |||||||||||||||
| 820 | |||||||||||||||
| 821 | =cut | ||||||||||||||
| 822 | |||||||||||||||
| 823 | |||||||||||||||
| 824 | |||||||||||||||
| 825 | |||||||||||||||
| 826 | |||||||||||||||
| 827 | |||||||||||||||
| 828 | 120 | *atan2 = \&PDL::atan2; | |||||||||||||
| 829 | |||||||||||||||
| 830 | |||||||||||||||
| 831 | |||||||||||||||
| 832 | |||||||||||||||
| 833 | |||||||||||||||
| 834 | =head2 modulo | ||||||||||||||
| 835 | |||||||||||||||
| 836 | =for sig | ||||||||||||||
| 837 | |||||||||||||||
| 838 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 839 | |||||||||||||||
| 840 | =for ref | ||||||||||||||
| 841 | |||||||||||||||
| 842 | elementwise C<modulo> operation | ||||||||||||||
| 843 | |||||||||||||||
| 844 | =for example | ||||||||||||||
| 845 | |||||||||||||||
| 846 | $c = $a->modulo($b,0); # explicit function call | ||||||||||||||
| 847 | $c = $a % $b; # overloaded use | ||||||||||||||
| 848 | $a->inplace->modulo($b,0); # modify $a inplace | ||||||||||||||
| 849 | |||||||||||||||
| 850 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 851 | This function is used to overload the binary C<%> function. | ||||||||||||||
| 852 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 853 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 854 | This restriction is expected to go away in future releases. | ||||||||||||||
| 855 | |||||||||||||||
| 856 | |||||||||||||||
| 857 | |||||||||||||||
| 858 | =for bad | ||||||||||||||
| 859 | |||||||||||||||
| 860 | modulo processes bad values. | ||||||||||||||
| 861 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 862 | |||||||||||||||
| 863 | |||||||||||||||
| 864 | =cut | ||||||||||||||
| 865 | |||||||||||||||
| 866 | |||||||||||||||
| 867 | |||||||||||||||
| 868 | |||||||||||||||
| 869 | |||||||||||||||
| 870 | |||||||||||||||
| 871 | 120 | *modulo = \&PDL::modulo; | |||||||||||||
| 872 | |||||||||||||||
| 873 | |||||||||||||||
| 874 | |||||||||||||||
| 875 | |||||||||||||||
| 876 | |||||||||||||||
| 877 | =head2 spaceship | ||||||||||||||
| 878 | |||||||||||||||
| 879 | =for sig | ||||||||||||||
| 880 | |||||||||||||||
| 881 | Signature: (a(); b(); [o]c(); int swap) | ||||||||||||||
| 882 | |||||||||||||||
| 883 | =for ref | ||||||||||||||
| 884 | |||||||||||||||
| 885 | elementwise "<=>" operation | ||||||||||||||
| 886 | |||||||||||||||
| 887 | =for example | ||||||||||||||
| 888 | |||||||||||||||
| 889 | $c = $a->spaceship($b,0); # explicit function call | ||||||||||||||
| 890 | $c = $a <=> $b; # overloaded use | ||||||||||||||
| 891 | $a->inplace->spaceship($b,0); # modify $a inplace | ||||||||||||||
| 892 | |||||||||||||||
| 893 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 894 | This function is used to overload the binary C<E<lt>=E<gt>> function. | ||||||||||||||
| 895 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 896 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 897 | This restriction is expected to go away in future releases. | ||||||||||||||
| 898 | |||||||||||||||
| 899 | |||||||||||||||
| 900 | |||||||||||||||
| 901 | =for bad | ||||||||||||||
| 902 | |||||||||||||||
| 903 | spaceship processes bad values. | ||||||||||||||
| 904 | The state of the bad-value flag of the output piddles is unknown. | ||||||||||||||
| 905 | |||||||||||||||
| 906 | |||||||||||||||
| 907 | =cut | ||||||||||||||
| 908 | |||||||||||||||
| 909 | |||||||||||||||
| 910 | |||||||||||||||
| 911 | |||||||||||||||
| 912 | |||||||||||||||
| 913 | |||||||||||||||
| 914 | 120 | *spaceship = \&PDL::spaceship; | |||||||||||||
| 915 | |||||||||||||||
| 916 | |||||||||||||||
| 917 | |||||||||||||||
| 918 | |||||||||||||||
| 919 | |||||||||||||||
| 920 | =head2 sqrt | ||||||||||||||
| 921 | |||||||||||||||
| 922 | =for sig | ||||||||||||||
| 923 | |||||||||||||||
| 924 | Signature: (a(); [o]b()) | ||||||||||||||
| 925 | |||||||||||||||
| 926 | =for ref | ||||||||||||||
| 927 | |||||||||||||||
| 928 | elementwise square root | ||||||||||||||
| 929 | |||||||||||||||
| 930 | =for example | ||||||||||||||
| 931 | |||||||||||||||
| 932 | $b = sqrt $a; | ||||||||||||||
| 933 | $a->inplace->sqrt; # modify $a inplace | ||||||||||||||
| 934 | |||||||||||||||
| 935 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 936 | This function is used to overload the unary C<sqrt> operator/function. | ||||||||||||||
| 937 | |||||||||||||||
| 938 | |||||||||||||||
| 939 | |||||||||||||||
| 940 | =for bad | ||||||||||||||
| 941 | |||||||||||||||
| 942 | sqrt processes bad values. | ||||||||||||||
| 943 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 944 | |||||||||||||||
| 945 | |||||||||||||||
| 946 | =cut | ||||||||||||||
| 947 | |||||||||||||||
| 948 | |||||||||||||||
| 949 | |||||||||||||||
| 950 | |||||||||||||||
| 951 | |||||||||||||||
| 952 | |||||||||||||||
| 953 | 120 | *sqrt = \&PDL::sqrt; | |||||||||||||
| 954 | |||||||||||||||
| 955 | |||||||||||||||
| 956 | |||||||||||||||
| 957 | |||||||||||||||
| 958 | |||||||||||||||
| 959 | =head2 abs | ||||||||||||||
| 960 | |||||||||||||||
| 961 | =for sig | ||||||||||||||
| 962 | |||||||||||||||
| 963 | Signature: (a(); [o]b()) | ||||||||||||||
| 964 | |||||||||||||||
| 965 | =for ref | ||||||||||||||
| 966 | |||||||||||||||
| 967 | elementwise absolute value | ||||||||||||||
| 968 | |||||||||||||||
| 969 | =for example | ||||||||||||||
| 970 | |||||||||||||||
| 971 | $b = abs $a; | ||||||||||||||
| 972 | $a->inplace->abs; # modify $a inplace | ||||||||||||||
| 973 | |||||||||||||||
| 974 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 975 | This function is used to overload the unary C<abs> operator/function. | ||||||||||||||
| 976 | |||||||||||||||
| 977 | |||||||||||||||
| 978 | |||||||||||||||
| 979 | =for bad | ||||||||||||||
| 980 | |||||||||||||||
| 981 | abs processes bad values. | ||||||||||||||
| 982 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 983 | |||||||||||||||
| 984 | |||||||||||||||
| 985 | =cut | ||||||||||||||
| 986 | |||||||||||||||
| 987 | |||||||||||||||
| 988 | |||||||||||||||
| 989 | |||||||||||||||
| 990 | |||||||||||||||
| 991 | |||||||||||||||
| 992 | 120 | *abs = \&PDL::abs; | |||||||||||||
| 993 | |||||||||||||||
| 994 | |||||||||||||||
| 995 | |||||||||||||||
| 996 | |||||||||||||||
| 997 | |||||||||||||||
| 998 | =head2 sin | ||||||||||||||
| 999 | |||||||||||||||
| 1000 | =for sig | ||||||||||||||
| 1001 | |||||||||||||||
| 1002 | Signature: (a(); [o]b()) | ||||||||||||||
| 1003 | |||||||||||||||
| 1004 | =for ref | ||||||||||||||
| 1005 | |||||||||||||||
| 1006 | the sin function | ||||||||||||||
| 1007 | |||||||||||||||
| 1008 | =for example | ||||||||||||||
| 1009 | |||||||||||||||
| 1010 | $b = sin $a; | ||||||||||||||
| 1011 | $a->inplace->sin; # modify $a inplace | ||||||||||||||
| 1012 | |||||||||||||||
| 1013 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 1014 | This function is used to overload the unary C<sin> operator/function. | ||||||||||||||
| 1015 | |||||||||||||||
| 1016 | |||||||||||||||
| 1017 | |||||||||||||||
| 1018 | =for bad | ||||||||||||||
| 1019 | |||||||||||||||
| 1020 | sin processes bad values. | ||||||||||||||
| 1021 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 1022 | |||||||||||||||
| 1023 | |||||||||||||||
| 1024 | =cut | ||||||||||||||
| 1025 | |||||||||||||||
| 1026 | |||||||||||||||
| 1027 | |||||||||||||||
| 1028 | |||||||||||||||
| 1029 | |||||||||||||||
| 1030 | |||||||||||||||
| 1031 | 120 | *sin = \&PDL::sin; | |||||||||||||
| 1032 | |||||||||||||||
| 1033 | |||||||||||||||
| 1034 | |||||||||||||||
| 1035 | |||||||||||||||
| 1036 | |||||||||||||||
| 1037 | =head2 cos | ||||||||||||||
| 1038 | |||||||||||||||
| 1039 | =for sig | ||||||||||||||
| 1040 | |||||||||||||||
| 1041 | Signature: (a(); [o]b()) | ||||||||||||||
| 1042 | |||||||||||||||
| 1043 | =for ref | ||||||||||||||
| 1044 | |||||||||||||||
| 1045 | the cos function | ||||||||||||||
| 1046 | |||||||||||||||
| 1047 | =for example | ||||||||||||||
| 1048 | |||||||||||||||
| 1049 | $b = cos $a; | ||||||||||||||
| 1050 | $a->inplace->cos; # modify $a inplace | ||||||||||||||
| 1051 | |||||||||||||||
| 1052 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 1053 | This function is used to overload the unary C<cos> operator/function. | ||||||||||||||
| 1054 | |||||||||||||||
| 1055 | |||||||||||||||
| 1056 | |||||||||||||||
| 1057 | =for bad | ||||||||||||||
| 1058 | |||||||||||||||
| 1059 | cos processes bad values. | ||||||||||||||
| 1060 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 1061 | |||||||||||||||
| 1062 | |||||||||||||||
| 1063 | =cut | ||||||||||||||
| 1064 | |||||||||||||||
| 1065 | |||||||||||||||
| 1066 | |||||||||||||||
| 1067 | |||||||||||||||
| 1068 | |||||||||||||||
| 1069 | |||||||||||||||
| 1070 | 120 | *cos = \&PDL::cos; | |||||||||||||
| 1071 | |||||||||||||||
| 1072 | |||||||||||||||
| 1073 | |||||||||||||||
| 1074 | |||||||||||||||
| 1075 | |||||||||||||||
| 1076 | =head2 not | ||||||||||||||
| 1077 | |||||||||||||||
| 1078 | =for sig | ||||||||||||||
| 1079 | |||||||||||||||
| 1080 | Signature: (a(); [o]b()) | ||||||||||||||
| 1081 | |||||||||||||||
| 1082 | =for ref | ||||||||||||||
| 1083 | |||||||||||||||
| 1084 | the elementwise I<not> operation | ||||||||||||||
| 1085 | |||||||||||||||
| 1086 | =for example | ||||||||||||||
| 1087 | |||||||||||||||
| 1088 | $b = ! $a; | ||||||||||||||
| 1089 | $a->inplace->not; # modify $a inplace | ||||||||||||||
| 1090 | |||||||||||||||
| 1091 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 1092 | This function is used to overload the unary C<!> operator/function. | ||||||||||||||
| 1093 | |||||||||||||||
| 1094 | |||||||||||||||
| 1095 | |||||||||||||||
| 1096 | =for bad | ||||||||||||||
| 1097 | |||||||||||||||
| 1098 | not processes bad values. | ||||||||||||||
| 1099 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 1100 | |||||||||||||||
| 1101 | |||||||||||||||
| 1102 | =cut | ||||||||||||||
| 1103 | |||||||||||||||
| 1104 | |||||||||||||||
| 1105 | |||||||||||||||
| 1106 | |||||||||||||||
| 1107 | |||||||||||||||
| 1108 | |||||||||||||||
| 1109 | 120 | *not = \&PDL::not; | |||||||||||||
| 1110 | |||||||||||||||
| 1111 | |||||||||||||||
| 1112 | |||||||||||||||
| 1113 | |||||||||||||||
| 1114 | |||||||||||||||
| 1115 | =head2 exp | ||||||||||||||
| 1116 | |||||||||||||||
| 1117 | =for sig | ||||||||||||||
| 1118 | |||||||||||||||
| 1119 | Signature: (a(); [o]b()) | ||||||||||||||
| 1120 | |||||||||||||||
| 1121 | =for ref | ||||||||||||||
| 1122 | |||||||||||||||
| 1123 | the exponential function | ||||||||||||||
| 1124 | |||||||||||||||
| 1125 | =for example | ||||||||||||||
| 1126 | |||||||||||||||
| 1127 | $b = exp $a; | ||||||||||||||
| 1128 | $a->inplace->exp; # modify $a inplace | ||||||||||||||
| 1129 | |||||||||||||||
| 1130 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 1131 | This function is used to overload the unary C<exp> operator/function. | ||||||||||||||
| 1132 | |||||||||||||||
| 1133 | |||||||||||||||
| 1134 | |||||||||||||||
| 1135 | =for bad | ||||||||||||||
| 1136 | |||||||||||||||
| 1137 | exp processes bad values. | ||||||||||||||
| 1138 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 1139 | |||||||||||||||
| 1140 | |||||||||||||||
| 1141 | =cut | ||||||||||||||
| 1142 | |||||||||||||||
| 1143 | |||||||||||||||
| 1144 | |||||||||||||||
| 1145 | |||||||||||||||
| 1146 | |||||||||||||||
| 1147 | |||||||||||||||
| 1148 | 120 | *exp = \&PDL::exp; | |||||||||||||
| 1149 | |||||||||||||||
| 1150 | |||||||||||||||
| 1151 | |||||||||||||||
| 1152 | |||||||||||||||
| 1153 | |||||||||||||||
| 1154 | =head2 log | ||||||||||||||
| 1155 | |||||||||||||||
| 1156 | =for sig | ||||||||||||||
| 1157 | |||||||||||||||
| 1158 | Signature: (a(); [o]b()) | ||||||||||||||
| 1159 | |||||||||||||||
| 1160 | =for ref | ||||||||||||||
| 1161 | |||||||||||||||
| 1162 | the natural logarithm | ||||||||||||||
| 1163 | |||||||||||||||
| 1164 | =for example | ||||||||||||||
| 1165 | |||||||||||||||
| 1166 | $b = log $a; | ||||||||||||||
| 1167 | $a->inplace->log; # modify $a inplace | ||||||||||||||
| 1168 | |||||||||||||||
| 1169 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 1170 | This function is used to overload the unary C<log> operator/function. | ||||||||||||||
| 1171 | |||||||||||||||
| 1172 | |||||||||||||||
| 1173 | |||||||||||||||
| 1174 | =for bad | ||||||||||||||
| 1175 | |||||||||||||||
| 1176 | log processes bad values. | ||||||||||||||
| 1177 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 1178 | |||||||||||||||
| 1179 | |||||||||||||||
| 1180 | =cut | ||||||||||||||
| 1181 | |||||||||||||||
| 1182 | |||||||||||||||
| 1183 | |||||||||||||||
| 1184 | |||||||||||||||
| 1185 | |||||||||||||||
| 1186 | |||||||||||||||
| 1187 | 120 | *log = \&PDL::log; | |||||||||||||
| 1188 | |||||||||||||||
| 1189 | |||||||||||||||
| 1190 | |||||||||||||||
| 1191 | |||||||||||||||
| 1192 | |||||||||||||||
| 1193 | =head2 log10 | ||||||||||||||
| 1194 | |||||||||||||||
| 1195 | =for sig | ||||||||||||||
| 1196 | |||||||||||||||
| 1197 | Signature: (a(); [o]b()) | ||||||||||||||
| 1198 | |||||||||||||||
| 1199 | =for ref | ||||||||||||||
| 1200 | |||||||||||||||
| 1201 | the base 10 logarithm | ||||||||||||||
| 1202 | |||||||||||||||
| 1203 | =for example | ||||||||||||||
| 1204 | |||||||||||||||
| 1205 | $b = log10 $a; | ||||||||||||||
| 1206 | $a->inplace->log10; # modify $a inplace | ||||||||||||||
| 1207 | |||||||||||||||
| 1208 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 1209 | This function is used to overload the unary C<log10> operator/function. | ||||||||||||||
| 1210 | |||||||||||||||
| 1211 | |||||||||||||||
| 1212 | |||||||||||||||
| 1213 | =for bad | ||||||||||||||
| 1214 | |||||||||||||||
| 1215 | log10 processes bad values. | ||||||||||||||
| 1216 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 1217 | |||||||||||||||
| 1218 | |||||||||||||||
| 1219 | =cut | ||||||||||||||
| 1220 | |||||||||||||||
| 1221 | |||||||||||||||
| 1222 | |||||||||||||||
| 1223 | |||||||||||||||
| 1224 | |||||||||||||||
| 1225 | sub PDL::log10 { | ||||||||||||||
| 1226 | 8 | ▶ | my $x = shift; | ||||||||||||
|
Subroutine
log10: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||
| 1227 | 8 | ▶ | if ( ! UNIVERSAL::isa($x,"PDL") ) { return log($x) / log(10); } | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 1228 | 7 | my $y; | |||||||||||||
| 1229 | 7 | ▶ | if ( $x->is_inplace ) { $x->set_inplace(0); $y = $x; } | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 1230 | elsif( ref($x) eq "PDL"){ | ||||||||||||||
| 1231 | #PDL Objects, use nullcreate: | ||||||||||||||
| 1232 | 5 | $y = PDL->nullcreate($x); | |||||||||||||
| 1233 | }else{ | ||||||||||||||
| 1234 | #PDL-Derived Object, use copy: (Consistent with | ||||||||||||||
| 1235 | # Auto-creation docs in Objects.pod) | ||||||||||||||
| 1236 | 1 | $y = $x->copy; | |||||||||||||
| 1237 | } | ||||||||||||||
| 1238 | 7 | &PDL::_log10_int( $x, $y ); | |||||||||||||
| 1239 | 7 | return $y; | |||||||||||||
| 1240 | }; | ||||||||||||||
| 1241 | |||||||||||||||
| 1242 | |||||||||||||||
| 1243 | 120 | *log10 = \&PDL::log10; | |||||||||||||
| 1244 | |||||||||||||||
| 1245 | |||||||||||||||
| 1246 | |||||||||||||||
| 1247 | |||||||||||||||
| 1248 | |||||||||||||||
| 1249 | =head2 assgn | ||||||||||||||
| 1250 | |||||||||||||||
| 1251 | =for sig | ||||||||||||||
| 1252 | |||||||||||||||
| 1253 | Signature: (a(); [o]b()) | ||||||||||||||
| 1254 | |||||||||||||||
| 1255 | =for ref | ||||||||||||||
| 1256 | |||||||||||||||
| 1257 | Plain numerical assignment. This is used to implement the ".=" operator | ||||||||||||||
| 1258 | |||||||||||||||
| 1259 | =for bad | ||||||||||||||
| 1260 | |||||||||||||||
| 1261 | assgn does not process bad values. | ||||||||||||||
| 1262 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 1263 | |||||||||||||||
| 1264 | |||||||||||||||
| 1265 | =cut | ||||||||||||||
| 1266 | |||||||||||||||
| 1267 | |||||||||||||||
| 1268 | |||||||||||||||
| 1269 | |||||||||||||||
| 1270 | |||||||||||||||
| 1271 | |||||||||||||||
| 1272 | 120 | *assgn = \&PDL::assgn; | |||||||||||||
| 1273 | |||||||||||||||
| 1274 | |||||||||||||||
| 1275 | |||||||||||||||
| 1276 | |||||||||||||||
| 1277 | |||||||||||||||
| 1278 | =head2 ipow | ||||||||||||||
| 1279 | |||||||||||||||
| 1280 | =for sig | ||||||||||||||
| 1281 | |||||||||||||||
| 1282 | Signature: (a(); b(); [o] ans()) | ||||||||||||||
| 1283 | |||||||||||||||
| 1284 | |||||||||||||||
| 1285 | =for ref | ||||||||||||||
| 1286 | |||||||||||||||
| 1287 | raise piddle C<$a> to integer power C<$b> | ||||||||||||||
| 1288 | |||||||||||||||
| 1289 | =for example | ||||||||||||||
| 1290 | |||||||||||||||
| 1291 | $c = $a->ipow($b,0); # explicit function call | ||||||||||||||
| 1292 | $c = ipow $a, $b; | ||||||||||||||
| 1293 | $a->inplace->ipow($b,0); # modify $a inplace | ||||||||||||||
| 1294 | |||||||||||||||
| 1295 | It can be made to work inplace with the C<$a-E<gt>inplace> syntax. | ||||||||||||||
| 1296 | Note that when calling this function explicitly you need to supply | ||||||||||||||
| 1297 | a third argument that should generally be zero (see first example). | ||||||||||||||
| 1298 | This restriction is expected to go away in future releases. | ||||||||||||||
| 1299 | |||||||||||||||
| 1300 | Algorithm from L<Wikipedia|http://en.wikipedia.org/wiki/Exponentiation_by_squaring> | ||||||||||||||
| 1301 | |||||||||||||||
| 1302 | |||||||||||||||
| 1303 | |||||||||||||||
| 1304 | =for bad | ||||||||||||||
| 1305 | |||||||||||||||
| 1306 | ipow does not process bad values. | ||||||||||||||
| 1307 | It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. | ||||||||||||||
| 1308 | |||||||||||||||
| 1309 | |||||||||||||||
| 1310 | =cut | ||||||||||||||
| 1311 | |||||||||||||||
| 1312 | |||||||||||||||
| 1313 | |||||||||||||||
| 1314 | |||||||||||||||
| 1315 | |||||||||||||||
| 1316 | |||||||||||||||
| 1317 | 120 | *ipow = \&PDL::ipow; | |||||||||||||
| 1318 | |||||||||||||||
| 1319 | |||||||||||||||
| 1320 | |||||||||||||||
| 1321 | ; | ||||||||||||||
| 1322 | |||||||||||||||
| 1323 | |||||||||||||||
| 1324 | =head1 AUTHOR | ||||||||||||||
| 1325 | |||||||||||||||
| 1326 | Tuomas J. Lukka (lukka@fas.harvard.edu), | ||||||||||||||
| 1327 | Karl Glazebrook (kgb@aaoepp.aao.gov.au), | ||||||||||||||
| 1328 | Doug Hunt (dhunt@ucar.edu), | ||||||||||||||
| 1329 | Christian Soeller (c.soeller@auckland.ac.nz), | ||||||||||||||
| 1330 | Doug Burke (burke@ifa.hawaii.edu), | ||||||||||||||
| 1331 | and Craig DeForest (deforest@boulder.swri.edu). | ||||||||||||||
| 1332 | |||||||||||||||
| 1333 | =cut | ||||||||||||||
| 1334 | |||||||||||||||
| 1335 | |||||||||||||||
| 1336 | |||||||||||||||
| 1337 | |||||||||||||||
| 1338 | |||||||||||||||
| 1339 | # Exit with OK status | ||||||||||||||
| 1340 | |||||||||||||||
| 1341 | 120 | 1; | |||||||||||||
| 1342 | |||||||||||||||
| 1343 | |||||||||||||||