Dynare++ and k_order_perturbation DLL:

* support Microsoft Visual C++ 2008 compiler (necessary for 64-bit 
platforms)
* use standard C++ headers for C Standard Library support


git-svn-id: https://www.dynare.org/svn/dynare/trunk@3121 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
sebastien 2009-11-03 14:16:18 +00:00
parent 3a137c3eaa
commit 295f998503
53 changed files with 220 additions and 122 deletions

View File

@ -6,7 +6,7 @@
@c
#include "quasi_mcarlo.h"
#include <math.h>
#include <cmath>
@<|RadicalInverse| constructor code@>;
@<|RadicalInverse::eval| code@>;

View File

@ -9,9 +9,9 @@
#include <dynlapack.h>
#include <math.h>
#include <cmath>
#include <string.h>
#include <cstring>
#include <algorithm>
@<|ParameterSignal| constructor code@>;
@ -155,7 +155,11 @@ void GaussConverterFunction::eval(const Vector& point, const ParameterSignal& si
@<|GaussConverterFunction::multiplier| code@>=
double GaussConverterFunction::calcMultiplier() const
{
#ifndef _MSC_VER
return sqrt(pow(M_PI, -1*indim()));
#else
return sqrt(pow(3.14159265358979323846, -1*indim()));
#endif
}
@

View File

@ -12,7 +12,7 @@
#include "integ/cc/product.h"
#include <getopt.h>
#include <stdio.h>
#include <cstdio>
#include <cmath>

View File

@ -14,10 +14,10 @@
#include "product.h"
#include "quasi_mcarlo.h"
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#include <sys/time.h>
#include <math.h>
#include <cmath>
const int num_threads = 2; // does nothing if DEBUG defined

View File

@ -683,7 +683,11 @@ void GenShockRealization::get(int n, Vector& out)
Vector r(numShocks());
RandomShockRealization::get(n, r);
for (int j = 0; j < numShocks(); j++)
#ifndef _MSC_VER
if (! isfinite(out[j]))
#else
if (!_finite(out[j]))
#endif
out[j] = r[j];
}

View File

@ -631,7 +631,13 @@ damp by one half.
if (fnorm <= flastnorm)
urelax_found = true;
else
#ifndef _MSC_VER
urelax *= std::min(0.5, flastnorm/fnorm);
#else
/* MSVC doesn't define std::min() (should be in <algorithm>),
but instead has a macro in <windows.h> */
urelax *= min(0.5, flastnorm/fnorm);
#endif
}

View File

@ -10,7 +10,7 @@
#include "faa_di_bruno.h"
#include "fine_container.h"
#include <math.h>
#include <cmath>
double FaaDiBruno::magic_mult = 1.5;
@<|FaaDiBruno::calculate| folded sparse code@>;

View File

@ -295,7 +295,11 @@ void FirstOrder::journalEigs()
}
JournalRecord jr(journal);
double mod = sqrt(alphar[i]*alphar[i]+alphai[i]*alphai[i]);
#ifndef _MSC_VER
mod = mod/round(100000*std::abs(beta[i]))*100000;
#else // MSVC doesn't respect C99 standard and doesn't define round(); use floor(x+0.5) instead
mod = mod/floor(100000*std::abs(beta[i])+0.5)*100000;
#endif
jr << i << "\t(" << alphar[i] << "," << alphai[i] << ") / " << beta[i]
<< " \t" << mod << endrec;
}

View File

