[Date Index]
[Thread Index]
[Author Index]
Re: Dot Product of Vectors
*To*: mathgroup at smc.vnet.net
*Subject*: [mg9] Re: Dot Product of Vectors
*From*: Bill Rowe <readnews at sbcglobal.net>
*Date*: Sun, 25 May 2008 02:06:47 -0400 (EDT)
On 5/24/08 at 3:55 AM, gregory.lypny at videotron.ca (Gregory Lypny)
wrote:
>I've got two n x k matrices called X and Y. I'd like to compute an
>n x 1 vector whose elements are the dot products of corresponding
>rows of X and Y, that is,
>{{X[[1]].Y[[1]]}, {X[[2]].Y[[2]]}, {X[[3]].Y[[3]]}, ...
>{X[[n]].Y[[n]]}.
>I found that this can be done using MapThread as
>MapThread[Dot, { X, Y}],
>which is straightforward. I'm curious, given that there a zillion
>ways to do any given calculation in Mathematica, if anyone knows of
>another way that is as compact.
Another simple way to get the same result would be:
Total@Transpose[x y]
Prev by Date:
**Re: how to select all graphics in a notebook?**
Next by Date:
**Re: Re: Range of Use of Mathematica**
Previous by thread:
**Re: Dot Product of Vectors**
Next by thread:
**Re: Dot Product of Vectors**
| |