EVOLUTION-MANAGER
Edit File: backsolve.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: Solve an Upper or Lower Triangular System</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 backsolve {base}"><tr><td>backsolve {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Solve an Upper or Lower Triangular System</h2> <h3>Description</h3> <p>Solves a triangular system of linear equations. </p> <h3>Usage</h3> <pre> backsolve(r, x, k = ncol(r), upper.tri = TRUE, transpose = FALSE) forwardsolve(l, x, k = ncol(l), upper.tri = FALSE, transpose = FALSE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>r, l</code></td> <td> <p>an upper (or lower) triangular matrix giving the coefficients for the system to be solved. Values below (above) the diagonal are ignored.</p> </td></tr> <tr valign="top"><td><code>x</code></td> <td> <p>a matrix whose columns give the right-hand sides for the equations.</p> </td></tr> <tr valign="top"><td><code>k</code></td> <td> <p>The number of columns of <code>r</code> and rows of <code>x</code> to use.</p> </td></tr> <tr valign="top"><td><code>upper.tri</code></td> <td> <p>logical; if <code>TRUE</code> (default), the <em>upper</em> <em>tri</em>angular part of <code>r</code> is used. Otherwise, the lower one.</p> </td></tr> <tr valign="top"><td><code>transpose</code></td> <td> <p>logical; if <code>TRUE</code>, solve <i>r' * y = x</i> for <i>y</i>, i.e., <code>t(r) %*% y == x</code>.</p> </td></tr> </table> <h3>Details</h3> <p>Solves a system of linear equations where the coefficient matrix is upper (or ‘right’, ‘R’) or lower (‘left’, ‘L’) triangular. </p> <p><code>x <- backsolve (R, b)</code> solves <i>R x = b</i>, and<br /> <code>x <- forwardsolve(L, b)</code> solves <i>L x = b</i>, respectively. </p> <p>The <code>r</code>/<code>l</code> must have at least <code>k</code> rows and columns, and <code>x</code> must have at least <code>k</code> rows. </p> <p>This is a wrapper for the level-3 BLAS routine <code>dtrsm</code>. </p> <h3>Value</h3> <p>The solution of the triangular system. The result will be a vector if <code>x</code> is a vector and a matrix if <code>x</code> is a matrix. </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> <p>Dongarra, J. J., Bunch, J. R., Moler, C. B. and Stewart, G. W. (1978) <em>LINPACK Users Guide</em>. Philadelphia: SIAM Publications. </p> <h3>See Also</h3> <p><code><a href="chol.html">chol</a></code>, <code><a href="qr.html">qr</a></code>, <code><a href="solve.html">solve</a></code>. </p> <h3>Examples</h3> <pre> ## upper triangular matrix 'r': r <- rbind(c(1,2,3), c(0,1,1), c(0,0,2)) ( y <- backsolve(r, x <- c(8,4,2)) ) # -1 3 1 r %*% y # == x = (8,4,2) backsolve(r, x, transpose = TRUE) # 8 -12 -5 </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>