[Numpy-discussion] dot function or dot notation, matrices, arrays?

Wayne Watson sierra_mtnview at sbcglobal.net
Fri Dec 18 18:22:26 EST 2009


Very good.
Is there a scalar product in numpy?

Keith Goodman wrote:
> On Fri, Dec 18, 2009 at 2:51 PM, Wayne Watson
> <sierra_mtnview at sbcglobal.net> wrote:
>   
>> That should do it. Thanks. How do I get the scalar result by itself?
>>     
>
>   
>>> np.dot(x.T,x)[0,0]
>>>       
>    14
>
> or
>
>   
>>> x = np.array([1,2,3])
>>> np.dot(x,x)
>>>       
>    14
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>   

-- 
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet  
                
             "... humans'innate skills with numbers isn't much
              better than that of rats and dolphins." 
                       -- Stanislas Dehaene, neurosurgeon 
 
                    Web Page: <www.speckledwithstars.net/>




More information about the NumPy-Discussion mailing list