[Numpy-discussion] dot function or dot notation, matrices, arrays?
Wayne Watson
sierra_mtnview@sbcglobal....
Fri Dec 18 16:51:25 CST 2009
That should do it. Thanks. How do I get the scalar result by itself?
Keith Goodman wrote:
> On Fri, Dec 18, 2009 at 1:51 PM, Wayne Watson
> <sierra_mtnview@sbcglobal.net> wrote:
>
>> Is it possible to calculate a dot product in numpy by either notation
>> (a ^ b, where ^ is a possible notation) or calling a dot function
>> (dot(a,b)? I'm trying to use a column matrix for both "vectors".
>> Perhaps, I need to somehow change them to arrays?
>>
>
> Does this do what you want?
>
>
>>> x
>>>
> matrix([[1],
> [2],
> [3]])
>
>
>>> x.T * x
>>>
> matrix([[14]])
>
>>> np.dot(x.T,x)
>>>
> matrix([[14]])
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@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