Problem with Upper Hessenberg Reduction

3 views (last 30 days)
Hello. I'm having trouble with the algorithm of the reduction to the Upper Hessenberg form through Householder reflections. Here it's what I have so far:
function [Q,H]=Hessenbergsup(A,p)
[m,n]=size(A)
Q=eye(n)
if m!=n
disp("A isn't a square matrix")
else
if p==1 # Householder Reflections
H=A
for k=1:(n-2)
x=H((k+1):n,k)
u=((sign(x(1)))*(norm(x,2))*eye((n-k),k)) + x
u=u/((norm(u,2))^2)
H(k+1:n,k:n)=H(k+1:n,k:n)-2*u*((u')*(H(k+1:n,k:n)))
H(1:n,(k+1):n)=H(1:n,(k+1):n)-2*((H(1:n,(k+1):n))*u)*(u')
Q(1:n,(k+1):n)=Q(1:n,(k+1):n)-2*((Q(1:n,(k+1):n))*u)*(u')
endfor
endif
if p==2 # Arnoldi Iterations (not done yet)
endif
endif
end
The thing is, the function works, but it doesn't give me the Upper Hessenberg form.
  1 Comment
hemanth vemuluri
hemanth vemuluri on 9 Jan 2021
@Daniela Valdés I'm having the same problem, if you found the solution please do post it here.

Sign in to comment.

Answers (0)

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!