function get_matrix(corr_diag::Vector{Array},corr_upper::Vector{Array})
time=length(corr_diag[1])# total time slices
n=length(corr_diag)# matrix dimension
d=length(corr_upper)# upper elements
res=Vector{Array}()# array with all the matrices at each time step.
fortin1:time
aux=Matrix{uwreal}(undef,n,n)
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]
aux[j,i]=corr_upper[d-count][t]
count+=1
end
aux[i,i]=corr_diag[i][t]
end
aux[n,n]=corr_diag[n][t]
push!(res,aux)
end
returnres
end
"""
energies(evals::Vector{Array})
Given a vector where each entry evals[t] is a uwreal array of eigenvalues, this method computes the effective energies of the first N states, where N=dim(evals[t]).
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
Given a matrix of uwreal variables, this function returns the Hessenberg form of the matrix.
"""
function hess_red(a::Matrix{uwreal})
n=size(a,1)
res=Matrix{uwreal}(undef,n,n)
res=a
forjin1:n-2
mi=idty(n)
mi_inv=idty(n)
forkinj+2:n
mi[k,j+1]=res[k,j]/res[j+1,j]
mi_inv[k,j+1]=-mi[k,j+1]
end
res=uwdot(mi_inv,uwdot(res,mi))
end
returnres
end
"""
upper_inversion(u::Matrix{uwreal})
This method uses backward propagation to compute the inverse of an upper triangular matrix u. Note that the inverse of u must be upper triangular as well.
Tests executed so far always confirmed this property.