Problem with Upper Hessenberg Reduction

14 visualizzazioni (ultimi 30 giorni)
Daniela Valdés
Daniela Valdés il 31 Gen 2015
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 Commento
hemanth vemuluri
hemanth vemuluri il 9 Gen 2021
@Daniela Valdés I'm having the same problem, if you found the solution please do post it here.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by