From 8f738f101f3024902f576d623393899d45ec8fd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 15 Jan 2019 13:58:00 +0100
Subject: [PATCH] Dynare++: 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 now done in
Dynare).

Ref #1632

(manually cherry picked from commit 8ebcd7cae6c9b403327601905d5ab19e539538d4)
---
 dynare++/kord/first_order.cweb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dynare++/kord/first_order.cweb b/dynare++/kord/first_order.cweb
index e3b9153ec6..099708e6bd 100644
--- a/dynare++/kord/first_order.cweb
+++ b/dynare++/kord/first_order.cweb
@@ -22,7 +22,7 @@ to select (return true) the pairs for which $\alpha<\beta$.
 @<|order_eigs| function code@>=
 lapack_int order_eigs(const double* alphar, const double* alphai, const double* beta)
 {
-	return (*alphar * *alphar + *alphai * *alphai < *beta * *beta * qz_criterium);
+	return (*alphar * *alphar + *alphai * *alphai < *beta * *beta * qz_criterium * qz_criterium);
 }
 
 
-- 
GitLab