Reuse Eigen object

If I do

using LinearAlgebra
A = randn(100,100)
B = A'*A
C = eigen(B)

then how could I avoid allocating more memory by the next call to eigen with a 100 by 100 symmetric matrix? In other words, how could I reuse C?

(I can see that Eigen is itself immutable, but its elements include a vector and matrix and I should be able to overwrite those.)

Check the docs for eigen!

1 Like

saw that.

Ok, what I missed is that eigen!(A) does not change the type of A, so I can do C = eigen!(A), which still uses about two thirds of the memory of C = eigen(A). I can make that work.