From 1443f112bb37fd51337cc92926c5d12fa46fa347 Mon Sep 17 00:00:00 2001 From: sebastien Date: Fri, 2 Oct 2009 10:23:49 +0000 Subject: [PATCH] * Added back korderpert DLL to build system * Fixes to Dynare++ for special LAPACK/BLAS integers in MATLAB * Fixes to korderpert DLL for cross-platform compatibility git-svn-id: https://www.dynare.org/svn/dynare/trunk@3009 ac1d8469-bf42-47a9-8791-bf33cf982152 --- configure.ac | 5 +- dynare++/integ/cc/vector_function.cweb | 4 +- dynare++/kord/decision_rule.cweb | 4 +- dynare++/kord/first_order.cweb | 17 ++-- dynare++/kord/korder.cweb | 16 ++- dynare++/kord/korder.hweb | 6 +- dynare++/src/Makefile.am | 2 +- dynare++/sylv/cc/GeneralMatrix.cpp | 2 +- dynare++/sylv/cc/SymSchurDecomp.cpp | 26 ++--- mex/build/Makefile.am | 5 +- mex/build/korderpert.am | 99 ++++++++++++++----- mex/build/korderpert/tests/Makefile.am | 19 ++-- mex/sources/korderpert/dynamic_dll.cpp | 8 +- mex/sources/korderpert/dynamic_dll.h | 10 +- mex/sources/korderpert/k_ord_dynare.cpp | 2 +- .../korderpert/k_order_perturbation.cpp | 2 +- .../korderpert/tests/k_order_test_main.cpp | 2 +- 17 files changed, 139 insertions(+), 90 deletions(-) diff --git a/configure.ac b/configure.ac index 3cf015c7a..37665cfc9 100644 --- a/configure.ac +++ b/configure.ac @@ -61,8 +61,9 @@ CPPFLAGS="$CPPFLAGS_SAVED" # Don't use deprecated hash structures AC_DEFINE([BOOST_NO_HASH]) -# Libtool test for dlopen, disabled for the moment -#LT_LIB_DLLOAD +# Check for dlopen(), needed by korderpert DLL +AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], []) +AC_SUBST([LIBADD_DLOPEN]) AC_CHECK_PROG([PDFTEX], [pdftex], [pdftex]) AM_CONDITIONAL([HAVE_PDFTEX], [test "x$PDFTEX" != "x"]) diff --git a/dynare++/integ/cc/vector_function.cweb b/dynare++/integ/cc/vector_function.cweb index aa9496dba..115da67bf 100644 --- a/dynare++/integ/cc/vector_function.cweb +++ b/dynare++/integ/cc/vector_function.cweb @@ -164,12 +164,12 @@ void GaussConverterFunction::calcCholeskyFactor(const GeneralMatrix& vcov) { A = vcov; - int rows = A.numRows(); + lapack_int rows = A.numRows(); for (int i = 0; i < rows; i++) for (int j = i+1; j < rows; j++) A.get(i,j) = 0.0; - int info; + lapack_int info; dpotrf("L", &rows, A.base(), &rows, &info); // todo: raise if |info!=1| } diff --git a/dynare++/kord/decision_rule.cweb b/dynare++/kord/decision_rule.cweb index d9125fae9..a4a4f59e1 100644 --- a/dynare++/kord/decision_rule.cweb +++ b/dynare++/kord/decision_rule.cweb @@ -604,11 +604,11 @@ not work for semidefinite matrices. void RandomShockRealization::choleskyFactor(const TwoDMatrix& v) { factor = v; - int rows = factor.nrows(); + lapack_int rows = factor.nrows(); for (int i = 0; i < rows; i++) for (int j = i+1; j < rows; j++) factor.get(i,j) = 0.0; - int info; + lapack_int info; dpotrf("L", &rows, factor.base(), &rows, &info); KORD_RAISE_IF(info != 0, diff --git a/dynare++/kord/first_order.cweb b/dynare++/kord/first_order.cweb index a925aeccf..10bdf4020 100644 --- a/dynare++/kord/first_order.cweb +++ b/dynare++/kord/first_order.cweb @@ -20,7 +20,7 @@ double qz_criterium = 1.000001; to select (return true) the pairs for which $\alpha<\beta$. @<|order_eigs| function code@>= -int order_eigs(const double* alphar, const double* alphai, const double* beta) +lapack_int order_eigs(const double* alphar, const double* alphai, const double* beta) { return (*alphar * *alphar + *alphai * *alphai < *beta * *beta * qz_criterium); } @@ -165,7 +165,7 @@ the same. The difference is only numerical error. @ @
= - int n = ypart.ny()+ypart.nboth; + lapack_int n = ypart.ny()+ypart.nboth; TwoDMatrix matD(n, n); matD.zeros(); matD.place(fypzero, 0, 0); @@ -189,15 +189,18 @@ the same. The difference is only numerical error. @= TwoDMatrix vsl(n, n); TwoDMatrix vsr(n, n); - int lwork = 100*n+16; + lapack_int lwork = 100*n+16; Vector work(lwork); - IntSequence bwork(n); - int info; + lapack_int *bwork = new lapack_int[n]; + lapack_int info; + lapack_int sdim2 = sdim; dgges("N", "V", "S", order_eigs, &n, matE.getData().base(), &n, - matD.getData().base(), &n, &sdim, alphar.base(), alphai.base(), + matD.getData().base(), &n, &sdim2, alphar.base(), alphai.base(), beta.base(), vsl.getData().base(), &n, vsr.getData().base(), &n, - work.base(), &lwork, &(bwork[0]), &info); + work.base(), &lwork, bwork, &info); + sdim = sdim2; bk_cond = (sdim == ypart.nys()); + delete[] bwork; @ Here we setup submatrices of the matrix $Z$. diff --git a/dynare++/kord/korder.cweb b/dynare++/kord/korder.cweb index 2bbb00651..ce5684143 100644 --- a/dynare++/kord/korder.cweb +++ b/dynare++/kord/korder.cweb @@ -8,8 +8,6 @@ #include "kord_exception.h" #include "korder.h" -#include - @<|PLUMatrix| copy constructor@>; @<|PLUMatrix::calcPLU| code@>; @<|PLUMatrix::multInv| code@>; @@ -24,9 +22,9 @@ @ @<|PLUMatrix| copy constructor@>= PLUMatrix::PLUMatrix(const PLUMatrix& plu) - : TwoDMatrix(plu), inv(plu.inv), ipiv(new int[nrows()]) + : TwoDMatrix(plu), inv(plu.inv), ipiv(new lapack_int[nrows()]) { - memcpy(ipiv, plu.ipiv, nrows()*sizeof(int)); + memcpy(ipiv, plu.ipiv, nrows()*sizeof(lapack_int)); } @@ -37,8 +35,8 @@ the end of their constructors. @<|PLUMatrix::calcPLU| code@>= void PLUMatrix::calcPLU() { - int info; - int rows = nrows(); + lapack_int info; + lapack_int rows = nrows(); inv = (const Vector&)getData(); dgetrf(&rows, &rows, inv.base(), &rows, ipiv, &info); } @@ -50,9 +48,9 @@ void PLUMatrix::multInv(TwoDMatrix& m) const { KORD_RAISE_IF(m.nrows() != ncols(), "The matrix is not square in PLUMatrix::multInv"); - int info; - int mcols = m.ncols(); - int mrows = m.nrows(); + lapack_int info; + lapack_int mcols = m.ncols(); + lapack_int mrows = m.nrows(); double* mbase = m.getData().base(); dgetrs("N", &mrows, &mcols, inv.base(), &mrows, ipiv, mbase, &mrows, &info); diff --git a/dynare++/kord/korder.hweb b/dynare++/kord/korder.hweb index a96716fb6..9e5d3c11e 100644 --- a/dynare++/kord/korder.hweb +++ b/dynare++/kord/korder.hweb @@ -76,6 +76,8 @@ classes, which are defined here. These include: |PartitionY|, #include "kord_exception.h" #include "GeneralSylvester.h" +#include + #include #define TYPENAME typename @@ -186,14 +188,14 @@ public:@; PLUMatrix(int n) : TwoDMatrix(n,n), inv(nrows()*ncols()), - ipiv(new int[nrows()]) {} + ipiv(new lapack_int[nrows()]) {} PLUMatrix(const PLUMatrix& plu); virtual ~PLUMatrix() {delete [] ipiv;} void multInv(TwoDMatrix& m) const; private:@; Vector inv; - int* ipiv; + lapack_int* ipiv; protected:@; void calcPLU(); }; diff --git a/dynare++/src/Makefile.am b/dynare++/src/Makefile.am index 853dc5367..2e43f9d52 100644 --- a/dynare++/src/Makefile.am +++ b/dynare++/src/Makefile.am @@ -21,7 +21,7 @@ dynare___SOURCES = \ nlsolve.h \ $(GENERATED_FILES) -dynare___CPPFLAGS = -I../sylv/cc -I../tl/cc -I../kord -I../integ/cc -I.. -DDYNVERSION=\"$(PACKAGE_VERSION)\" -DPOSIX_THREADS +dynare___CPPFLAGS = -I../sylv/cc -I../tl/cc -I../kord -I../integ/cc -I.. -I$(top_srcdir)/mex/sources -DDYNVERSION=\"$(PACKAGE_VERSION)\" -DPOSIX_THREADS dynare___LDADD = ../kord/libkord.a ../integ/cc/libinteg.a ../tl/cc/libtl.a ../parser/cc/libparser.a ../utils/cc/libutils.a ../sylv/cc/libsylv.a $(noinst_LIBRARIES) $(LAPACK_LIBS) $(BLAS_LIBS) $(LIBS) $(FLIBS) $(PTHREAD_LIBS) dynare___CXXFLAGS = $(PTHREAD_CFLAGS) diff --git a/dynare++/sylv/cc/GeneralMatrix.cpp b/dynare++/sylv/cc/GeneralMatrix.cpp index c08335782..69c48b6f2 100644 --- a/dynare++/sylv/cc/GeneralMatrix.cpp +++ b/dynare++/sylv/cc/GeneralMatrix.cpp @@ -411,7 +411,7 @@ void ConstGeneralMatrix::multInvLeft(const char* trans, int mrows, int mcols, in GeneralMatrix inv(*this); lapack_int* ipiv = new lapack_int[rows]; lapack_int info; - lapack_int rows2 = rows, mrows2 = mrows, mcols2 = mcols, mld2 = mld; + lapack_int rows2 = rows, mcols2 = mcols, mld2 = mld; dgetrf(&rows2, &rows2, inv.getData().base(), &rows2, ipiv, &info); dgetrs(trans, &rows2, &mcols2, inv.base(), &rows2, ipiv, d, &mld2, &info); diff --git a/dynare++/sylv/cc/SymSchurDecomp.cpp b/dynare++/sylv/cc/SymSchurDecomp.cpp index 403e442e5..1bedc3b88 100644 --- a/dynare++/sylv/cc/SymSchurDecomp.cpp +++ b/dynare++/sylv/cc/SymSchurDecomp.cpp @@ -21,27 +21,27 @@ SymSchurDecomp::SymSchurDecomp(const GeneralMatrix& mata) const char* jobz = "V"; const char* range = "A"; const char* uplo = "U"; - int n = mata.numRows(); + lapack_int n = mata.numRows(); GeneralMatrix tmpa(mata); double* a = tmpa.base(); - int lda = tmpa.getLD(); + lapack_int lda = tmpa.getLD(); double dum; double* vl = &dum; double* vu = &dum; - int idum; - int* il = &idum; - int* iu = &idum; + lapack_int idum; + lapack_int* il = &idum; + lapack_int* iu = &idum; double abstol = 0.0; - int m = n; + lapack_int m = n; double* w = lambda.base(); double* z = q.base(); - int ldz = q.getLD(); - int* isuppz = new int[2*std::max(1,m)]; + lapack_int ldz = q.getLD(); + lapack_int* isuppz = new lapack_int[2*std::max(1,(int) m)]; double tmpwork; - int lwork = -1; - int tmpiwork; - int liwork = -1; - int info; + lapack_int lwork = -1; + lapack_int tmpiwork; + lapack_int liwork = -1; + lapack_int info; // query for lwork and liwork dsyevr(jobz, range, uplo, &n, a, &lda, vl, vu, il, iu, &abstol, @@ -50,7 +50,7 @@ SymSchurDecomp::SymSchurDecomp(const GeneralMatrix& mata) liwork = tmpiwork; // allocate work arrays double* work = new double[lwork]; - int* iwork = new int[liwork]; + lapack_int* iwork = new lapack_int[liwork]; // do the calculation dsyevr(jobz, range, uplo, &n, a, &lda, vl, vu, il, iu, &abstol, diff --git a/mex/build/Makefile.am b/mex/build/Makefile.am index de26e02e6..8f3161552 100644 --- a/mex/build/Makefile.am +++ b/mex/build/Makefile.am @@ -12,14 +12,13 @@ if HAVE_BLAS if HAVE_LAPACK if HAVE_PTHREAD if HAVE_MEXOPTS -#SUBDIRS += korderpert/matlab korderpert/tests +SUBDIRS += korderpert/matlab korderpert/tests endif if HAVE_MKOCTFILE -#SUBDIRS += korderpert/octave +SUBDIRS += korderpert/octave endif endif endif endif - EXTRA_DIST = mex.def mexFunction-MacOSX.map diff --git a/mex/build/korderpert.am b/mex/build/korderpert.am index 578b88e83..b54fd7104 100644 --- a/mex/build/korderpert.am +++ b/mex/build/korderpert.am @@ -1,40 +1,91 @@ -vpath %.cpp $(top_srcdir)/mex/sources/korderpert -vpath %.cpp $(top_srcdir)/mex/sources/gensylv +vpath %.cpp $(top_srcdir)/mex/sources/korderpert $(top_srcdir)/dynare++/sylv/cc $(top_srcdir)/dynare++/tl/cc $(top_srcdir)/dynare++/kord $(top_srcdir)/dynare++/integ/cc $(top_srcdir)/dynare++/src noinst_PROGRAMS = korderpert -#check_PROGRAMS = ramst1_dynamic fs2000k_dynamic - # Can't use korderpert_CPPFLAGS, because it interacts badly with VPATH -CPPFLAGS += -I$(top_srcdir)/dynare++/src -I$(top_srcdir)/dynare++/kord -I$(top_srcdir)/dynare++/tl/cc -I$(top_srcdir)/dynare++/utils/cc -I$(top_srcdir)/dynare++/sylv/cc +CPPFLAGS += -I$(top_srcdir)/dynare++/src -I$(top_srcdir)/dynare++/kord -I$(top_srcdir)/dynare++/tl/cc -I$(top_srcdir)/dynare++/utils/cc -I$(top_srcdir)/dynare++/sylv/cc -I$(top_srcdir)/dynare++/integ/cc -I$(top_srcdir)/mex/sources # For Dynare++ thread implementation in tensor library -CPPFLAGS += -DPOSIX_THREADS - -# For Dynare++ gensylv (so that it uses the right prototypes for BLAS/LAPACK) -CPPFLAGS += -DMATLAB - -# So that we have mexFunction() in the library -CPPFLAGS += -DMATLAB_MEX_FILE +DEFS += -DPOSIX_THREADS CXXFLAGS += $(PTHREAD_CFLAGS) -LIBS += $(LIBADD_DLOPEN) $(PTHREAD_LIBS) $(top_srcdir)/dynare++/kord/libkord.a $(top_srcdir)/dynare++/tl/cc/libtl.a $(top_srcdir)/dynare++/sylv/cc/libsylv.a $(top_srcdir)/dynare++/src/libnsolve.a +LIBS += $(LIBADD_DLOPEN) + +KORD_SRCS = \ + faa_di_bruno.cpp \ + korder_stoch.cpp \ + journal.cpp \ + decision_rule.cpp \ + dynamic_model.cpp \ + random.cpp \ + first_order.cpp \ + normal_conjugate.cpp \ + approximation.cpp \ + global_check.cpp \ + korder.cpp + +SYLV_SRCS = \ + IterativeSylvester.cpp \ + QuasiTriangular.cpp \ + QuasiTriangularZero.cpp \ + GeneralMatrix.cpp \ + GeneralSylvester.cpp \ + SimilarityDecomp.cpp \ + SylvException.cpp \ + SchurDecompEig.cpp \ + Vector.cpp \ + TriangularSylvester.cpp \ + SylvParams.cpp \ + BlockDiagonal.cpp \ + KronVector.cpp \ + SylvMemory.cpp \ + SymSchurDecomp.cpp \ + SylvMatrix.cpp \ + SchurDecomp.cpp \ + KronUtils.cpp + +TL_SRCS = \ + normal_moments.cpp \ + int_sequence.cpp \ + tensor.cpp \ + ps_tensor.cpp \ + pyramid_prod2.cpp \ + equivalence.cpp \ + fine_container.cpp \ + kron_prod.cpp \ + t_polynomial.cpp \ + symmetry.cpp \ + stack_container.cpp \ + twod_matrix.cpp \ + sparse_tensor.cpp \ + sthread.cpp \ + gs_tensor.cpp \ + pyramid_prod.cpp \ + fs_tensor.cpp \ + permutation.cpp \ + rfs_tensor.cpp \ + t_container.cpp \ + tl_static.cpp + +INTEG_SRCS = \ + product.cpp \ + quadrature.cpp \ + quasi_mcarlo.cpp \ + smolyak.cpp \ + vector_function.cpp nodist_korderpert_SOURCES = \ k_order_perturbation.cpp \ k_ord_dynare.cpp \ k_ord_dynare.h \ dynamic_dll.cpp \ - dynamic_dll.h + dynamic_dll.h \ + $(KORD_SRCS) \ + $(TL_SRCS) \ + $(SYLV_SRCS) \ + $(INTEG_SRCS) \ + nlsolve.cpp -#BUILT_SOURCES = ramst1_dynamic.c fs2000k_dynamic.c - -#nodist_ramst1_dynamic_SOURCES = ramst1_dynamic.c -#nodist_fs2000k_dynamic_SOURCES = fs2000k_dynamic.c - -#ramst1_dynamic.c: tests/ramst1.mod -# $(top_srcdir)/preprocessor/dynare_m $(top_srcdir)/mex/sources/korderpert/tests/ramst1.mod - -#fs2000k_dynamic.c: tests/fs2000k.mod -# $(top_srcdir)/preprocessor/dynare_m $(top_srcdir)/mex/sources/korderpert/tests/fs2000k.mod +noinst_LIBRARIES = libkorderpert.a +nodist_libkorderpert_a_SOURCES = $(nodist_korderpert_SOURCES) diff --git a/mex/build/korderpert/tests/Makefile.am b/mex/build/korderpert/tests/Makefile.am index 4aa0f7a40..a6369330b 100644 --- a/mex/build/korderpert/tests/Makefile.am +++ b/mex/build/korderpert/tests/Makefile.am @@ -1,24 +1,19 @@ -VPATH = $(top_srcdir)/mex/sources/korderpert:$(top_srcdir)/mex/sources/korderpert/tests +vpath %.cpp $(top_srcdir)/mex/sources/korderpert/tests check_PROGRAMS = k_order_test_main -CPPFLAGS += -DPOSIX_THREADS -I$(top_srcdir)/dynare++/src -I$(top_srcdir)/dynare++/kord -I$(top_srcdir)/dynare++/tl/cc -I$(top_srcdir)/dynare++/utils/cc -I$(top_srcdir)/dynare++/sylv/cc -I$(MATLAB)/extern/include -I$(top_srcdir)/mex/sources/korderpert +CPPFLAGS += -I$(top_srcdir)/dynare++/src -I$(top_srcdir)/dynare++/kord -I$(top_srcdir)/dynare++/tl/cc -I$(top_srcdir)/dynare++/utils/cc -I$(top_srcdir)/dynare++/sylv/cc -I$(MATLAB)/extern/include -I$(top_srcdir)/mex/sources/korderpert -I$(top_srcdir)/mex/sources -CPPFLAGS += -DMEXEXT=\"$(MEXEXT)\" +CPPFLAGS += $(MATLAB_CPPFLAGS) + +DEFS += -DPOSIX_THREADS -DMATLAB_MEX_FILE $(MATLAB_DEFS) CXXFLAGS += $(PTHREAD_CFLAGS) -LIBS += $(LIBADD_DLOPEN) $(top_srcdir)/dynare++/kord/libkord.a $(top_srcdir)/dynare++/tl/cc/libtl.a $(top_srcdir)/dynare++/sylv/cc/libsylv.a $(top_srcdir)/dynare++/src/libnsolve.a $(MATLAB_LIBS) - LDFLAGS += $(subst -shared,,$(MATLAB_LDFLAGS)) LDFLAGS += -Wl,-rpath,$(MATLAB)/bin/$(MATLAB_ARCH) -nodist_k_order_test_main_SOURCES = \ - k_order_test_main.cpp \ - k_order_perturbation.cpp \ - k_ord_dynare.cpp \ - k_ord_dynare.h \ - dynamic_dll.cpp \ - dynamic_dll.h +nodist_k_order_test_main_SOURCES = k_order_test_main.cpp +k_order_test_main_LDADD = ../matlab/libkorderpert.a $(MATLAB_LIBS) $(LIBADD_DLOPEN) diff --git a/mex/sources/korderpert/dynamic_dll.cpp b/mex/sources/korderpert/dynamic_dll.cpp index 817781000..74b4759e8 100644 --- a/mex/sources/korderpert/dynamic_dll.cpp +++ b/mex/sources/korderpert/dynamic_dll.cpp @@ -92,7 +92,7 @@ DynamicModelDLL::DynamicModelDLL(const char *modName, const int y_length, const { if (sExt == NULL) sExt = MEXEXT; -#ifdef WINDOWS +#ifdef _WIN32 HINSTANCE dynamicHinstance; // dynamicHinstance=::LoadLibraryEx(strcat(fNname,"_.dll"),NULL,DONT_RESOLVE_DLL_REFERENCES);//sExt); //"_.dll"); dynamicHinstance = ::LoadLibrary(strcat(fName, sExt)); //.dll); //"_.dll"); @@ -109,14 +109,14 @@ DynamicModelDLL::DynamicModelDLL(const char *modName, const int y_length, const if ((dynamicHinstance == NULL) || dlerror()) { cerr << dlerror() << endl; - mexPrintf("MexPrintf:Error loading DLL: %s", dlerror); + mexPrintf("MexPrintf:Error loading DLL"); throw 1; } Dynamic = (DynamicFn) dlsym(dynamicHinstance, "Dynamic"); if ((Dynamic == NULL) || dlerror()) { cerr << dlerror() << endl; - mexPrintf("MexPrintf:Error finding DLL function: %s", dlerror); + mexPrintf("MexPrintf:Error finding DLL function"); throw 2; } #endif @@ -142,7 +142,7 @@ DynamicModelDLL::DynamicModelDLL(const char *modName, const int y_length, const int DynamicModelDLL::close() { -#ifdef WINDOWS +#ifdef _WIN32 // MS FreeLibrary returns non 0 if OK, 0 if fails. bool rb = FreeLibrary(dynamicHinstance); if (rb) diff --git a/mex/sources/korderpert/dynamic_dll.h b/mex/sources/korderpert/dynamic_dll.h index 66ed602c6..20267e8c1 100644 --- a/mex/sources/korderpert/dynamic_dll.h +++ b/mex/sources/korderpert/dynamic_dll.h @@ -24,7 +24,7 @@ // K_ORDER_PERTURBATION_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. -#ifdef WINDOWS +#ifdef _WIN32 # ifdef K_ORDER_PERTURBATION_EXPORTS # define K_ORDER_PERTURBATION_API __declspec(dllexport) # else @@ -38,10 +38,10 @@ #endif #include -#include "mex.h" +#include // _Dynamic DLL pointer -#ifdef WINDOWS +#ifdef _WIN32 typedef void *(DynamicFn) #else // linux typedef void (*DynamicFn) @@ -62,7 +62,7 @@ const int MAX_MODEL_NAME = 100; class DynamicModelDLL { private: -#ifdef WINDOWS +#ifdef _WIN32 DynamicFn *Dynamic; // pointer to the Dynamic function in DLL #else DynamicFn Dynamic; // pointer to the Dynamic function in DLL @@ -72,7 +72,7 @@ private: const int nMax_lag; // no of lags const int nExog; // no of exogenous // const char * sExt; // dynamic file extension: dll, mexw32, ... -#ifdef WINDOWS +#ifdef _WIN32 HINSTANCE dynamicHinstance; // DLL instance pointer in Windows #else // linux void *dynamicHinstance; // and in Linux diff --git a/mex/sources/korderpert/k_ord_dynare.cpp b/mex/sources/korderpert/k_ord_dynare.cpp index 120630527..88fc24ef7 100644 --- a/mex/sources/korderpert/k_ord_dynare.cpp +++ b/mex/sources/korderpert/k_ord_dynare.cpp @@ -24,7 +24,7 @@ #include "k_ord_dynare.h" #include "dynamic_dll.h" -#include "mex.h" +#include #include "memory_file.h" diff --git a/mex/sources/korderpert/k_order_perturbation.cpp b/mex/sources/korderpert/k_order_perturbation.cpp index 58d2119a7..fdbb00e4a 100644 --- a/mex/sources/korderpert/k_order_perturbation.cpp +++ b/mex/sources/korderpert/k_order_perturbation.cpp @@ -83,7 +83,7 @@ CK_order_perturbation::CK_order_perturbation() #endif // _MSC_VER && WINDOWS -#ifdef MATLAB_MEX_FILE // exclude mexFunction for other applications +#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE) // exclude mexFunction for other applications extern "C" { // mexFunction: Matlab Inerface point and the main application driver diff --git a/mex/sources/korderpert/tests/k_order_test_main.cpp b/mex/sources/korderpert/tests/k_order_test_main.cpp index 9bc612fc9..2fca36dba 100644 --- a/mex/sources/korderpert/tests/k_order_test_main.cpp +++ b/mex/sources/korderpert/tests/k_order_test_main.cpp @@ -34,7 +34,7 @@ main(int argc, char *argv[]) double qz_criterium = 1+1e-6; const int check_flag = 0; - const char *fName = "fs2000k"; //mxArrayToString(mFname); + const char *fName = "./fs2000k"; //mxArrayToString(mFname); const char *dfExt = NULL; //Dyanamic file extension, e.g.".dll"; #ifdef DEBUG