[SciPy-dev] Fancy indexing curiosity

Alan G Isaac aisaac at american.edu
Mon Jan 9 12:37:19 EST 2006


On Mon, 9 Jan 2006, Alexander Belopolsky apparently wrote: 
> The dot product of two rank-1, length n vectors A and B is 
> in python notation 
>     sum(a*b for (a,b) in zip(A, B)) 
> If n = 0, the sum of zero elements is zero. 

OK.  I'm sold.  Algorithmically it's an obvious and 
consistent choice.  And against my initial intuition,
it seems to work fine as an inner product on a vector space 
(with a single element [], which is the additive identity).
Apologies for the noise, and thanks.
Alan







More information about the SciPy-Dev mailing list