From abc60b603751b03de0acdd0c7be3bd287e4bcda8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 20 Apr 2012 21:37:29 +0200 Subject: [PATCH] Test if control toolbox is present if lyapunov=square_root_solver --- matlab/lyapunov_symm.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/matlab/lyapunov_symm.m b/matlab/lyapunov_symm.m index 186379c86..93913d335 100644 --- a/matlab/lyapunov_symm.m +++ b/matlab/lyapunov_symm.m @@ -85,7 +85,15 @@ if method == 3 end; elseif method == 4 % works only with Matlab System Control toolbox or octave the control package, - % the presence of the toolbox or package has to be tested + if exist('OCTAVE_VERSION') + if ~user_has_octave_forge_package('control') + error('lyapunov=square_root_solver not available; you must install the control package from Octave Forge') + end + else + if ~user_has_matlab_license('control_toolbox') + error('lyapunov=square_root_solver not available; you must install the control system toolbox') + end + end chol_b = R*chol(b,'lower'); Rx = dlyapchol(a,chol_b); x = Rx' * Rx;