I am working on matrix operations in R. I came across 2 different methods to find inverse of a matrix namely:
MASS::ginv(a)
solve(a)
They returns the same result or so it seems but when I try to equate them using ginv(a) == solve(a)
only elements of leading diagonal seem to be equal. It returns True for those elements otherwise it returns zero.
I am perplexed with this behavior. This is happening even though I can see that they have exactly same numerical values.
I am working on R Studio and Windows.
library(MASS)
a1 <- rbind(c(1,-0.25),c(-0.25,1))
solve(a1)
ginv(a1)
solve(a1) == ginv(a1)
Please somebody explain to me what is happening. Is it because of pseudo inverse?