Home > K25104 > LinearSystems > deflation_Householder_1.m

deflation_Householder_1

PURPOSE ^

Given an nxn matrix and eigenvector, performs deflation

SYNOPSIS ^

function [ D ] = deflation_Householder_1( A,v )

DESCRIPTION ^

 Given an nxn matrix and eigenvector, performs deflation 
   creating an nxn matrix which is similar to A. That is it has the 
   same eigenvalues as A. Householder reflections are used.
 Input arguments:
   A, square matrix
   v, eigenvector of A
 Output arguments:
   D, deflated matrix. If A is symmetric then D will also be symmetric.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ D ] = deflation_Householder_1( A,v )
0002 % Given an nxn matrix and eigenvector, performs deflation
0003 %   creating an nxn matrix which is similar to A. That is it has the
0004 %   same eigenvalues as A. Householder reflections are used.
0005 % Input arguments:
0006 %   A, square matrix
0007 %   v, eigenvector of A
0008 % Output arguments:
0009 %   D, deflated matrix. If A is symmetric then D will also be symmetric.
0010 
0011 [n,m]=size(A); % finding the size of A
0012 [p,q]=size(v); % finding the size of v
0013 if n~= m;
0014     error('input is not a square matrix');
0015 elseif q~=1 || p~=n;
0016     error('input dimensions do not agree');
0017 end
0018 
0019 u=v;                % initializing u to be v
0020 if v(1) == 0        % adjusting the first entry of u
0021     u(1) = u(1)+sqrt(v'*v);
0022 else
0023     u(1)=u(1)+sign(v(1))*sqrt(v'*v);    
0024 end
0025 H=eye(n)-2*(u*u')/(u'*u);   % creating householder transformation which
0026                             % maps v to a multiple of the first standard
0027                             % basis vector
0028 D=H*A*H;                    % generating deflated matrix
0029 
0030 end
0031 
0032

Generated on Mon 18-Jan-2016 10:25:49 by m2html © 2005