Commit 47cbbe0d authored by Alessandro 's avatar Alessandro

small bug fixed (linalg)

parent 0efabd0b
......@@ -60,8 +60,8 @@ function get_matrix(corr_diag::Vector{Vector{uwreal}}, corr_upper::Vector{Vector
return nothing
end
res = Vector{Matrix}(undef, time) # array with all the matrices at each time step.
aux = Matrix{uwreal}(undef, n, n)
for t in 1:time
aux = Matrix{uwreal}(undef, n, n)
count=0
#testing = corr_upper[1][1]
for i in range(n-1,1, step=-1)
......@@ -89,13 +89,14 @@ function energies(evals::Vector{Vector{uwreal}})
time = length(evals)
n = length(evals[1])
eff_en = Vector{Vector}(undef, n)
aux_en = Vector{uwreal}(undef, time-1)
#aux_en = Vector{uwreal}(undef, time-1)
for i in 1:n
aux_en = Vector{uwreal}(undef, time-1)
for t in 1:time-1
ratio = evals[t][i] / evals[t+1][i]
aux_en[t] = log(sqrt(ratio * ratio))
end
#uwerr.(aux_en)
uwerr.(aux_en)
eff_en[i] = aux_en
end
return eff_en
......@@ -115,7 +116,7 @@ The columns of such matrix are the eigenvectors associated with eigenvalues eval
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{Array{uwreal, 2}}, tnot::Int64; iter::Int64 = 30, evec::Bool = false)
function uwgevp_tot(mat_list::Vector{Matrix}, tnot::Int64; iter::Int64 = 30, evec::Bool = false)
if !evec
aux_evals = uwgevp.(mat_list, c_tnot=mat_list[tnot], iter = iter)
evals = get_diag.(aux_evals)
......@@ -244,7 +245,7 @@ function make_householder(a::Vector{uwreal})
end
v[1] = uwreal(1.0)
H = idty(n)
H = H - (2.0 / uwdot(v,v)) * uwdot(v, v)
H = H - (2.0 / uwdot(v,v)) * uwdot(reshape(v, :,1), transpose(v)) #this last term is a vector product
#H = H - (2.0 / dot(value.(v),value.(v))) * uwdot(reshape(v, :,1), reshape(v, 1 ,:))
for i in 1:n
for j in 1:n
......@@ -382,7 +383,7 @@ function uwnorm(a::Vector{uwreal})
end
"""
Return the transpose of a matrix of uwreals
Return the transpose of a matrix or vector of uwreals
"""
function transpose(a::Matrix{uwreal})
res = similar(a)
......@@ -398,6 +399,10 @@ function transpose(a::Matrix{uwreal})
res[n,n] = a[n,n]
return res
end
function transpose(vec::Vector{uwreal})
res = deepcopy(vec)
return reshape(res,1,:)
end
"""
uwcopysign(a::uwreal, b::uwreal)
......@@ -432,7 +437,7 @@ end
# operator overloading
#=
"""
Base.:*(x::uwreal, y::Matrix{uwreal})
......@@ -451,4 +456,3 @@ function Base.:*(x::uwreal, y::Matrix{uwreal})
end
return res
end
=#
\ No newline at end of file
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