qr2.m was missing !

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1158 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
adjemian 2007-01-22 13:40:05 +00:00
parent bcedf81d59
commit bc90be074a
1 changed files with 11 additions and 0 deletions

11
matlab/qr2.m Normal file
View File

@ -0,0 +1,11 @@
function [Q,R] = qr2(X)
% stephane.adjemian@ens.fr [12-07-2005]
%
% This routine performs a qr decomposition of matrix X such that the
% diagonal scalars of the upper-triangular matrix R are positive.
[Q,R] = qr(X);
indx = find(diag(R)<0);
if ~isempty(indx)
Q(:,indx) = -Q(:,indx);
R(indx,:) = -R(indx,:);
end