0

I have a vector Nx1 with numbers that I want to be the eigenvalues of a matrix X which I am attempting to construct. Essentially, I want to take my Nx1 matrix and list the ith entry of this vector on the ith diagonal of this matrix. I have tried various matrix multiplications, but nothing seems to be working. Can someone help me out?

Cheers.

Note that I am attempting to do this in R.

chtz
  • 17,329
  • 4
  • 26
  • 56
  • 1
    It would be better if you provide code for your best attempt, and the reason why is not working. That will help narrow down your question. Thanks. – lrnzcig Oct 31 '17 at 08:50
  • When you say vector you are talking of a matrix row? Or a real vector? – amarchin Oct 31 '17 at 08:50

1 Answers1

1

This chunk of code works for vectors

eigenvalues <- 1:10
matrix <- diag(eigenvalues)

This works for a matrix

eigenvalues <- matrix(1:10, ncol = 1)
matrix <- diag(eigenvalues[, 1])
amarchin
  • 2,044
  • 1
  • 16
  • 32