# [R] g-inverse

Jonathan Rougier J.C.Rougier at durham.ac.uk
Thu Nov 30 10:27:44 CET 2000

```Hi Tapio,

On Thu, 30 Nov 2000, Tapio Nummi wrote:

> Is there any routine to obtain a g-inverse
> of a matrix in R or S-PLUS?
>
> Tapio Nummi
> University of Tampere
> Finland

Unfortunately there is no general `generalised inverse'.  But there are
special cases where it is easy to compute the generalised inverse.  These
are (1) if the matrix is symmetric, in which case you can use the eigen
decomposition; (2) if the matrix has full row or column rank, in which
case you can partition the matrix and invert the square submatrix of full
rank; (3) if you happen to know in advance that a particular subset of the
rows or columns is of full rank, in which case you can do the same thing
(after permuting).  Or you can use the SVD, but you might run into
numerical problems.  So it really depends on what you know, and it follows
that it is not generally possible to write a general function.

It's telling that both of my references on the subject, Campbell and
Meyer, "Generalised Inverses of Linear Transformations" and Rao and Mitra,
"Generalised Inverse of Matrices and its Applications", devote whole
chapters to computation, and in both cases the chapter occurs near the
want to invert I would be happy to help.

Cheers, Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```