[R] Can't invert matrix

Spencer Graves spencer.graves at structuremonitoring.com
Sun Nov 21 06:07:13 CET 2010


Your matrix has rank 3:


A <- matrix(c(0.99252358,  0.93715047,  0.7540535,  0.4579895,
+               0.01607797,  0.09616267,  0.2452471,  0.3088614,
+               0.09772828,  0.58451468,  1.4907090,  1.8773815,
+              -0.01000000,  0.00000000,  0.0900000,  0.1700000),
+             byrow=TRUE, nrow=4, ncol=4)
 > svdA <- svd(A)
 > str(svdA)
List of 3
  $ d: num [1:4] 2.78 1.11 3.48e-02 3.37e-08
  $ u: num [1:4, 1:4] -0.466 -0.143 -0.871 -0.061 0.884 ...
  $ v: num [1:4, 1:4] -0.198 -0.346 -0.609 -0.686 0.748 ...


       The smallest singular value is 3.4e-8, which is numerically 
singular relative to the largest singular value.  Since you only gave us 
the numbers to 8 significant digits, the smallest singular value could 
be substantially smaller, e.g. 1e-16.


       Hope this helps.
       Spencer
p.s.  I get essentially the same result using eigen(A).

On 11/20/2010 8:55 PM, Noah Silverman wrote:
> Hi,
>
> I'm trying to use the solve() function in R to invert a matrix.  I get
> the following error, "Lapack routine dgesv: system is exactly singular"
>
> However, My matrix doesn't appear to be singular.
>
>              [,1]       [,2]      [,3]      [,4]
> [1,]  0.99252358 0.93715047 0.7540535 0.4579895
> [2,]  0.01607797 0.09616267 0.2452471 0.3088614
> [3,]  0.09772828 0.58451468 1.4907090 1.8773815
> [4,] -0.01000000 0.00000000 0.0900000 0.1700000
>
>
> Can anyone help me understand what is happening here?
>
> Thanks!
>
> -N
>
> ______________________________________________
> 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.
>
>


-- 
Spencer Graves, PE, PhD
President and Chief Operating Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567



More information about the R-help mailing list