Commit a5e9c7be authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Merge pull request #340 from FerhatMihoubi/master

last commits
parents 214ff844 33bac21c
......@@ -107,12 +107,20 @@ fclose(fid);
% Set newline code (ok for *nix, check for mac and windows)
if isunix
newline_code = 10;
elseif ispc
newline_code = 13;
elseif ismac
newline_code = 10;
else
error('readcsv:: Not implemented for your OS!')
end
% Get the positions of the end-of-line code;
end_of_line_locations = find(bfile==newline_code);
if ispc && isempty(end_of_line_locations)
newline_code=10;
end_of_line_locations = find(bfile==newline_code);
end;
tmp = find(bfile==newline_code);
% Get the number of lines in the file.
......
......@@ -102,6 +102,26 @@ switch (extension)
end
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;
end
case '.csv'
[freq,init,data,varlist] = load_csv_file_data(fullname);
disp('size(data)');
size(data)
% for i=1:length(varlist)
% if isnan(varlist)
% varlist(1,i) = ' ';
% end
% end
%var_names_01 = deblank(var_names_01);
for dyn_i_01=1:var_size_01
iv = strmatch(deblank(var_names_01(dyn_i_01,:)),varlist,'exact') + 1;
dyn_tmp_01 = [data(2:end,iv)]';
if length(dyn_tmp_01) > dyn_size_01 && dyn_size_01 > 0
cd(old_pwd)
error('data size is too large')
end
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;
end
otherwise
cd(old_pwd)
error(['Unsupported extension for datafile: ' extension])
......
......@@ -74,69 +74,11 @@ g1=spalloc( Blck_size*periods, Jacobian_Size, nze*periods);
reduced = 0;
while ~(cvg==1 || iter>maxit_),
[r, y, g1, g2, g3, b]=feval(fname, y, x, params, steady_state, periods, 0, y_kmin, Blck_size);
% fjac = zeros(Blck_size, Blck_size*(y_kmin_l+1+y_kmax_l));
% disp(['Blck_size=' int2str(Blck_size) ' size(y_index)=' int2str(size(y_index,2))]);
% dh = max(abs(y(y_kmin+1-y_kmin_l:y_kmin+1+y_kmax_l, y_index)),options_.gstep*ones(y_kmin_l+1+y_kmax_l, Blck_size))*eps^(1/3);
% fvec = r;
% %for i = y_kmin+1-y_kmin_l:y_kmin+1+y_kmax_l
% i = y_kmin+1;
% i
% for j = 1:Blck_size
% ydh = y ;
% ydh(i, y_index(j)) = ydh(i, y_index(j)) + dh(i, j) ;
% if(j==11 && i==2)
% disp(['y(i,y_index(11)=' int2str(y_index(11)) ')= ' num2str(y(i,y_index(11))) ' ydh(i, y_index(j))=' num2str(ydh(i, y_index(j))) ' dh(i,j)= ' num2str(dh(i,j))]);
% end;
% [t, y1, g11, g21, g31, b1]=feval(fname, ydh, x, params, periods, 0, y_kmin, Blck_size);
% fjac(:,j+(i-(y_kmin+1-y_kmin_l))*Blck_size) = (t(:, 1+y_kmin) - fvec(:, 1+y_kmin))./dh(i, j) ;
% if(j==11 && i==2)
% disp(['fjac(:,' int2str(j+(i-(y_kmin+1-y_kmin_l))*Blck_size) ')=']);
% disp([num2str(fjac(:,j+(i-(y_kmin+1-y_kmin_l))*Blck_size))]);
% end;
% end;
% % end
% %diff = g1(1:Blck_size, 1:Blck_size*(y_kmin_l+1+y_kmax_l)) -fjac;
% diff = g1(1:Blck_size, y_kmin_l*Blck_size+1:(y_kmin_l+1)*Blck_size) -fjac(1:Blck_size, y_kmin_l*Blck_size+1:(y_kmin_l+1)*Blck_size);
% disp(diff);
% [c_max, i_c_max] = max(abs(diff));
% [l_c_max, i_r_max] = max(c_max);
% disp(['maximum element row=' int2str(i_c_max(i_r_max)) ' and column=' int2str(i_r_max) ' value = ' num2str(l_c_max)]);
% equation = i_c_max(i_r_max);
% variable = i_r_max;
% variable
% disp(['equation ' int2str(equation) ' and variable ' int2str(y_index(mod(variable, Blck_size))) ' ' M_.endo_names(y_index(mod(variable, Blck_size)), :)]);
% disp(['g1(' int2str(equation) ', ' int2str(variable) ')=' num2str(g1(equation, y_kmin_l*Blck_size+variable),'%3.10f') ' fjac(' int2str(equation) ', ' int2str(variable) ')=' num2str(fjac(equation, y_kmin_l*Blck_size+variable), '%3.10f')]);
% return;
% for i=1:periods;
% disp([sprintf('%5.14f ',[T9025(i) T1149(i) T11905(i)])]);
% end;
% return;
%residual = r(:,y_kmin+1:y_kmin+1+y_kmax_l);
%num2str(residual,' %1.6f')
%jac_ = g1(1:(y_kmin)*Blck_size, 1:(y_kmin+1+y_kmax_l)*Blck_size);
%jac_
preconditioner = 2;
g1a=g1(:, y_kmin*Blck_size+1:(periods+y_kmin)*Blck_size);
term1 = g1(:, 1:y_kmin_l*Blck_size)*reshape(y(1+y_kmin-y_kmin_l:y_kmin,y_index)',1,y_kmin_l*Blck_size)';
term2 = g1(:, (periods+y_kmin_l)*Blck_size+1:(periods+y_kmin_l+y_kmax_l)*Blck_size)*reshape(y(periods+y_kmin+1:periods+y_kmin+y_kmax_l,y_index)',1,y_kmax_l*Blck_size)';
b = b - term1 - term2;
% fid = fopen(['result' num2str(iter)],'w');
% fg1a = full(g1a);
% fprintf(fid,'%d\n',size(fg1a,1));
% fprintf(fid,'%d\n',size(fg1a,2));
% fprintf(fid,'%5.14f\n',fg1a);
% fprintf(fid,'%d\n',size(b,1));
% fprintf(fid,'%5.14f\n',b);
% fclose(fid);
% return;
%ipconfigb_ = b(1:(1+y_kmin)*Blck_size);
%b_
[max_res, max_indx]=max(max(abs(r')));
if(~isreal(r))
max_res = (-max_res^2)^0.5;
......@@ -255,7 +197,33 @@ while ~(cvg==1 || iter>maxit_),
elseif(stack_solve_algo==2),
flag1=1;
while(flag1>0)
[L1, U1]=luinc(g1a,luinc_tol);
if preconditioner == 2
[L1, U1]=luinc(g1a,luinc_tol);
elseif preconditioner == 3
Size = Blck_size;
gss1 = g1a(Size + 1: 2*Size,Size + 1: 2*Size) + g1a(Size + 1: 2*Size,2*Size+1: 3*Size);
[L1, U1]=lu(gss1);
L(1:Size,1:Size) = L1;
U(1:Size,1:Size) = U1;
gss2 = g1a(Size + 1: 2*Size,1: Size) + g1a(Size + 1: 2*Size,Size+1: 2*Size) + g1a(Size + 1: 2*Size,2*Size+1: 3*Size);
[L2, U2]=lu(gss2);
L(Size+1:(periods-1)*Size,Size+1:(periods-1)*Size) = kron(eye(periods-2), L2);
U(Size+1:(periods-1)*Size,Size+1:(periods-1)*Size) = kron(eye(periods-2), U2);
gss2 = g1a(Size + 1: 2*Size,1: Size) + g1a(Size + 1: 2*Size,Size+1: 2*Size);
[L3, U3]=lu(gss2);
L((periods-1)*Size+1:periods*Size,(periods-1)*Size+1:periods*Size) = L3;
U((periods-1)*Size+1:periods*Size,(periods-1)*Size+1:periods*Size) = U3;
L1 = L;
U1 = U;
elseif preconditioner == 4
Size = Blck_size;
gss1 = g1a(1: 3*Size, 1: 3*Size);
[L, U] = lu(gss1);
L1 = kron(eye(ceil(periods/3)),L);
U1 = kron(eye(ceil(periods/3)),U);
L1 = L1(1:periods * Size, 1:periods * Size);
U1 = U1(1:periods * Size, 1:periods * Size);
end;
[za,flag1] = gmres(g1a,b,Blck_size,1e-6,Blck_size*periods,L1,U1);
if (flag1>0 || reduced)
if(flag1==1)
......@@ -276,8 +244,25 @@ while ~(cvg==1 || iter>maxit_),
elseif(stack_solve_algo==3),
flag1=1;
while(flag1>0)
[L1, U1]=luinc(g1a,luinc_tol);
[za,flag1] = bicgstab(g1a,b,1e-7,Blck_size*periods,L1,U1);
if (preconditioner == 3)
Size = Blck_size;
gss0 = g1a(Size + 1: 2*Size,1: Size) + g1a(Size + 1: 2*Size,Size+1: 2*Size) + g1a(Size + 1: 2*Size,2*Size+1: 3*Size);
[L1, U1]=lu(gss0);
P1 = eye(size(gss0));
Q1 = eye(size(gss0));
L = kron(eye(periods),L1);
U = kron(eye(periods),U1);
P = kron(eye(periods),P1);
Q = kron(eye(periods),Q1);
[za,flag1] = bicgstab1(g1a,b,1e-7,Blck_size*periods,L,U, P, Q);
else
Size = Blck_size;
gss0 = g1a(Size + 1: 2*Size,1: Size) + g1a(Size + 1: 2*Size,Size+1: 2*Size) + g1a(Size + 1: 2*Size,2*Size+1: 3*Size);
[L1, U1]=lu(gss0);
L1 = kron(eye(periods),L1);
U1 = kron(eye(periods),U1);
[za,flag1] = bicgstab(g1a,b,1e-7,Blck_size*periods,L1,U1);
end;
if (flag1>0 || reduced)
if(flag1==1)
disp(['Error in simul: No convergence inside BICGSTAB after ' num2str(periods*10,'%6d') ' iterations, in block' num2str(Block_Size,'%3d')]);
......
noinst_PROGRAMS = bytecode
bytecode_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/../../sources/bytecode -I$(top_srcdir)/../../../preprocessor
bytecode_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/../../sources -I$(top_srcdir)/../../sources/bytecode -I$(top_srcdir)/../../../preprocessor
TOPDIR = $(top_srcdir)/../../sources/bytecode
......@@ -9,8 +9,10 @@ nodist_bytecode_SOURCES = \
$(TOPDIR)/Interpreter.cc \
$(TOPDIR)/Mem_Mngr.cc \
$(TOPDIR)/SparseMatrix.cc \
$(TOPDIR)/Evaluate.cc \
$(TOPDIR)/Interpreter.hh \
$(TOPDIR)/Mem_Mngr.hh \
$(TOPDIR)/SparseMatrix.hh \
$(TOPDIR)/Evaluate.hh \
$(TOPDIR)/ErrorHandling.hh
......@@ -26,10 +26,13 @@
#endif
#include "block_kalman_filter.h"
using namespace std;
//#define BLAS
#define DIRECT
#define BLAS
//#define CUBLAS
#ifdef CUBLAS
#include <cuda_runtime.h>
#include <cublas_v2.h>
#endif
void
mexDisp(mxArray* P)
{
......@@ -157,7 +160,7 @@ BlockKalmanFilter::BlockKalmanFilter(int nlhs, mxArray *plhs[], int nrhs, const
if (missing_observations)
{
if (! mxIsCell (prhs[0]))
DYN_MEX_FUNC_ERR_MSG_TXT("the first input argument of block_missing_observations_kalman_filter must be a Call Array.");
DYN_MEX_FUNC_ERR_MSG_TXT("the first input argument of block_missing_observations_kalman_filter must be a Cell Array.");
pdata_index = prhs[0];
if (! mxIsDouble (prhs[1]))
DYN_MEX_FUNC_ERR_MSG_TXT("the second input argument of block_missing_observations_kalman_filter must be a scalar.");
......@@ -234,14 +237,13 @@ BlockKalmanFilter::BlockKalmanFilter(int nlhs, mxArray *plhs[], int nrhs, const
*a = mxGetPr(pa);
tmp_a = (double*)mxMalloc(n * sizeof(double));
dF = 0.0; // det(F).
p_tmp = mxCreateDoubleMatrix(n, n_state, mxREAL);
*tmp = mxGetPr(p_tmp);
p_tmp1 = mxCreateDoubleMatrix(n, n_shocks, mxREAL);
tmp1 = mxGetPr(p_tmp1);
t = 0; // Initialization of the time index.
plik = mxCreateDoubleMatrix(smpl, 1, mxREAL);
lik = mxGetPr(plik);
Inf = mxGetInf();
Inf = mxGetInf();
LIK = 0.0; // Default value of the log likelihood.
notsteady = true; // Steady state flag.
F_singular = true;
......@@ -287,6 +289,22 @@ BlockKalmanFilter::BlockKalmanFilter(int nlhs, mxArray *plhs[], int nrhs, const
iw = (lapack_int*)mxMalloc(pp * sizeof(lapack_int));
ipiv = (lapack_int*)mxMalloc(pp * sizeof(lapack_int));
info = 0;
#ifdef BLAS || CUBLAS
p_tmp = mxCreateDoubleMatrix(n, n, mxREAL);
*tmp = mxGetPr(p_tmp);
p_P_t_t1 = mxCreateDoubleMatrix(n, n, mxREAL);
*P_t_t1 = mxGetPr(p_P_t_t1);
pK = mxCreateDoubleMatrix(n, n, mxREAL);
*K = mxGetPr(pK);
p_K_P = mxCreateDoubleMatrix(n, n, mxREAL);
*K_P = mxGetPr(p_K_P);
oldK = (double*)mxMalloc(n * n * sizeof(double));
*P_mf = (double*)mxMalloc(n * n * sizeof(double));
for (int i = 0; i < n * n; i++)
oldK[i] = Inf;
#else
p_tmp = mxCreateDoubleMatrix(n, n_state, mxREAL);
*tmp = mxGetPr(p_tmp);
p_P_t_t1 = mxCreateDoubleMatrix(n_state, n_state, mxREAL);
*P_t_t1 = mxGetPr(p_P_t_t1);
pK = mxCreateDoubleMatrix(n, pp, mxREAL);
......@@ -297,6 +315,7 @@ BlockKalmanFilter::BlockKalmanFilter(int nlhs, mxArray *plhs[], int nrhs, const
*P_mf = (double*)mxMalloc(n * pp * sizeof(double));
for (int i = 0; i < n * pp; i++)
oldK[i] = Inf;
#endif
}
void
......@@ -424,17 +443,17 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[], double *P_mf,
}
/* Computes the norm of iF */
double anorm = dlange("1", &size_d_index, &size_d_index, iF, &size_d_index, w);
/* Computes the norm of iF */
double anorm = dlange("1", &size_d_index, &size_d_index, iF, &size_d_index, w);
//mexPrintf("anorm = %f\n",anorm);
/* Modifies F in place with a LU decomposition */
dgetrf(&size_d_index, &size_d_index, iF, &size_d_index, ipiv, &info);
if (info != 0) fprintf(stderr, "dgetrf failure with error %d\n", (int) info);
/* Modifies F in place with a LU decomposition */
dgetrf(&size_d_index, &size_d_index, iF, &size_d_index, ipiv, &info);
if (info != 0) mexPrintf("dgetrf failure with error %d\n", (int) info);
/* Computes the reciprocal norm */
dgecon("1", &size_d_index, iF, &size_d_index, &anorm, &rcond, w, iw, &info);
if (info != 0) fprintf(stderr, "dgecon failure with error %d\n", (int) info);
/* Computes the reciprocal norm */
dgecon("1", &size_d_index, iF, &size_d_index, &anorm, &rcond, w, iw, &info);
if (info != 0) mexPrintf("dgecon failure with error %d\n", (int) info);
if (rcond < kalman_tol)
if (not_all_abs_F_bellow_crit(F, size_d_index * size_d_index, kalman_tol)) //~all(abs(F(:))<kalman_tol)
......@@ -506,7 +525,7 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[], double *P_mf,
//iF = inv(F);
//int lwork = 4/*2*/* pp;
dgetri(&size_d_index, iF, &size_d_index, ipiv, w, &lw, &info);
if (info != 0) fprintf(stderr, "dgetri failure with error %d\n", (int) info);
if (info != 0) mexPrintf("dgetri failure with error %d\n", (int) info);
//lik(t) = log(dF)+transpose(v)*iF*v;
#ifdef USE_OMP
......@@ -628,14 +647,126 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[], double *P_mf,
double one = 1.0;
double zero = 0.0;
memcpy(P, QQ, n * n *sizeof(double));
dsymm("R", "U", &n, &n,
&one, P_t_t1, &n,
T, &n, &zero,
tmp, &n);
dgemm("N", "T", &n, &n,
&n, &one, tmp, &n,
T, &n, &one,
P, &n);
blas_int n_b = n;
/*mexPrintf("sizeof(n_b)=%d, n_b=%d, sizeof(n)=%d, n=%d\n",sizeof(n_b),n_b,sizeof(n),n);
mexEvalString("drawnow;");*/
dsymm("R", "U", &n_b, &n_b,
&one, P_t_t1, &n_b,
T, &n_b, &zero,
tmp, &n_b);
dgemm("N", "T", &n_b, &n_b,
&n_b, &one, tmp, &n_b,
T, &n_b, &one,
P, &n_b);
#else
#ifdef CUBLAS
for (int i = 0; i < n; i++)
for (int j = i; j < n; j++)
{
double res = 0.0;
//int j_pp = j * pp;
for (int k = 0; k < size_d_index; k++)
res += K[i + k * n] * P_mf[k + j * size_d_index];
K_P[i * n + j] = K_P[j * n + i] = res;
}
//#pragma omp parallel for shared(P, K_P, P_t_t1)
for (int i = size_d_index; i < n; i++)
for (int j = i; j < n; j++)
{
unsigned int k = i * n + j;
P_t_t1[j * n + i] = P_t_t1[k] = P[k] - K_P[k];
}
mexPrintf("CudaBLAS\n");
mexEvalString("drawnow;");
double one = 1.0;
double zero = 0.0;
cublasStatus_t status;
cublasHandle_t handle;
status = cublasCreate(&handle);
if (status != CUBLAS_STATUS_SUCCESS)
{
mexPrintf("!!!! CUBLAS initialization error\n");
return false;
}
/*int device;
cudaGetDevice(&device);*/
int n2 = n * n;
double* d_A = 0;
double* d_B = 0;
double* d_C = 0;
double* d_D = 0;
// Allocate device memory for the matrices
if (cudaMalloc((void**)&d_A, n2 * sizeof(double)) != cudaSuccess)
{
mexPrintf("!!!! device memory allocation error (allocate A)\n");
return false;
}
if (cudaMalloc((void**)&d_B, n2 * sizeof(d_B[0])) != cudaSuccess)
{
mexPrintf("!!!! device memory allocation error (allocate B)\n");
return false;
}
if (cudaMalloc((void**)&d_C, n2 * sizeof(d_C[0])) != cudaSuccess)
{
mexPrintf("!!!! device memory allocation error (allocate C)\n");
return false;
}
if (cudaMalloc((void**)&d_D, n2 * sizeof(d_D[0])) != cudaSuccess)
{
mexPrintf("!!!! device memory allocation error (allocate D)\n");
return false;
}
// Initialize the device matrices with the host matrices
status = cublasSetVector(n2, sizeof(P_t_t1[0]), P_t_t1, 1, d_A, 1);
if (status != CUBLAS_STATUS_SUCCESS)
{
mexPrintf("!!!! device access error (write A)\n");
return false;
}
status = cublasSetVector(n2, sizeof(T[0]), T, 1, d_B, 1);
if (status != CUBLAS_STATUS_SUCCESS)
{
mexPrintf("!!!! device access error (write B)\n");
return false;
}
status = cublasSetVector(n2, sizeof(tmp[0]), tmp, 1, d_C, 1);
if (status != CUBLAS_STATUS_SUCCESS)
{
mexPrintf("!!!! device access error (write C)\n");
return false;
}
mexPrintf("just before calling\n");
mexEvalString("drawnow;");
status = cublasSetVector(n2, sizeof(QQ[0]), QQ, 1, d_D, 1);
if (status != CUBLAS_STATUS_SUCCESS)
{
mexPrintf("!!!! device access error (write D)\n");
return false;
}
// Performs operation using plain C code
cublasDsymm(handle, CUBLAS_SIDE_RIGHT, CUBLAS_FILL_MODE_UPPER, n, n,
&one, d_A, n,
d_B, n, &zero,
d_C, n);
/*dgemm("N", "T", &n_b, &n_b,
&n_b, &one, tmp, &n_b,
T, &n_b, &one,
P, &n_b);*/
cublasDgemm(handle, CUBLAS_OP_N, CUBLAS_OP_T, n, n,
n, &one, d_C, n,
d_B, n, &one,
d_D, n);
//double_symm(n, &one, h_A, h_B, &zero, h_C);
status = cublasGetVector(n2, sizeof(P[0]), d_D, 1, P, 1);
if (status != CUBLAS_STATUS_SUCCESS)
{
mexPrintf("!!!! device access error (read P)\n");
return false;
}
#else
#ifdef USE_OMP
#pragma omp parallel for shared(K_P) num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
......@@ -717,7 +848,7 @@ BlockKalmanFilter::block_kalman_filter(int nlhs, mxArray *plhs[], double *P_mf,
P[i + j * n] = P[j + i * n];
}
#endif
#endif
if (t >= no_more_missing_observations)
{
double max_abs = 0.0;
......
......@@ -23,24 +23,138 @@
#include <cstring>
#include <iostream>
#include <sstream>
#include <map>
#define BYTE_CODE
#include "CodeInterpreter.hh"
#ifdef DEBUG_EX
# include <math>
# include <math.h>
# include "mex_interface.hh"
#endif
#ifdef OCTAVE_MEX_FILE
# define CHAR_LENGTH 1
#else
# define CHAR_LENGTH 2
#endif
#ifdef _MSC_VER
#include <limits>
#define M_E 2.71828182845904523536
#define M_LOG2E 1.44269504088896340736
#define M_LOG10E 0.434294481903251827651
#define M_LN2 0.693147180559945309417
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.785398163397448309616
#define M_1_PI 0.318309886183790671538
#define M_2_PI 0.636619772367581343076
#define M_1_SQRTPI 0.564189583547756286948
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT_2 0.707106781186547524401
#define NAN numeric_limits<double>::quiet_NaN()
#define isnan(x) _isnan(x)
#define isinf(x) (!_finite(x))
#define fpu_error(x) (isinf(x) || isnan(x))
class MSVCpp_missings
{
public:
inline double
asinh(double x) const
{
if(x==0.0)
return 0.0;
double ax = abs(x);
return log(x+ax*sqrt(1.+1./(ax*ax)));
}
inline double
acosh(double x) const
{
if(x==0.0)
return 0.0;
double ax = abs(x);
return log(x+ax*sqrt(1.-1./(ax*ax)));
}
inline double
atanh(double x) const
{
return log((1+x)/(1-x))/2;
}
inline double
erf(double x) const
{
const double a1 = -1.26551223, a2 = 1.00002368,
a3 = 0.37409196, a4 = 0.09678418,
a5 = -0.18628806, a6 = 0.27886807,
a7 = -1.13520398, a8 = 1.48851587,
a9 = -0.82215223, a10 = 0.17087277;
double v = 1;
double z = abs(x);
if (z <= 0)
return v;
double t = 1 / (1 + 0.5 * z);
v = t*exp((-z*z) +a1+t*(a2+t*(a3+t*(a4+t*(a5+t*(a6+t*(a7+t*(a8+t*(a9+t*a10)))))))));
if (x < 0)
v = 2 - v;
return 1 - v;
}
inline double
nearbyint(double x) const
{
return floor(x + 0.5);
}
inline double
fmax(double x, double y) const
{
if (x > y)
return x;
else
return y;
}
inline double
fmin(double x, double y) const
{
if (x < y)
return x;
else
return y;
}
};
#endif
//#define DEBUG
using namespace std;
const int NO_ERROR_ON_EXIT = 0;
const int ERROR_ON_EXIT = 1;
typedef vector<pair<Tags, void * > > code_liste_type;
typedef code_liste_type::const_iterator it_code_type;
class GeneralExceptionHandling
{
string ErrorMsg;
public:
#ifdef _MSC_VER_
~GeneralExceptionHandling()
{
FreeLibrary(hinstLib);