s <- 6 wts <- readRDS(paste0("../paper-old/wts", s, ".rds")) print(str(wts)) x <- readRDS(paste0("../paper-old/x", s, ".rds")) dim(x) <- c(length(x), 1) pw <- 1L print(system.time({ repmeans<-matrix(data=as.numeric(NA), ncol=NCOL(x), nrow=ncol(wts)) for(i in 1:ncol(wts)){ repmeans[i,]<-t(colSums(wts[,i]*x*pw)/sum(pw*(wts[,i]))) } })) print(system.time({ print(repmeans) }))