From 5166b43addf7bc9a5b07c61dc0c26b151c5d63b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Thu, 17 May 2018 12:06:07 +0200 Subject: [PATCH 1/3] Fix case --- doc/dynare.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dynare.texi b/doc/dynare.texi index 8c2c7c469..eeed10843 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -380,7 +380,7 @@ Adjemian (Université du Maine, Gains and Cepremap), Houtan Bastani (Université du Maine, Gains and Cepremap), Junior Maih (Norges Bank), Ferhat Mihoubi (Université Paris-Est Créteil, Epee and Cepremap), George Perendia, Johannes Pfeifer (University of Cologne), Marco Ratto (European Commission, Joint Research Centre - JRC) -and Sébastien Villemot (CEPREMAP). +and Sébastien Villemot (Cepremap). Increasingly, the developer base is expanding, as tools developed by researchers outside of Cepremap are integrated into Dynare. Financial support is provided by Cepremap, Banque de France and DSGE-net (an From 02084ce3103b1c5c1223dd0ac20164ab60de4bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Thu, 17 May 2018 12:11:15 +0200 Subject: [PATCH 2/3] Remove qzcomplex Oct-file It's actually not needed. The QZ complex decomposition can be obtained in Octave on real matrices by casting them to the complex type. --- matlab/partial_information/PI_gensys.m | 8 +- mex/build/octave/Makefile.am | 2 +- mex/build/octave/configure.ac | 1 - mex/build/octave/qzcomplex/Makefile.am | 6 -- mex/sources/Makefile.am | 1 - mex/sources/qzcomplex/qzcomplex.cc | 122 ------------------------- 6 files changed, 3 insertions(+), 137 deletions(-) delete mode 100644 mex/build/octave/qzcomplex/Makefile.am delete mode 100644 mex/sources/qzcomplex/qzcomplex.cc diff --git a/matlab/partial_information/PI_gensys.m b/matlab/partial_information/PI_gensys.m index 589e39dc1..8e905b8ff 100644 --- a/matlab/partial_information/PI_gensys.m +++ b/matlab/partial_information/PI_gensys.m @@ -176,13 +176,9 @@ end G0pi=eye(n+FL_RANK+NX); try - % In Matlab: [aa bb q z v w] = qz(a,b) s.t. qaz = aa, qbz = bb % - % In Octave: [aa bb q z v w] = qz(a,b) s.t. q'az = aa, q'bz=bb % - % and qzcomplex() extension based on lapack zgges produces same - % qz output for Octave as Matlab qz() does for Matlab thus: if isoctave - [a b q z]=qzcomplex(G0pi,G1pi); - q=q'; + % Need to force QZ complex on Octave (otherwise it returns the real one) + [a b q z]=qz(complex(G0pi),complex(G1pi)); else [a b q z]=qz(G0pi,G1pi); end diff --git a/mex/build/octave/Makefile.am b/mex/build/octave/Makefile.am index 9544e0e52..64bb633ba 100644 --- a/mex/build/octave/Makefile.am +++ b/mex/build/octave/Makefile.am @@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I ../../../m4 # libdynare++ must come before gensylv, k_order_perturbation, dynare_simul_ if DO_SOMETHING -SUBDIRS = mjdgges kronecker bytecode libdynare++ gensylv qzcomplex block_kalman_filter sobol local_state_space_iterations +SUBDIRS = mjdgges kronecker bytecode libdynare++ gensylv block_kalman_filter sobol local_state_space_iterations if HAVE_MATIO SUBDIRS += k_order_perturbation dynare_simul_ diff --git a/mex/build/octave/configure.ac b/mex/build/octave/configure.ac index 8c664c6e2..d3661feb6 100755 --- a/mex/build/octave/configure.ac +++ b/mex/build/octave/configure.ac @@ -132,7 +132,6 @@ AC_CONFIG_FILES([Makefile gensylv/Makefile k_order_perturbation/Makefile dynare_simul_/Makefile - qzcomplex/Makefile kalman_steady_state/Makefile ms_sbvar/Makefile block_kalman_filter/Makefile diff --git a/mex/build/octave/qzcomplex/Makefile.am b/mex/build/octave/qzcomplex/Makefile.am deleted file mode 100644 index 252686edc..000000000 --- a/mex/build/octave/qzcomplex/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -EXEEXT = .oct -include ../mex.am - -mex_PROGRAMS = qzcomplex - -nodist_qzcomplex_SOURCES = $(top_srcdir)/../../sources/qzcomplex/qzcomplex.cc diff --git a/mex/sources/Makefile.am b/mex/sources/Makefile.am index 6f201c506..4d7007ee1 100644 --- a/mex/sources/Makefile.am +++ b/mex/sources/Makefile.am @@ -6,7 +6,6 @@ EXTRA_DIST = \ mjdgges \ kronecker \ bytecode \ - qzcomplex \ k_order_perturbation \ kalman_steady_state \ ms-sbvar \ diff --git a/mex/sources/qzcomplex/qzcomplex.cc b/mex/sources/qzcomplex/qzcomplex.cc deleted file mode 100644 index 74773fcdc..000000000 --- a/mex/sources/qzcomplex/qzcomplex.cc +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Oct-file for bringing the complex QZ decomposition to Octave. - * Simple wrapper around LAPACK's zgges. - * - * Written by Sébastien Villemot . - */ - -/* - * Copyright (C) 2010-2017 Dynare Team - * - * This file is part of Dynare. - * - * Dynare is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Dynare is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Dynare. If not, see . - */ - -#ifdef __MINGW32__ -# define __CROSS_COMPILATION__ -#endif - -#ifdef __MINGW64__ -# define __CROSS_COMPILATION__ -#endif - -#ifdef __CROSS_COMPILATION__ -# define M_PI 3.14159265358979323846 -#endif - -#include -#include - -extern "C" -{ - F77_RET_T - F77_FUNC(zgges, ZGGES) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - octave_idx_type (*)(Complex *, Complex *), const octave_idx_type &, - Complex *, const octave_idx_type &, Complex *, const octave_idx_type &, - octave_idx_type &, Complex *, Complex *, Complex *, const octave_idx_type &, - Complex *, const octave_idx_type &, Complex *, const octave_idx_type &, - double *, octave_idx_type *, octave_idx_type &); -} - -DEFUN_DLD(qzcomplex, args, nargout, "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} [ @var{aa}, @var{bb}, @var{q}, @var{z} ] = qzcomplex (@var{a}, @var{b})\n\ -\n\ -Computes the complex QZ decomposition of @math{(A, B)}, satisfying:\n\ -@example\n\ - AA = Q'*A*Z, BB = Q'*B*Z\n\ -@end example\n\ -@end deftypefn\n\ -") -{ - int nargin = args.length(); - octave_value_list retval; - - if (nargin != 2 || nargout != 4) - { - print_usage(); - return retval; - } - - ComplexMatrix A = args(0).complex_matrix_value(); - ComplexMatrix B = args(1).complex_matrix_value(); - if (error_state) - return retval; - - dim_vector dimA = A.dims(); - dim_vector dimB = B.dims(); - octave_idx_type n = dimA(0); - if (n != dimA(1) || n != dimB(0) || n != dimB(1)) - { - error("qzcomplex: input matrices must be square and of same size"); - return retval; - } - - octave_idx_type lwork = 2*n; - OCTAVE_LOCAL_BUFFER(Complex, alpha, n); - OCTAVE_LOCAL_BUFFER(Complex, beta, n); - OCTAVE_LOCAL_BUFFER(Complex, work, lwork); - OCTAVE_LOCAL_BUFFER(double, rwork, 8*n); - ComplexMatrix vsl(n, n), vsr(n, n); - octave_idx_type sdim, info; - - F77_XFCN(zgges, ZGGES, (F77_CONST_CHAR_ARG("V"), F77_CONST_CHAR_ARG("V"), - F77_CONST_CHAR_ARG("N"), NULL, - n, A.fortran_vec(), n, B.fortran_vec(), n, sdim, - alpha, beta, vsl.fortran_vec(), n, vsr.fortran_vec(), n, - work, lwork, rwork, NULL, info)); - - if (info != 0) - { - error("qzcomplex: zgges failed"); - return retval; - } - - retval(0) = octave_value(A); - retval(1) = octave_value(B); - retval(2) = octave_value(vsl); - retval(3) = octave_value(vsr); - return retval; -} - -/* - - %!test - %! A = [ 1 2 3+1i; 4 5-1i 0; -1 -5 3]; - %! B = [ -2 -8i 4; 1 5+3i 5; 7 -10 -2]; - %! [AA,BB,Q,Z] = qzcomplex(A,B); - %! assert(Q'*A*Z, AA, sqrt(eps)) - %! assert(Q'*B*Z, BB, sqrt(eps)) - -*/ From 902a52b52108d654304317b6407343d0cdff15db Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Thu, 17 May 2018 16:54:17 +0200 Subject: [PATCH 3/3] preprocessor submodule update --- preprocessor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preprocessor b/preprocessor index 1ba023e37..dd8b05e2f 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 1ba023e37d6ee7fc8d393840e42a4542274efbb7 +Subproject commit dd8b05e2f00bb8ad3ef88d28c922760676f760b0