# R-alpha: solve and 1 by 1 matrices

Douglas Bates (bates@stat.wisc.edu)
Thu, 29 Aug 96 13:56 CDT

```Message-Id: <m0uwCG6-0000TzC@franz.stat.wisc.edu>
Date: Thu, 29 Aug 96 13:56 CDT
From: Douglas Bates <bates@stat.wisc.edu>
To: R-testers <r-testers@stat.math.ethz.ch>
Subject: R-alpha: solve and 1 by 1 matrices

I first noticed this when trying to get summary(fm) where fm is a
linear regression model without an intercept term.  Apparently solve()
doesn't handle 1 by 1 matrices well.
> solve(diag(2))
[,1] [,2]
[1,]    1    0
[2,]    0    1
> solve(diag(1))
Error: exact singularity in qr.coef
> foo <- diag(1)
> is.array(foo)
[1] TRUE
> dim(foo)
[1] 1 1
> foo
[,1]
[1,]    1
> solve(foo)
Error: exact singularity in qr.coef

I always thought that inverting 1 by 1 non-zero matrices would be
reasonably straightforward :-)

I'll try to track this one down a bit more.

--
Douglas Bates                            bates@stat.wisc.edu
Statistics Department                    608/262-2598
University of Wisconsin - Madison        http://www.stat.wisc.edu/~bates/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
```