Re: Why Does Repeated Dot Product Take So Long?
- To: mathgroup at smc.vnet.net
- Subject: [mg67952] Re: Why Does Repeated Dot Product Take So Long?
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Tue, 18 Jul 2006 05:50:39 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 7/17/06 at 6:51 AM, gregory.lypny at videotron.ca (Gregory Lypny)
wrote:
>x and y are both 2000 x 3 matrices. I wanted to created a 2000 x 1
>vector with each element equal to the dot product of the
>corresponding rows of x and y. So I tried this:
>Table[x[[i]].y[[i]], {i, 1, 2000}]
>It took more than two and a half minutes on my iBook G4. Is that
>normal? I've done seemingly more demanding computations in Do loops
>and Tables that are completed in a split second. Am I doing
>something wrong with this one?
Hmmm...
On my AlBook, I did the following
In[12]:=
x=Table[Random[],{2000},{3}];
y=Table[Random[],{2000},{3}];
In[14]:=
Table[y[[i]].x[[i]],{i,2000}];//Timing
Out[14]=
{0.003761 Second,Null}
which clearly doesn't show a problem. Perhaps your matrices consist of something other than just machine precision numbers?
--
To reply via email subtract one hundred and four