[Date Index]
[Thread Index]
[Author Index]
Re: Matrix Dot Product
*To*: mathgroup at smc.vnet.net
*Subject*: [mg52189] Re: [mg52159] Matrix Dot Product
*From*: "David Park" <djmp at earthlink.net>
*Date*: Sun, 14 Nov 2004 04:30:37 -0500 (EST)
*Sender*: owner-wri-mathgroup at wolfram.com
You're in luck! Mathematica will do it.
Here are two sample 2 x 2 matrices.
matA = Array[a, {2, 2}]
{{a[1, 1], a[1, 2]}, {a[2, 1], a[2, 2]}}
matB = Array[b, {2, 2}]
{{b[1, 1], b[1, 2]}, {b[2, 1], b[2, 2]}}
Then matrix multiplication is just performed with the 'dot' product.
matA.matB
{{a[1, 1] b[1, 1] + a[1, 2] b[2, 1],
a[1, 1] b[1, 2] + a[1, 2] b[2, 2]}, {a[2, 1] b[1, 1] + a[2, 2] b[2, 1],
a[2, 1] b[1, 2] + a[2, 2] b[2, 2]}}
Check out Help/List and Matrices/Matrix Operations for more information and
examples.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: MacDonald, Calum (MAT) [mailto:C.A.MacDonald at gcal.ac.uk]
To: mathgroup at smc.vnet.net
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
Prev by Date:
**Re: TraditionalForm of expressions WITHOUT evaluating.**
Next by Date:
**Re: TraditionalForm of expressions WITHOUT evaluating.**
Previous by thread:
**Re: Matrix Dot Product**
Next by thread:
**Re: Matrix Dot Product**
| |