From b3e7cf335c4ff758791e054b993975d5bb457a3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 2 Jan 2019 16:36:23 +0100
Subject: [PATCH] Fix check for QZ eigenvalue criterium

The criterium was previously incorrectly applied to the square absolute value of
eigenvalues. Rather apply it to the absolute value itself (as done in
mjdgges.m and the AIM solver).

Closes #1632

(cherry picked from commit dcac79928921fc09315b06daadf25b767e000543)
---
 mex/sources/mjdgges/mjdgges.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mex/sources/mjdgges/mjdgges.c b/mex/sources/mjdgges/mjdgges.c
index dbe5464514..b07113177d 100644
--- a/mex/sources/mjdgges/mjdgges.c
+++ b/mex/sources/mjdgges/mjdgges.c
@@ -28,7 +28,7 @@ double criterium;
 lapack_int
 my_criteria(const double *alphar, const double *alphai, const double *beta)
 {
-  return ((*alphar **alphar + *alphai **alphai) < criterium **beta **beta);
+  return ((*alphar **alphar + *alphai **alphai) < criterium * criterium **beta **beta);
 }
 
 void
-- 
GitLab