Rev 3451 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{lu}\title{Triangular Decomposition of a Square Matrix}\usage{lu(x, \dots)}\alias{lu}\description{Computes triangular decompositions of square matrices.}\arguments{\item{x}{a matrix. No missing values or IEEE special values are allowed.}\item{\dots}{further arguments passed to or from other methods.}}\value{an object of class \code{"LU"}, i.e., \code{"\linkS4class{denseLU}"} or\code{"sparseLU"}, see \code{\linkS4class{sparseLU}}; this isa representation of a triangular decomposition of \code{x}.}\details{This is a generic function with special methods for different typesof matrices. Use \code{\link{showMethods}("lu")} to list all the methodsfor the \code{\link{lu}} generic.The method for class \code{\linkS4class{dgeMatrix}} is based onLAPACK's \code{"dgetrf"} subroutine.The method for class \code{\linkS4class{dgCMatrix}} of sparse matricesis based on functions from the CSparse library.}\references{Golub, G., and Van Loan, C. F. (1989).\emph{Matrix Computations,}2nd edition, Johns Hopkins, Baltimore.Tim Davis (2005)\url{http://www.cise.ufl.edu/research/sparse/CSparse/}Timothy A. Davis (2006)\emph{Direct Methods for Sparse Linear Systems}, SIAM Series\dQuote{Fundamentals of Algorithms}.}\seealso{Class definitions \code{\linkS4class{LU}} and \code{\linkS4class{sparseLU}}and function \code{\link{expand}};\code{\link{qr}}, \code{\link{chol}}.}\examples{x <- Matrix(rnorm(9), 3, 3)lu(x)pm <- as(readMM(system.file("external/pores_1.mtx",package = "Matrix")),"CsparseMatrix")str(pmLU <- lu(pm)) # p is a 0-based permutation of the rows# q is a 0-based permutation of the columns## permute rows and columns of original matrixppm <- pm[pmLU@p + 1:1, pmLU@q + 1:1]ppm[1:14, 1:5](pmLU@L \%*\% pmLU@U)[1:14, 1:5] # product can have extra zeros}\keyword{array}\keyword{algebra}