No, not at all, I'm glad that I do get the decomposition for non-square matrices. My problem is not with elu$U but with as.matrix(elu$U), which is not an upper diagonal matrix. Can I do something to fix this ?
Regards, Ulrike Douglas Bates-2 wrote: > > On Wed, Jul 9, 2008 at 12:01 PM, Ulrike Grömping <[EMAIL PROTECTED]> > wrote: > >> Dear R-helpers, > >> I have a question regarding LU-decomposition with function lu in package >> Matrix. The following simple example confuses me: Why is as.matrix(elu$U) >> not an upper triangular matrix? > >> u3 <- >> matrix(c(1,1,1,1,1,1,-1,1,0,0,0,0,0,-1,1,0,0,0,-1,0,1,0,0,0,0,0,-1,1,0,0),5,6,byrow=T) >> elu <- expand(lu(Matrix(u3,sparse=F))) >> as.matrix(elu$U) > > I get > >> elu$U > 5 x 6 Matrix of class "dtrMatrix" > [,1] [,2] [,3] [,4] [,5] [,6] > [1,] 1.0000000 0.0000000 0.0000000 0.0000000 1.0000000 1.0000000 > [2,] . 2.0000000 0.0000000 0.0000000 1.0000000 1.0000000 > [3,] . . 1.5000000 0.0000000 0.0000000 0.5000000 > [4,] . . . 1.3333333 0.0000000 0.3333333 > [5,] . . . . 0.0000000 0.0000000 > > which is about as upper-triangular as it can be, considering that the > original matrix is not square. > > The help page for 'lu' does say that it gives the triangular > decomposition of a square matrix, although the decomposition is > defined for non-square. It's just not as useful as it would be for > square matrices. > > Are you suggesting that we should check the argument to lu and report > an error if it is not square > > >> I only have very limited experience with the package and its different >> types >> of matrices, and I am lost where to start looking for a reason. >> >> Regards, >> Ulrike Grömping >> >> >> -- >> View this message in context: >> http://www.nabble.com/Question-regarding-lu-in-package-Matrix-tp18366291p18366291.html >> Sent from the R help mailing list archive at Nabble.com. >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- View this message in context: http://www.nabble.com/Question-regarding-lu-in-package-Matrix-tp18366291p18369646.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.