NAME

PDL::Ops - Fundamental mathematical operators

DESCRIPTION

This module provides the functions used by PDL to overload the basic mathematical operators (+ - / * etc.) and functions (sin sqrt etc.)

It also includes the function log10, which should be a perl function so that we can overload it!

Matrix multiplication (the operator x) is handled by the module PDL::Primitive.

SYNOPSIS

none

AUTHOR

Tuomas J. Lukka (lukka@fas.harvard.edu), Karl Glazebrook (kgb@aaoepp.aao.gov.au), Doug Hunt (dhunt@ucar.edu), Christian Soeller (c.soeller@auckland.ac.nz), Doug Burke (burke@ifa.hawaii.edu), and Craig DeForest (deforest@boulder.swri.edu).

raise ndarray \$a to integer power \$b

Algorithm from Wikipedia }, Pars => 'a(); longlong b(); [o] ans()', GenericTypes => [qw(P Q), @$AF], Code => pp_line_numbers(__LINE__-1, q{ $GENERIC(b) n = $b(); if (n == 0) { $ans() = 1; continue; } $GENERIC() y = 1; $GENERIC() x = $a(); if (n < 0) { x = 1 / x; n = -n; } while (n > 1) { if (n % 2) { y *= x; n -= 1; } x *= x; n /= 2; } $ans() = x * y; }) );

pp_addpm(<<'EOPM');

abs

Returns the absolute value of a number.