Displaying 1 result from an estimated 1 matches for "tp3710428p3710533".
2011 Aug 01
4
fill Matrix quicker
dear all,
i have a quite simple question, i want to fill up a Matrix like done in the
following function,
but the performance is very bad for large dimensions
is there a way to do this like with apply or something similar?
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((