EVOLUTION-MANAGER
Edit File: matmult.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Matrix Multiplication</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for matmult {base}"><tr><td>matmult {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Matrix Multiplication</h2> <h3>Description</h3> <p>Multiplies two matrices, if they are conformable. If one argument is a vector, it will be promoted to either a row or column matrix to make the two arguments conformable. If both are vectors of the same length, it will return the inner product (as a matrix). </p> <h3>Usage</h3> <pre> x %*% y </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x, y</code></td> <td> <p>numeric or complex matrices or vectors.</p> </td></tr> </table> <h3>Details</h3> <p>When a vector is promoted to a matrix, its names are not promoted to row or column names, unlike <code><a href="matrix.html">as.matrix</a></code>. </p> <p>Promotion of a vector to a 1-row or 1-column matrix happens when one of the two choices allows <code>x</code> and <code>y</code> to get conformable dimensions. </p> <p>This operator is S4 generic but not S3 generic. S4 methods need to be written for a function of two arguments named <code>x</code> and <code>y</code>. </p> <h3>Value</h3> <p>A double or complex matrix product. Use <code><a href="drop.html">drop</a></code> to remove dimensions which have only one level. </p> <h3>Note</h3> <p>The propagation of NaN/Inf values, precision, and performance of matrix products can be controlled by <code><a href="options.html">options</a>("matprod")</code>. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p>For matrix <em>cross</em>products, <code><a href="crossprod.html">crossprod</a>()</code> and <code>tcrossprod()</code> are typically preferable. <code><a href="matrix.html">matrix</a></code>, <code><a href="Arithmetic.html">Arithmetic</a></code>, <code><a href="diag.html">diag</a></code>. </p> <h3>Examples</h3> <pre> x <- 1:4 (z <- x %*% x) # scalar ("inner") product (1 x 1 matrix) drop(z) # as scalar y <- diag(x) z <- matrix(1:12, ncol = 3, nrow = 4) y %*% z y %*% x x %*% z </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>