From: Oluwa KuIse on 9 Apr 2010 09:20 Hi, How do I store the results of a vector in a matrix especially when the length of that vector changes at every step? I am solving the Householder QR factorization and need to store vk inside Qu. My algorithm is below: function [Qu, R] = houseqr(A) %This subroutine, houseqr, computes the QR factorization of A. %It takes as input, matrix A and gives Qu and R as output. Qu is %a matrix whose columns are Householder vectors u [m n] = size(A); % m is the number of rows of A and n its column Qu = zeros(size(A)); p = min(m-1,n); for k=1:p x = A(k:m,k); vk = sign(x(1))*norm(x(:,1)) + x; vk = vk/norm(vk); A(k:m,k:n) = A(k:m,k:n)- 2*vk*(vk'*A(k:m,k:n)); %Qu(m-k+1,k) = vk; %% THIS IS WHERE I'M HAVING PROBLEM!! end R = A; Thank you!
|
Pages: 1 Prev: Convert to Real Time Next: Contourf values specification |