@ -373,7 +373,11 @@ f^i(x_1,\ldots,x_i) &=
for (qmcpit run = beg; run != end; ++run, icol++) {
Vector ycol(ymat, icol);
Vector x(run.point());
#ifndef _MSC_VER
x.mult(2*M_PI);
#else
x.mult(2*3.14159265358979323846);
#endif
ycol[0] = 1;
for (int i = 0; i < d; i++) {
Vector subsphere(ycol, 0, i+1);

View File

@ -7,19 +7,65 @@
#include "journal.h"
#include "kord_exception.h"
#ifndef __MINGW32__
#if !defined(__MINGW32__) && !defined(_MSC_VER)
# include <sys/resource.h>
# include <sys/utsname.h>
#endif
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <cstdlib>
#ifndef _MSC_VER
# include <unistd.h>
#endif
#include <ctime>
SystemResources _sysres;
#ifdef __MINGW32__
#if defined(__MINGW32__) || defined(_MSC_VER)
@<|sysconf| Win32 implementation@>;
#endif
#ifdef _MSC_VER
struct timezone
{
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
int gettimeofday(struct timeval *tv, struct timezone *tz)
{
FILETIME ft;
unsigned __int64 tmpres = 0;
static int tzflag = 0;
if (NULL != tv)
{
GetSystemTimeAsFileTime(&ft);
tmpres |= ft.dwHighDateTime;
tmpres <<= 32;
tmpres |= ft.dwLowDateTime;
tmpres /= 10; /*convert into microseconds*/
/*converting file time to unix epoch*/
tmpres -= 11644473600000000ULL;
tv->tv_sec = (long)(tmpres / 1000000UL);
tv->tv_usec = (long)(tmpres % 1000000UL);
}
if (NULL != tz)
{
if (!tzflag)
{
_tzset();
tzflag++;
}
tz->tz_minuteswest = _timezone / 60;
tz->tz_dsttime = _daylight;
}
return 0;
}
#endif
@<|SystemResources| constructor code@>;
@<|SystemResources::pageSize| code@>;
@<|SystemResources::physicalPages| code@>;
@ -83,7 +129,7 @@ void SystemResources::getRUS(double& load_avg, long int& pg_avail,
gettimeofday(&now, NULL);
elapsed = now.tv_sec-start.tv_sec + (now.tv_usec-start.tv_usec)*1.0e-6;
#ifndef __MINGW32__
#if !defined(__MINGW32__) && !defined(_MSC_VER)
struct rusage rus;
getrusage(RUSAGE_SELF, &rus);
utime = rus.ru_utime.tv_sec+rus.ru_utime.tv_usec*1.0e-6;
@ -97,7 +143,7 @@ void SystemResources::getRUS(double& load_avg, long int& pg_avail,
majflt = -1;
#endif
#if !defined(__MINGW32__) && !defined(__CYGWIN32__)
#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__CYGWIN32__)
getloadavg(&load_avg, 1);
#else
load_avg = -1.0;
@ -209,7 +255,7 @@ void Journal::printHeader()
(*this)<< "General Public License, see http://www.gnu.org/license/gpl.html\n";
(*this)<< "\n\n";
#if !defined(__MINGW32__)
#if !defined(__MINGW32__) && !defined(_MSC_VER)
utsname info;
uname(&info);
(*this)<< "System info: ";
@ -249,33 +295,13 @@ Number of online processors is not implemented and returns -1, since
Windows kernel32 |GetSystemInfo| call is too complicated.
@<|sysconf| Win32 implementation@>=
#include <Windows.h>
#define _SC_PAGESIZE 1
#define _SC_PHYS_PAGES 2
#define _SC_AVPHYS_PAGES 3
#define _SC_NPROCESSORS_ONLN 4
@#
struct Win32MemoryStatus {
unsigned long dwLength;
unsigned long dwMemoryLoad;
unsigned int dwTotalPhys;
unsigned int dwAvailPhys;
unsigned int dwTotalPageFile;
unsigned int dwAvailPageFile;
unsigned int dwTotalVirtual;
unsigned int dwAvailVirtual;
Win32MemoryStatus();
};
@#
extern "C" {
void __stdcall GlobalMemoryStatus(Win32MemoryStatus *);
};
@#
Win32MemoryStatus::Win32MemoryStatus()
{
dwLength = sizeof(Win32MemoryStatus);
GlobalMemoryStatus(this);
}
@#
long sysconf(int name)
{
switch (name) {
@ -283,12 +309,14 @@ long sysconf(int name)
return 1024;
case _SC_PHYS_PAGES:@;
{
Win32MemoryStatus memstat;
MEMORYSTATUS memstat;
GlobalMemoryStatus(&memstat);
return memstat.dwTotalPhys/1024;
}
case _SC_AVPHYS_PAGES:@;
{
Win32MemoryStatus memstat;
MEMORYSTATUS memstat;
GlobalMemoryStatus(&memstat);
return memstat.dwAvailPhys/1024;
}
case _SC_NPROCESSORS_ONLN:@;

View File

@ -17,8 +17,12 @@
#include "int_sequence.h"
#include <sys/time.h>
#include <stdio.h>
#ifdef _MSC_VER
# include <Winsock2.h>
#else
# include <sys/time.h>
#endif
#include <cstdio>
#include <iostream>
#include <fstream>

View File

@ -10,8 +10,8 @@ This is a simple code defining an exception and two convenience macros.
#ifndef KORD_EXCEPTION_H
#define KORD_EXCEPTION_H
#include <string.h>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#define KORD_RAISE(mes) \
throw KordException(__FILE__, __LINE__, mes);

View File

@ -16,7 +16,7 @@ and Geoff Kuenning.
#define MERSENNE_TWISTER_H
#include "random.h"
#include <string.h>
#include <cstring>
@<|MersenneTwister| class declaration@>;
@<|MersenneTwister| inline method definitions@>;

View File

@ -6,7 +6,7 @@
#include "random.h"
#include <stdlib.h>
#include <cstdlib>
#include <limits>
#include <cmath>
@ -42,7 +42,7 @@ double RandomGenerator::normal()
@<|SystemRandomGenerator::uniform| code@>=
double SystemRandomGenerator::uniform()
{
#ifndef __MINGW32__
#if !defined(__MINGW32__) && !defined(_MSC_VER)
return drand48();
#else
return ((double)rand())/RAND_MAX;
@ -53,7 +53,7 @@ double SystemRandomGenerator::uniform()
@<|SystemRandomGenerator::initSeed| code@>=
void SystemRandomGenerator::initSeed(int seed)
{
#ifndef __MINGW32__
#if !defined(__MINGW32__) && !defined(_MSC_VER)
srand48(seed);
#else
srand(seed);

View File

@ -5,8 +5,8 @@
#include "utils/cc/exception.h"
#include "dynamic_atoms.h"
#include <string.h>
#include <limits.h>
#include <cstring>
#include <climits>
using namespace ogp;

View File

@ -4,7 +4,7 @@
#include "namelist.h"
#include <string.h>
#include <cstring>
using namespace ogp;

View File

@ -6,8 +6,7 @@
#include "tree.h"
#include <stdlib.h>
#include <math.h>
#include <cstdlib>
#include <cmath>
#include <limits>

View File

@ -10,7 +10,7 @@
#include "planner_builder.h"
#include "forw_subst_builder.h"
#include <stdlib.h>
#include <cstdlib>
#include <string>
#include <cmath>

View File

@ -4,8 +4,8 @@
#include "dynare_params.h"
#include <getopt.h>
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
const char* help_str =
"usage: dynare++ [--help] [--version] [options] <model file>\n"

View File

@ -7,6 +7,11 @@
#include <cmath>
#ifdef _MSC_VER
// For _finite()
# include <cfloat>
#endif
using namespace ogu;
/** This should not be greater than DBL_EPSILON^(1/2). */
@ -32,7 +37,11 @@ double GoldenSectionSearch::search(OneDFunction& f, double x1, double x2)
else
x = b + dx;
double fx = f.eval(x);
#ifndef _MSC_VER
if (! std::isfinite(fx))
#else
if (! _finite(fx))
#endif
return x1;
if (b-x1 > x2-b) {
// x is on the left from b
@ -69,7 +78,11 @@ double GoldenSectionSearch::search(OneDFunction& f, double x1, double x2)
bool GoldenSectionSearch::init_bracket(OneDFunction& f, double x1, double& x2, double& b)
{
double f1 = f.eval(x1);
#ifndef _MSC_VER
if (! std::isfinite(f1))
#else
if (! _finite(f1))
#endif
throw DynareException(__FILE__, __LINE__,
"Safer point not finite in GoldenSectionSearch::init_bracket");
@ -86,7 +99,11 @@ bool GoldenSectionSearch::init_bracket(OneDFunction& f, double x1, double& x2, d
double bsym = 2*x2 - b;
double fbsym = f.eval(bsym);
// now we know that f1, f2, and fb are finite
#ifndef _MSC_VER
if (std::isfinite(fbsym)) {
#else
if (_finite(fbsym)) {
#endif
// we have four numbers f1, fb, f2, fbsym, we test for the
// following combinations to find the bracket:
// [f1,f2,fbsym], [f1,fb,fbsym] and [f1,fb,fbsym]
@ -145,7 +162,11 @@ bool GoldenSectionSearch::search_for_finite(OneDFunction& f, double x1, double&
double f2 = f.eval(x2);
b = (1-golden)*x1 + golden*x2;
double fb = f.eval(b);
#ifndef _MSC_VER
found = std::isfinite(f2) && std::isfinite(fb);
#else
found = _finite(f2) && _finite(fb);
#endif
if (! found)
x2 = b;
cnt++;

View File

@ -4,8 +4,8 @@
#include "BlockDiagonal.h"
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
BlockDiagonal::BlockDiagonal(const double* d, int d_size)
: QuasiTriangular(d, d_size),

View File

@ -9,9 +9,9 @@
#include <dynblas.h>
#include <dynlapack.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <limits>

View File

@ -8,7 +8,7 @@
#include "TriangularSylvester.h"
#include "IterativeSylvester.h"
#include <time.h>
#include <ctime>
GeneralSylvester::GeneralSylvester(int ord, int n, int m, int zero_cols,
const double* da, const double* db,

View File

@ -8,7 +8,7 @@
#include <dynblas.h>
#include <stdio.h>
#include <cstdio>
#include <cmath>
using namespace std;

View File

@ -7,7 +7,7 @@
#include "SylvMatrix.h"
#include "SylvException.h"
#include <stdio.h>
#include <cstdio>
QuasiTriangularZero::QuasiTriangularZero(int num_zeros, const double* d,
int d_size)

View File

@ -4,8 +4,8 @@
#include "SylvException.h"
#include <string.h>
#include <stdio.h>
#include <cstring>
#include <cstdio>
SylvException::SylvException(const char* f, int l, const SylvException* s)
{

View File

@ -8,8 +8,8 @@
#include <dynblas.h>
#include <dynlapack.h>
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#include <cmath>
void SylvMatrix::multLeftI(const SqSylvMatrix& m)

View File

@ -10,9 +10,9 @@
# include <dynmex.h>
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
/**********************************************************/
/* SylvMemoryPool */

View File

@ -5,8 +5,8 @@
#ifndef SYLV_PARAMS_H
#define SYLV_PARAMS_H
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
# include <dynmex.h>

View File

@ -7,7 +7,7 @@
#include "KronUtils.h"
#include "BlockDiagonal.h"
#include <stdio.h>
#include <cstdio>
#include <cmath>
double TriangularSylvester::diag_zero = 1.e-15;

View File

@ -9,9 +9,9 @@
#include <dynblas.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <limits>

View File

@ -9,7 +9,7 @@
* to avoid running virtual method invokation mechanism. Some
* members, and methods are thus duplicated */
#include <stdio.h>
#include <cstdio>
class GeneralMatrix;
class ConstVector;

View File

@ -4,8 +4,8 @@
#include "MMMatrix.h"
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
MMMatrixIn::MMMatrixIn(const char* fname)
{

View File

@ -18,9 +18,9 @@
#include "MMMatrix.h"
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cmath>

View File

@ -8,7 +8,7 @@
#include "permutation.h"
#include "tl_exception.h"
#include <string.h>
#include <cstring>
@<|OrdSequence| method codes@>;
@<|Equivalence| method codes@>;

View File

@ -6,7 +6,7 @@
@c
#include "fine_container.h"
#include <math.h>
#include <cmath>
@<|SizeRefinement| constructor code@>;
@ -21,7 +21,11 @@ SizeRefinement::SizeRefinement(const IntSequence& s, int nc, int max)
int nr = s[i]/max;
if (s[i] % max != 0)
nr++;
#ifndef _MSC_VER
int ss = (nr>0) ? (int)round(((double)s[i])/nr) : 0;
#else // MSVC doesn't respect C99 standard and doesn't define round(); use floor(x+0.5) instead
int ss = (nr>0) ? (int)floor((((double)s[i])/nr) + 0.5) : 0;
#endif
for (int j = 0; j < nr - 1; j++) {
rsizes.push_back(ss);
ind_map.push_back(i);

View File

@ -8,8 +8,8 @@
#include "symmetry.h"
#include "tl_exception.h"
#include <stdio.h>
#include <limits.h>
#include <cstdio>
#include <climits>
@<|IntSequence| constructor code 1@>;
@<|IntSequence| constructor code 2@>;

View File

@ -30,7 +30,7 @@ some instances do destroy the underlying data, and some not.
#define INT_SEQUENCE_H
#include <string.h>
#include <cstring>
#include <vector>
using namespace std;

View File

@ -6,7 +6,7 @@
#include "kron_prod.h"
#include "tl_exception.h"
#include <stdio.h>
#include <cstdio>
@<|KronProdDimens| constructor code@>;
@<|KronProd::checkDimForMult| code@>;

View File

@ -10,6 +10,11 @@
#include <cmath>
#ifdef _MSC_VER
// For _finite()
# include <cfloat>
#endif
@<|SparseTensor::insert| code@>;
@<|SparseTensor::isFinite| code@>;
@<|SparseTensor::getFoldIndexFillFactor| code@>;
@ -34,8 +39,13 @@ void SparseTensor::insert(const IntSequence& key, int r, double c)
"Row number out of dimension of tensor in SparseTensor::insert");
TL_RAISE_IF(key.size() != dimen(),
"Wrong length of key in SparseTensor::insert");
#ifndef _MSC_VER
TL_RAISE_IF(! std::isfinite(c),
"Insertion of non-finite value in SparseTensor::insert");
#else
TL_RAISE_IF(! _finite(c),
"Insertion of non-finite value in SparseTensor::insert");
#endif
iterator first_pos = m.lower_bound(key);
@<check that pair |key| and |r| is unique@>;
@ -62,7 +72,11 @@ bool SparseTensor::isFinite() const
bool res = true;
const_iterator run = m.begin();
while (res && run != m.end()) {
#ifndef _MSC_VER
if (! std::isfinite((*run).second.second))
#else
if (! _finite((*run).second.second))
#endif
res = false;
++run;
}

View File

@ -89,7 +89,7 @@ member of |thread_group| and |detach_thread_group| classes.
# define pthread_cond_t void *
#endif
#include <stdio.h>
#include <cstdio>
#include <list>
#include <map>

View File

@ -7,7 +7,7 @@
#include "symmetry.h"
#include "permutation.h"
#include <stdio.h>
#include <cstdio>
@<|Symmetry| constructor code@>;
@<|Symmetry::findClass| code@>;

View File

@ -15,8 +15,8 @@ for this.
#ifndef TL_EXCEPTION_H
#define TL_EXCEPTION_H
#include <string.h>
#include <stdio.h>
#include <cstring>
#include <cstdio>
@<body of tl\_exception header@>;

View File

@ -26,7 +26,7 @@ to allow submatrix construction from const reference arguments.
#include "GeneralMatrix.h"
#include <stdio.h>
#include <cstdio>
class TwoDMatrix;
@<|ConstTwoDMatrix| class declaration@>;

View File

@ -4,7 +4,7 @@
#include "factory.h"
#include <cstdlib>
#include <math.h>
#include <cmath>
void Factory::init(const Symmetry& s, const IntSequence& nvs)
{

View File

@ -6,8 +6,8 @@
#include "fs_tensor.h"
#include <cstdlib>
#include <math.h>
#include <stdio.h>
#include <cmath>
#include <cstdio>
IntGenerator intgen;

View File

@ -13,9 +13,9 @@
#include "ps_tensor.h"
#include "tl_static.h"
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <cstdio>
#include <cstring>
#include <ctime>
class TestRunnable {

View File

@ -5,8 +5,8 @@
#ifndef OGU_EXCEPTION_H
#define OGU_EXCEPTION_H
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
@ -27,7 +27,13 @@ namespace ogu {
strncpy(file, f, file_length-1);
file[file_length-1] = '\0';
line = l;
#ifndef _MSC_VER
strncpy(mes, m, std::min(mes_length-1,(int)strlen(m)));
#else
/* MSVC doesn't define std::min() (should be in <algorithm>),
but instead has a macro in <windows.h> */
strncpy(mes, m, min(mes_length-1,(int)strlen(m)));
#endif
mes[mes_length-1] = '\0';
}
Exception(const char* f, int l, const std::string& m)
@ -35,7 +41,13 @@ namespace ogu {
strncpy(file, f, file_length-1);
file[file_length-1] = '\0';
line = l;
#ifndef _MSC_VER
strncpy(mes, m.c_str(), std::min(mes_length-1,(int)m.length()));
#else
/* MSVC doesn't define std::min() (should be in <algorithm>),
but instead has a macro in <windows.h> */
strncpy(mes, m.c_str(), min(mes_length-1,(int)m.length()));
#endif
mes[mes_length-1] = '\0';
}
virtual ~Exception() {}

View File

@ -4,7 +4,7 @@
#include "memory_file.h"
#include <stdio.h>
#include <cstdio>
using namespace ogu;

View File

@ -39,7 +39,11 @@ DynareMxArrayToString(const mxArray *mxFldp, const int len, const int width)
const char **
DynareMxArrayToString(const char *cNamesCharStr, const int len, const int width)
{
char cNamesMX[len][width+1]; //
char **cNamesMX;
cNamesMX = (char **) mxCalloc(len, sizeof(char *));
for(int i = 0; i < len; i++)
cNamesMX[i] = (char *) mxCalloc(width+1, sizeof(char));
#ifdef DEBUG
mexPrintf("loop DynareMxArrayToString cNamesCharStr = %s \n", cNamesCharStr);
#endif
@ -69,6 +73,7 @@ DynareMxArrayToString(const char *cNamesCharStr, const int len, const int width)
mexPrintf("ret [%d]= %s \n", j, ret[j]);
#endif
}
mxFree(cNamesMX);
return ret;
}

View File

@ -26,10 +26,8 @@
#ifdef _WIN32
# include <windows.h>
# ifdef K_ORDER_PERTURBATION_EXPORTS
# ifdef _MSC_VER
# define K_ORDER_PERTURBATION_API __declspec(dllexport)
# else
# define K_ORDER_PERTURBATION_API __declspec(dllimport)
# endif
#else
# include <dlfcn.h> // unix/linux DLL (.so) handling routines

View File

@ -24,15 +24,12 @@
#include "k_ord_dynare.h"
#include "dynamic_dll.h"
#include <cmath>
#include <dynmex.h>
#include "memory_file.h"
//#include "k_order_perturbation.h"
#ifndef DYNVERSION
# define DYNVERSION "unknown"
#endif
/**************************************************************************************/
/* Dynare DynamicModel class */
/**************************************************************************************/
@ -345,7 +342,7 @@ KordpDynare::populateDerivativesContainer(TwoDMatrix *g, int ord, const vector<i
{
int j = (int)g->get(i,0)-1; // hessian indices start with 1
int i1 = (int)g->get(i,1) -1;
int s0 = (int)floor(i1/nJcols);
int s0 = (int)floor(((double) i1)/((double) nJcols));
int s1 = i1- (nJcols*s0);
if (s0 < nJcols1)
s[0] = revOrder[s0];
@ -609,7 +606,7 @@ KordpDynare::ReorderBlocks(TwoDMatrix *tdx, const vector<int> *vOrder)
{
// determine order of the matrix
double dbOrder = log(tdx->ncols())/log(nJcols);
double dbOrder = log((double) tdx->ncols())/log((double) nJcols);
int ibOrder = (int) dbOrder;
if ((double) ibOrder != dbOrder || ibOrder > nOrder)
{

View File

@ -45,7 +45,7 @@
#include <cctype>
#ifdef _MSC_VER //&&WINDOWS
#ifdef _MSC_VER
BOOL APIENTRY
DllMain(HANDLE hModule,
@ -74,14 +74,8 @@ fnK_order_perturbation(void)
{
return 42;
}
// This is the constructor of a class that has been exported.
// see k_order_perturbation.h for the class definition
CK_order_perturbation::CK_order_perturbation()
{
return;
}
#endif // _MSC_VER && WINDOWS
#endif // _MSC_VER
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE) // exclude mexFunction for other applications
extern "C" {