diff --git a/matlab/lyapunov_solver.m b/matlab/lyapunov_solver.m index be39d0d41e8289fbb3d3d638b9341735e4fc90a6..80f7cde875f16d010ac85aecd74038eb93ed538f 100644 --- a/matlab/lyapunov_solver.m +++ b/matlab/lyapunov_solver.m @@ -66,7 +66,7 @@ else end %@test:1 -%$ t = NaN(10,1); +%$ t = NaN(13,1); %$ options_.lyapunov_complex_threshold = 1e-15; %$ options_.qz_zero_threshold = 1e-6; %$ options_.qz_criterium=1-options_.qz_zero_threshold; @@ -136,51 +136,72 @@ end %$ t(4) = 0; %$ end %$ +%$ % Standard with sparse matrix +%$ try +%$ Pstar5_small = lyapunov_solver(sparse(T_small),sparse(R_small),sparse(Q_small),options_); +%$ Pstar5_large = lyapunov_solver(sparse(T_large),sparse(R_large),sparse(Q_large),options_); +%$ t(5) = 1; +%$ catch +%$ t(5) = 0; +%$ end +%$ %$ % Test the results. %$ %$ if max(max(abs(Pstar1_small-Pstar2_small)))>1e-8 -%$ t(5) = 0; +%$ t(6) = 0; %$ else -%$ t(5) = 1; +%$ t(6) = 1; %$ end %$ %$ if (isoctave && user_has_octave_forge_package('control')) || (~isoctave && user_has_matlab_license('control_toolbox')) %$ if max(max(abs(Pstar1_small-Pstar3_small)))>1e-8 -%$ t(6) = 0; +%$ t(7) = 0; %$ else -%$ t(6) = 1; +%$ t(7) = 1; %$ end %$ else -%$ t(6) = 1; +%$ t(7) = 1; %$ end %$ %$ if max(max(abs(Pstar1_small-Pstar4_small)))>1e-8 -%$ t(7) = 0; +%$ t(8) = 0; %$ else -%$ t(7) = 1; +%$ t(8) = 1; %$ end %$ +%$ if max(max(abs(Pstar1_small-Pstar5_small)))>1e-8 +%$ t(9) = 0; +%$ else +%$ t(9) = 1; +%$ end +%$ %$ if max(max(abs(Pstar1_large-Pstar2_large)))>2e-8 -%$ t(8) = 0; +%$ t(10) = 0; %$ else -%$ t(8) = 1; +%$ t(10) = 1; %$ end %$ %$ if (isoctave && user_has_octave_forge_package('control')) || (~isoctave && user_has_matlab_license('control_toolbox')) %$ if max(max(abs(Pstar1_large-Pstar3_large)))>1e-8 -%$ t(9) = 0; +%$ t(11) = 0; %$ else -%$ t(9) = 1; +%$ t(11) = 1; %$ end %$ else -%$ t(9) = 1; +%$ t(11) = 1; %$ end %$ %$ if max(max(abs(Pstar1_large-Pstar4_large)))>2e-8 -%$ t(10) = 0; +%$ t(12) = 0; %$ else -%$ t(10) = 1; +%$ t(12) = 1; %$ end %$ +%$ if max(max(abs(Pstar1_large-Pstar5_large)))>2e-8 +%$ t(13) = 0; +%$ else +%$ t(13) = 1; +%$ end +%$ %$ T = all(t); %@eof:1 diff --git a/matlab/lyapunov_symm.m b/matlab/lyapunov_symm.m index e05df0b01a7ae3fff2cb2ce39538e0e250b9062d..10b6ff1ae9eb5c0117f2d74a90a794a18344b8fe 100644 --- a/matlab/lyapunov_symm.m +++ b/matlab/lyapunov_symm.m @@ -108,7 +108,7 @@ if size(a,1) == 1 end if method<2 - [U,T] = schur(a); + [U,T] = schur(full(a)); e1 = abs(ordeig(T)) > 2-qz_criterium; k = sum(e1); % Number of unit roots. n = length(e1)-k; % Number of stationary variables.