Displaying 1 result from an estimated 1 matches for "tp3710428p3710428".
2011 Aug 01
4
fill Matrix quicker
...milar?
makeMatrix <- function(a, b,dim) {
X=matrix(0,ncol=dim,nrow=dim)
for (i in c(1:dim)){
for (j in c(1:dim)) {
if (i==j) {X[i,j]<-a}
else { X[i,j]<- exp(( -1*abs(i-j))/(3*b)) }
}
}
X
}
--
View this message in context: http://r.789695.n4.nabble.com/fill-Matrix-quicker-tp3710428p3710428.html
Sent from the R help mailing list archive at Nabble.com.