Commit 22064ee5 authored by Alessandro 's avatar Alessandro Committed by Javier

small corrections (gevp analysis) and uwdot product updated (juobs_linalg)

parent 6fee4fe3
...@@ -100,7 +100,6 @@ function comp_mat(tot11::Array{Array{juobs.Corr}}, tot12::Array{Array{juobs.Corr ...@@ -100,7 +100,6 @@ function comp_mat(tot11::Array{Array{juobs.Corr}}, tot12::Array{Array{juobs.Corr
mu = getfield.(tot11[1],:mu) mu = getfield.(tot11[1],:mu)
res = Array{infoMatt}(undef, length(mu)) res = Array{infoMatt}(undef, length(mu))
for i = 1:length(mu) for i = 1:length(mu)
println("tot11 size is ", size(tot11,1), " the type is ", typeof(tot11))
a11 = [ tot11[j][i] for j = 1:size(tot11,1) ] a11 = [ tot11[j][i] for j = 1:size(tot11,1) ]
a12 = [ tot12[j][i] for j = 1:size(tot12,1) ] a12 = [ tot12[j][i] for j = 1:size(tot12,1) ]
a22 = [ tot22[j][i] for j = 1:size(tot22,1) ] a22 = [ tot22[j][i] for j = 1:size(tot22,1) ]
...@@ -109,16 +108,27 @@ function comp_mat(tot11::Array{Array{juobs.Corr}}, tot12::Array{Array{juobs.Corr ...@@ -109,16 +108,27 @@ function comp_mat(tot11::Array{Array{juobs.Corr}}, tot12::Array{Array{juobs.Corr
end end
return res return res
end end
function comp_energy(tot11::Array{Array{juobs.Corr}}, tot12::Array{Array{juobs.Corr}}, tot22::Array{Array{juobs.Corr}}) function comp_energy(tot11::Array{Array{juobs.Corr}}, tot12::Array{Array{juobs.Corr}}, tot22::Array{Array{juobs.Corr}}, evec::Bool=false)
aux_mat = comp_mat(tot11, tot12, tot22) aux_mat = comp_mat(tot11, tot12, tot22)
y0 = getfield(aux_mat[1], :y0) y0 = getfield(aux_mat[1], :y0)
res_en = Array{infoEn}(undef, length(aux_mat)) res_en = Array{infoEn}(undef, length(aux_mat))
for i = 1:length(aux_mat) if !evec
mat_obs = getfield(aux_mat[i], :mat)[y0:end-1] for i = 1:length(aux_mat)
evalues = uwgevp_tot(mat_obs, 5) mat_obs = getfield(aux_mat[i], :mat)[y0:end-1]
res_en[i] = infoEn(energies(evalues), aux_mat[i]) evalues = uwgevp_tot(mat_obs, 5)
res_en[i] = infoEn(energies(evalues), aux_mat[i])
end
return res_en
else
evec = Array{Array{}}(undef, length(aux_mat))
for i = 1:length(aux_mat)
mat_obs = getfield(aux_mat[i], :mat)[y0:end-1]
evalues, eigvec = uwgevp_tot(mat_obs, 5, evec=true)
res_en[i] = infoEn(energies(evalues), aux_mat[i])
evec[i] = eigvec
end
return res_en, evec
end end
return res_en
end end
mutable struct infoEn mutable struct infoEn
en_val::Array{Array{uwreal}} en_val::Array{Array{uwreal}}
...@@ -130,4 +140,30 @@ mutable struct infoEn ...@@ -130,4 +140,30 @@ mutable struct infoEn
y0 = getfield(matr,:y0) y0 = getfield(matr,:y0)
new(en_val, mu, y0) new(en_val, mu, y0)
end end
end
function pseudo_mat_elem(evec::Array{Array{T,2} where T,1}, ppcorr::Array{uwreal,1}, mass::uwreal)
Rn = [ (uwdot(evec[i][:,1], uwdot(ppcorr[97+i], evec[i][:,1])))^(0.5) * exp(mass*i/2) for i=1:length(evec)-2]
return Rn
end
function extract_dec_const(mat_elem::uwreal, mass::uwreal, mu::Array{Float64})
return sqrt(2)*sum(mu)*mat_elem / mass^1.5
end
function vec_mat_elem(evec::Array{Array{T,2} where T,1}, akakcorr::Array{uwreal,1},gevpmat::Array{Array{T,2} where T,1}, mass::uwreal )
Rn = [ (uwdot(evec[i][:,2], uwdot(akakcorr[97+i]/3, evec[i][:,2]))^2)^(-0.25) * exp(mass*i/2) for i=1:length(evec)-2]
aux = vec([ uwdot(evec[i][:,2], gevpmat[97+i][:,2]/3) for i =1:length(evec)-2])
return Rn.*aux
end
function match_muc(muh, m_lh, m_lh_star, target)
M = (m_lh .+ 3 .* m_lh_star) ./ 4
par, chi2exp = lin_fit(muh, M)
muh_target = x_lin_fit(par, target)
return muh_target
end
function match_muc(muh, m_lh, m_sh, m_lh_star, m_sh_star, target)
M = (2 .* m_lh .+ 6 .* m_lh_star .+ m_sh .+ 3 .* m_sh_star) ./ 12
par, chi2exp = lin_fit(muh, M)
muh_target = x_lin_fit(par, target)
return muh_target
end end
\ No newline at end of file
...@@ -370,6 +370,8 @@ of uwreal data type. ...@@ -370,6 +370,8 @@ of uwreal data type.
uwdot(a::Vector{uwreal}, b::Vector{uwreal}) = sum(a .* b) uwdot(a::Vector{uwreal}, b::Vector{uwreal}) = sum(a .* b)
uwdot(a::Vector{uwreal}, b::uwreal) = [a[i] * b for i=1:length(a)] uwdot(a::Vector{uwreal}, b::uwreal) = [a[i] * b for i=1:length(a)]
uwdot(a::uwreal, b::Vector{uwreal}) = uwdot(b,a) uwdot(a::uwreal, b::Vector{uwreal}) = uwdot(b,a)
uwdot(a::Matrix{uwreal}, b::Vector{uwreal}) = uwdot(a, reshape(b,(length(b),1)))
uwdot(a::Vector{uwreal}, b::Matrix{uwreal}) = uwdot(reshape(a,(1,length(a))), b)
function uwdot(a::Matrix{uwreal}, b::Matrix{uwreal}) function uwdot(a::Matrix{uwreal}, b::Matrix{uwreal})
n,m = size(a) n,m = size(a)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment