I have an idea, but i don’t know how to implemented it. I would like to pass a temporary variables to store the eigenvectors of eigen! - by default eigen! uses the original matrix.
I am confident that this is possible to do, because inside eigen function, a new matrix to store the eigenvectors must be created. I need some help to point out where this happen, then my naive thoughs would be to create a new function, and pass my matrix as argument.
The rest of algorithms does not need to change, therefore, less probability of issues.
Below I show my expected behavior, if, somehow, it helps.
using LinearAlgebra
A = rand(4,4)
λ₁, ψ₁ = eigen(A)
λ₂, ψ₂ = eigen!(A)
@show all(λ₁ .≈ λ₂)
@show all(ψ₁ .≈ ψ₂)
A_mine = zeros(A)
λ₃ = eigen!(A, A_mine) ### what I need
@show all(ψ₁ .≈ A_mine) ### of course should be true
But the function eigen will allocate memory somewhere inside it, before we put the content inside b.
I would like to avoid the eigen to create a new matrix temporarily.