[NumPy-Tickets] [NumPy] #1995: DOC: numpy.correlate() docstring is wrong

NumPy Trac numpy-tickets@scipy....
Sat Jul 21 14:49:17 CDT 2012


#1995: DOC: numpy.correlate() docstring is wrong
------------------------+---------------------------------------------------
 Reporter:  O.C.        |       Owner:  somebody    
     Type:  defect      |      Status:  needs_review
 Priority:  normal      |   Milestone:  Unscheduled 
Component:  numpy.core  |     Version:  1.5.1       
 Keywords:              |  
------------------------+---------------------------------------------------
Changes (by O.C.):

  * status:  new => needs_review


Comment:

 I provide an example to confirm what I wrote above:
 {{{
 a, v = arange(5), arange(3)
 z = correlate(a,v)            # array([ 5,  8, 11])
 z[1]                          # 8

 # With the formula described in the docstring, z[k] = sum_n a[n] *
 conj(v[n+k]),
 # we have z[1] = sum_n a[n] * conj(v[n+1])
 sum(a[:2] * v[1:])
 2                         # does not match the output of correlate(a,v)

 # With the formula I give above, z[k] = sum_n a[n] * conj(v[n-k]),
 # we have z[1] = sum_n a[n] * conj(v[n-1])
 sum(a[1:4] * v)
 8                         # identical to the output of correlate(a,v)
 }}}
 The patch is just a change in the docstring.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1995#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list