@@ -62,7 +62,6 @@ function get_matrix(corr_diag::Vector{Vector{uwreal}}, corr_upper::Vector{Vector
aux=Matrix{uwreal}(undef,n,n)
fortin1:time
count=0
#testing = corr_upper[1][1]
foriinrange(n-1,1,step=-1)
forjinrange(n,i+1,step=-1)
aux[i,j]=corr_upper[d-count][t]
...
...
@@ -84,103 +83,161 @@ Given a vector where each entry evals[t] is a uwreal array of eigenvalues, this
The index t here runs from 1:T=lenght(evals), while the index i stands for the number of energy levels computed: i = length(evals[t])
It returns a vector array eff_en where each entry eff_en[t] contains the first N states energies as uwreal objects
"""
function energies(evals::Union{Vector{Vector{uwreal}},Array{Array{uwreal}}})
function energies(evals::Union{Vector{Vector{uwreal}},Array{Array{uwreal}}};wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing)
time=length(evals)
n=length(evals[1])
eff_en=Array{Array{uwreal}}(undef,n)
aux_en=Vector{uwreal}(undef,time-1)
foriin1:n
#aux_en = Vector{uwreal}(undef, time-1)
fortin1:time-1
ratio=evals[t][i]/evals[t+1][i]
aux_en[t]=0.5*log(ratio*ratio)
end
uwerr.(aux_en)
isnothing(wpm)?uwerr.(aux_en):uwerr.(aux_en,wpm)
eff_en[i]=copy(aux_en)
end
returneff_en
end
@docraw"""
uwgevp_tot(mat_list::Vector{Array}, tnot::Int64; iter = 30, evec = false)
Given a list of uwreal matrices and an integer value tnot, this method solves the generalised eigenvalue problem
for all the matrices in the list, using the same auxiliary matrix mat_list[tnot].
getall_eigvals(a::Vector{Matrix}, t0; iter=30 )
This function solves a GEVP problem, returning the eigenvalues, for a list of matrices, taking as generalised matrix the one
at index t0, i.e:
C(t_i)v_i = λ_i C(t_0) v_i, with i=1:lenght(a)
It takes as input:
- a::Vector{Matrix} : a vector of matrices
- t0::Int64 : idex value at which the fixed matrix is taken
- iter=30 : the number of iterations of the qr algorithm used to extract the eigenvalues
It returns:
- res = Vector{Vector{uwreal}}
where res[i] are the generalised eigenvalues of the i-th matrix of the input array.
Examples:
'''@example
mat_array = get_matrix(diag, upper_diag)
evals = getall_eigvals(mat_array, 5)
'''
"""
function getall_eigvals(a::Vector{Matrix},t0::Int64;iter=30)
n=length(a)
res=Vector{Vector{uwreal}}(undef,n)
[res[i]=uweigvals(a[i],a[t0])fori=1:n]
returnres
end
By default, it returns a vector evals where each entry evals[i] is a vector of uwreal containing the
generalised eigenvalues of the matrix mat_list[i].
@docraw"""
uweigvals(a::Matrix{uwreal}; iter = 30)
uweigvals(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30)
If evec is set to true, the methods returns also an array evecs where each entry evecs[i] is a matrix of uwreal.
The columns of such matrix are the eigenvectors associated with eigenvalues evals[i].
This function computes the eigenvalues of a matrix of uwreal objects.
If a second matrix b is given as input, it returns the generalised eigenvalues instead.
It takes as input:
- a::Matrix{uwreal} : a matrix of uwreal
- b::Matrix{uwreal} : a matrix of uwreal, optional
It returns:
- res = Vector{uwreal}: a vector where each elements is an eigenvalue
The keyword iter, set by default to 30, selects the number of iterations of the qr algorithm before stopping.
"""
function uwgevp_tot(mat_list::Vector{Matrix},tnot::Int64;iter::Int64=30,evec::Bool=false)