0

I want to construct a 1000x1000 symmetric matrix where all diagonal elements are 1 and others are 0.5. I don't know how to do this for such a large matrix. Can someone help me out here?

Thank you!

1 Answers1

3
m <- matrix(0.5, ncol = 1000, nrow = 1000)
diag(m) <- 1
AshOfFire
  • 676
  • 5
  • 15