R/Rmatsolve.R

Defines functions Rmatsolve

Documented in Rmatsolve

Rmatsolve<-function(m){

if(!is.matrix(m)){
	m<-as.matrix(m)
}

if (nrow(m)==1){     #since diag doesn't like 1x1 matrices
	inv<-1/m
}
else{
	e <- eigen(m, symmetric=TRUE)
	ev <- e$vectors
	inv<-ev %*% diag(1/e$values) %*% t(ev)
}

inv
}

Try the adlift package in your browser

Any scripts or data that you put into this service are public.

adlift documentation built on March 31, 2023, 11:03 p.m.