[R] ginv vs. solve
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu Aug 7 13:41:43 CEST 2003
Angel wrote:
> Why do
> x<-b%*%ginv(A)
Why should it be the same???
Here, you are calculating (A+ is G-Inverse)
x = b * A+
> and
> x<-solve(A,b)
Here, you are calculating (A- is Inverse of A)
A * x = b <=> A- * A * x = A- * b <=>
x = A- * b
So you have to compare, e.g.:
ginv(A) %*% b
solve(A, b)
Uwe Ligges
> give different results?. It seems that I am missing some basic feature of
> matrix indexing.
> e.g.:
>
> A<-matrix(c(0,-4,4,0),nrow=2,ncol=2)
> b<-c(-16,0)
> x<-b%*%ginv(A);x
> x<-solve(A,b);x
>
> Thanks in advance,
> Angel
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list