In this simple case, you can separately assign the diagonal and upper triangular parts as follows:
m <- matrix(0, nrow=3, ncol=3) diag(m) <- 14000 m[upper.tri(m)] <- c(12000, 8000, 12000)
However, as David Arenburg pointed out, this is a more manual approach and therefore does not scale very well. For a more automated, scalable approach, I recommend the akrun solution with toeplitz() and lower.tri() .
I will keep this answer here for completeness in your particular case, but I think that acrun is the best overall solution.
source share