Commit db2615a4 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Use economy-size decomposition option of qr2 routine.

parent af23d72c
...@@ -22,7 +22,7 @@ for n=1:niters ...@@ -22,7 +22,7 @@ for n=1:niters
diffs = bsxfun(@minus,X,StateMu(:,j)); diffs = bsxfun(@minus,X,StateMu(:,j));
tpost = (1/sqrt(new_pr(j)))*sqrt(posterior(j,:)); tpost = (1/sqrt(new_pr(j)))*sqrt(posterior(j,:));
diffs = bsxfun(@times,diffs,tpost); diffs = bsxfun(@times,diffs,tpost);
[foo,tcov] = qr2(diffs') ; [foo,tcov] = qr2(diffs',0);
StateSqrtP(:,:,j) = tcov'; StateSqrtP(:,:,j) = tcov';
if check if check
if min(abs(diag(StateSqrtP(:,:,j)))) < MIN_COVAR_SQRT if min(abs(diag(StateSqrtP(:,:,j)))) < MIN_COVAR_SQRT
......
...@@ -100,7 +100,7 @@ if strcmpi(DynareOptions.particle.IS_approximation_method,'cubature') || strcmpi ...@@ -100,7 +100,7 @@ if strcmpi(DynareOptions.particle.IS_approximation_method,'cubature') || strcmpi
dObserved = bsxfun(@minus,tmp(mf1,:),PredictedObservedMean)'.*sqrt(weights); dObserved = bsxfun(@minus,tmp(mf1,:),PredictedObservedMean)'.*sqrt(weights);
PredictedStateVarianceSquareRoot = chol(dState'*dState)'; PredictedStateVarianceSquareRoot = chol(dState'*dState)';
big_mat = [dObserved dState ; [H_lower_triangular_cholesky zeros(number_of_observed_variables,number_of_state_variables)] ] ; big_mat = [dObserved dState ; [H_lower_triangular_cholesky zeros(number_of_observed_variables,number_of_state_variables)] ] ;
[mat1,mat] = qr2(big_mat) ; [mat1,mat] = qr2(big_mat,0) ;
mat = mat' ; mat = mat' ;
clear('mat1'); clear('mat1');
PredictedObservedVarianceSquareRoot = mat(1:number_of_observed_variables,1:number_of_observed_variables) ; PredictedObservedVarianceSquareRoot = mat(1:number_of_observed_variables,1:number_of_observed_variables) ;
......
...@@ -107,7 +107,7 @@ if strcmpi(DynareOptions.particle.IS_approximation_method,'cubature') ...@@ -107,7 +107,7 @@ if strcmpi(DynareOptions.particle.IS_approximation_method,'cubature')
dObserved = (bsxfun(@minus,tmp(mf1,:),PredictedObservedMean)').*sqrt(weights3); dObserved = (bsxfun(@minus,tmp(mf1,:),PredictedObservedMean)').*sqrt(weights3);
PredictedStateVariance = dState'*dState; PredictedStateVariance = dState'*dState;
big_mat = [dObserved dState ; [H_lower_triangular_cholesky zeros(number_of_observed_variables,number_of_state_variables)] ] ; big_mat = [dObserved dState ; [H_lower_triangular_cholesky zeros(number_of_observed_variables,number_of_state_variables)] ] ;
[mat1,mat] = qr2(big_mat) ; [mat1,mat] = qr2(big_mat,0) ;
mat = mat' ; mat = mat' ;
clear('mat1'); clear('mat1');
PredictedObservedVarianceSquareRoot = mat(1:number_of_observed_variables,1:number_of_observed_variables) ; PredictedObservedVarianceSquareRoot = mat(1:number_of_observed_variables,1:number_of_observed_variables) ;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment