Re: Why Does Repeated Dot Product Take So Long?
- To: mathgroup at smc.vnet.net
- Subject: [mg67946] Re: Why Does Repeated Dot Product Take So Long?
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Tue, 18 Jul 2006 05:50:30 -0400 (EDT)
- Organization: Uni Leipzig
- References: <e9frif$2lp$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
my Dual Pentium say
With[{n = 2000000},
x = Table[Random[], {n}, {3}];
y = Table[Random[], {n}, {3}];
Timing[
Table[Dot[x[[i]], y[[i]]], {i, n}]
]
] // First
2.172 Second
and
Timing[MapThread[Dot, {x, y}]]
Dot @@@ Transpose[{x, y}]
are mutch slower ...
May be you should blame the PowerPC processor ...
Regards
Jens
"Gregory Lypny" <gregory.lypny at videotron.ca>
schrieb im Newsbeitrag
news:e9frif$2lp$1 at smc.vnet.net...
| Hello Everyone,
|
| 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?
|
| Regards,
|
| Gregory
|