MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Speed: Inner MUCH slower than dot product??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65523] Speed: Inner MUCH slower than dot product??
  • From: Lee Newman <leenewm at umich.edu>
  • Date: Thu, 6 Apr 2006 06:52:13 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Group,

In the process of performance tweaking some code, I came upon the 
following result:  using Inner is MUCH slower (orders of magnitude) than 
using Dot product (see code below).  Why is this?

m = Table[Random[], {25*25}, {50}];
mt = Transpose@m;
v = Table[Random[], {50}];

Do[v.mt, {10^3}] // Timing
Do[Dot[v, mt], {10^3}] // Timing
Do[Inner[Times, v, mt, Plus], {10^3}] // Timing

{0.047 Second, Null}
{0.046 Second, Null}
{22.047 Second, Null}

Lee


  • Prev by Date: Re: Count Function
  • Next by Date: Re: HoldFirst confusion
  • Previous by thread: Complex number after NIntegrate
  • Next by thread: Re: Speed: Inner MUCH slower than dot product??