def hanning(M):
"""Returns the Hanning window.
The Hanning window is defined as
.. math::
w(n) = 0.5 - 0.5\\cos\\left(\\frac{2\\pi{n}}{M-1}\\right)
\\qquad 0 \\leq n \\leq M-1
Args:
M (:class:`~int`):
Number of points in the output window. If zero or less, an empty
array is returned.
Returns:
~cupy.ndarray: Output ndarray.
.. seealso:: :func:`numpy.hanning`
"""
if M < 1:
return from_data.array([])
if M == 1:
return basic.ones(1, float)
n = ranges.arange(0, M)
return 0.5 - 0.5 * trigonometric.cos(2.0 * numpy.pi * n / (M - 1))
评论列表
文章目录