From 3dd1ffb8fe8ae50b3f4ec67c3996f54069444f48 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Thu, 7 Sep 2023 16:06:52 +0200
Subject: [PATCH] pruned_state_space_system.m: gracefully exit in case of unit
 roots

---
 matlab/pruned_state_space_system.m | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/matlab/pruned_state_space_system.m b/matlab/pruned_state_space_system.m
index 9c9005b409..bb408bf3f4 100644
--- a/matlab/pruned_state_space_system.m
+++ b/matlab/pruned_state_space_system.m
@@ -370,6 +370,9 @@ lyapunov_symm_method = 1; %method=1 to initialize persistent variables
 %find stationary vars
 stationary_vars = (1:y_nbr)';
 if ~isempty(Schur_u)
+    if order>1
+        error('pruned_state_space_system: the pruned state space currently does not support unit roots at higher order.')
+    end
     %base this only on first order, because if first-order is stable so are the higher-order pruned systems
     x = abs(gx*Schur_u);
     stationary_vars = find(all(x < options.schur_vec_tol,2));
-- 
GitLab