[NumPy-Tickets] [NumPy] #1192: integer dot product

NumPy Trac numpy-tickets@scipy....
Wed Mar 30 11:46:38 CDT 2011


#1192: integer dot product
----------------------+-----------------------------------------------------
  Reporter:  jloper   |       Owner:  somebody
      Type:  defect   |      Status:  closed  
  Priority:  normal   |   Milestone:          
 Component:  Other    |     Version:  1.2.1   
Resolution:  invalid  |    Keywords:  dot int8
----------------------+-----------------------------------------------------

Comment(by bsouthey):

 (Any examples must use numpy's functions.)
 This is invalid because dot keeps the input dtype causing an overflow.
 This can be seen by using the dtype argument:
 {{{
 np.sum(a*b).dtype # dtype('int64') on 64-bit linux
 np.sum(a*b, dtype=numpy.int8).dtype # dtype('int8') but wrong answer
 }}}
 By default numpy.sum (and probably Python's sum) uses the platform default
 and will give the correct answer until that precision overflows.

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


More information about the NumPy-Tickets mailing list