Commit 3c0f634e authored by Alessandro 's avatar Alessandro

trying to understand how to propagate errors

parent f3b82863
...@@ -23,7 +23,6 @@ for op in (:eigvals, :eigvecs) ...@@ -23,7 +23,6 @@ for op in (:eigvals, :eigvecs)
end end
end end
##
@doc raw""" @doc raw"""
get_matrix(corr_diag::Vector{Array}, corr_upper::Vector{Array} ) get_matrix(corr_diag::Vector{Array}, corr_upper::Vector{Array} )
...@@ -191,7 +190,7 @@ function uweigvals(a::Matrix{uwreal}; iter = 30) ...@@ -191,7 +190,7 @@ function uweigvals(a::Matrix{uwreal}; iter = 30)
q_k, r_k = qr(a) q_k, r_k = qr(a)
a = uwdot(r_k, q_k) a = uwdot(r_k, q_k)
end end
return a#get_diag(a) return get_diag(a)
end end
function uweigvals(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30) function uweigvals(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30)
c = uwdot(invert(b), a) c = uwdot(invert(b), a)
...@@ -200,10 +199,9 @@ function uweigvals(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30) ...@@ -200,10 +199,9 @@ function uweigvals(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30)
q_k, r_k = qr(c) q_k, r_k = qr(c)
c = uwdot(r_k, q_k) c = uwdot(r_k, q_k)
end end
return c#get_diag(c) return get_diag(c)
end end
function uweigvecs(a::Matrix{uwreal}; iter = 30) function uweigvecs(a::Matrix{uwreal}; iter = 30)
n = size(a,1) n = size(a,1)
u = idty(n) u = idty(n)
...@@ -225,11 +223,12 @@ function uweigvecs(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30) ...@@ -225,11 +223,12 @@ function uweigvecs(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30)
end end
return u return u
end end
function uweigen(a::Matrix{uwreal}; iter = 30) function uweigen(a::Matrix{uwreal}; iter = 30)
return uweigvals(a, iter=iter), uweigvecs(a, iter=iter) return uweigvals(a, iter=iter), uweigvecs(a, iter=iter)
end end
function uweigen(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30) function uweigen(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30)
return uweigvals(a,b, iter=iter), uweigvecs(a,b, iter=iter) return uweigvals(a, b, iter=iter), uweigvecs(a, b, iter=iter)
end end
function norm_evec(evec::Matrix{uwreal}, ctnot::Matrix{uwreal}) function norm_evec(evec::Matrix{uwreal}, ctnot::Matrix{uwreal})
...@@ -249,6 +248,14 @@ function get_diag(a::Matrix{uwreal}) ...@@ -249,6 +248,14 @@ function get_diag(a::Matrix{uwreal})
res = [a[k, k] for k = 1:n] res = [a[k, k] for k = 1:n]
return res return res
end end
function get_diag(v::Vector{uwreal})
n = length(v)
res = idty(n)
for i =1:n
res[i,i] = v[i]
end
return res
end
""" """
......
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