Re: [R] Question regarding lu in package Matrix

From: Ulrike Grömping <groemp_at_tfh-berlin.de>
Date: Wed, 09 Jul 2008 13:06:35 -0700 (PDT)

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 <groemp_at_tfh-berlin.de>
> 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_at_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_at_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.
Received on Wed 09 Jul 2008 - 20:10:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jul 2008 - 20:33:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive