Re: Matrix Dot Product

*To*: mathgroup at smc.vnet.net*Subject*: [mg52238] Re: [mg52159] Matrix Dot Product*From*: János <janos.lobb at yale.edu>*Date*: Mon, 15 Nov 2004 20:56:53 -0500 (EST)*References*: <200411130940.EAA00971@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Will this work for you ? In[177]:= Total[Flatten[Inner[Times, A, B, Plus]]] János On Nov 13, 2004, at 4:40 AM, MacDonald, Calum ((MAT)) wrote: > Hi > > I was wondering if someone could please help me with a command for > calculating the dot product of two (NxN) matrices. > > For example, for two (2x2) matrices, A and B, we define the dot > product > as: > > A(1,1)*B(1,1) + A(2,1)*B(2,1) + A(1,2)*B(1,2) + A(2,2)*B(2,2) > > i.e. we multiply corresponding entries of the matrices and sum these > values. > > It is easy to write this in a loop but for large matrices the > calculation is rather slow. > > Is there a Mathematica function that I can call that will allow me to > do > this faster? > > Thanks > > Calum > > > ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice)

**References**:**Matrix Dot Product***From:*"MacDonald, Calum \(MAT\)" <C.A.MacDonald@gcal.ac.uk>