Hi R helpers, I have two matrices A and B of the order (4 * 5) and (5 * 3) respectively. How to multiply these two matrices to obtain resultant matrix of the order (4 * 3). Thanks in advance With regards Maithili
Matrix Multiplication
3 messages · Maithili Shiva, Jorge Ivan Velez, Gavin Simpson
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090206/3a9cbb6f/attachment-0001.pl>
On Fri, 2009-02-06 at 04:57 -0800, Maithili Shiva wrote:
Hi R helpers, I have two matrices A and B of the order (4 * 5) and (5 * 3) respectively. How to multiply these two matrices to obtain resultant matrix of the order (4 * 3).
?`%*%` E.g.:
A <- matrix(runif(4*5), nrow = 4) B <- matrix(rnorm(5*3), nrow = 5) A %*% B
[,1] [,2] [,3] [1,] 0.11087765 0.1172641 -1.965684 [2,] 0.08811864 0.6628032 -2.704704 [3,] -0.99875302 1.2822072 -1.388777 [4,] -1.01109686 1.5752980 -1.560827
Thanks in advance With regards Maithili
HTH G
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090206/5c016def/attachment-0002.bin>