Joseph Fox-Rabinovitz
2016-02-23 23:20:00 UTC
I have created PR #7322 (https://github.com/numpy/numpy/pull/7322) to
add a scale parameter to `sinc`. What this allows is to compute `sinc`
as `sin(x)/x` or really `sin(n*x)/(n*x)` for arbitrary `n` instead of
just `sin(pi*x)/(pi*x)` as is being done now. The parameter accepts
two string arguments in addition to the actual scale value:
'normalized' and 'unnormalized'. 'normalized' is the default since
that is the existing functionality. 'unnormalized' is equivalent to a
`scale` of 1.0. The parameter also supports broadcasting against the
input array.
Regards,
-Joe
P.S. I would like to turn `sinc` into a `ufunc` at some point if the
community approves. It would make the computation much cleaner (e.g.,
in-place `where`) and faster. It would also complement the existing
trig functions nicely. The only question I have is whether or not it
is possible to pass in optional parameters to ufuncs beyond the ones
listed in http://docs.scipy.org/doc/numpy-1.10.0/reference/ufuncs.html#optional-keyword-arguments
add a scale parameter to `sinc`. What this allows is to compute `sinc`
as `sin(x)/x` or really `sin(n*x)/(n*x)` for arbitrary `n` instead of
just `sin(pi*x)/(pi*x)` as is being done now. The parameter accepts
two string arguments in addition to the actual scale value:
'normalized' and 'unnormalized'. 'normalized' is the default since
that is the existing functionality. 'unnormalized' is equivalent to a
`scale` of 1.0. The parameter also supports broadcasting against the
input array.
Regards,
-Joe
P.S. I would like to turn `sinc` into a `ufunc` at some point if the
community approves. It would make the computation much cleaner (e.g.,
in-place `where`) and faster. It would also complement the existing
trig functions nicely. The only question I have is whether or not it
is possible to pass in optional parameters to ufuncs beyond the ones
listed in http://docs.scipy.org/doc/numpy-1.10.0/reference/ufuncs.html#optional-keyword-arguments