Tridimity Posted July 10, 2013 Share Posted July 10, 2013 Hi all, I am trying to understand matrix multiplication in MATLAB. If we have the following two matrices: a b w x c d y z Then, in what order should the elements by multiplied? Any help is greatly appreciated. Tridimity Link to comment Share on other sites More sharing options...
Arnaud Antoine ANDRIEU Posted July 10, 2013 Share Posted July 10, 2013 (edited) The order begins with an imaginary point situated at the center of the two matrices. a->w a->x a->z a->y b->w b->x b->z b->y d->w ..... c->w ..... Edited July 10, 2013 by Arnaud Antoine ANDRIEU Link to comment Share on other sites More sharing options...
Bignose Posted July 10, 2013 Share Posted July 10, 2013 (edited) I have no idea what AAA is talking about... if you have matrix A with elements [math]A_{ij}[/math] and matrix B with elements [math]B_{jk}[/math] (and I picked the dimensions on purpose there.... the second dimension of A has to equal the first dimension of B, hence they both used j) The matrix C = A * B will be defined by [math]C_{ik} = \sum^m_{j=1}A_{ij}B_{jk}[/math] where m represents the number of columns in A and rows in B. For your 2x2 example: [math]C_{1,2} = \sum^2_{j=1}A_{1,j}B_{j,2} = A_{1,1}B_{1,2} + A_{1,2}B_{2,2}[/math] In terms of what order you do these operations in, there are incredibly fast optimized routines out there. You might want to look at the source of something like BLAS (http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms) to see how they code it efficiently. But in terms of getting the right answer, order is unimportant so long as you multiply and add the right things together. Edited July 10, 2013 by Bignose Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now