- Correction in the memory allocation (new - delete used with object)

- bytecode test upgraded

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3075 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
ferhat 2009-10-23 11:23:47 +00:00
parent f5037df3cd
commit 079b5a7abb
3 changed files with 39 additions and 3 deletions

View File

@ -160,7 +160,11 @@ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*thro
if(evaluate)
Stack.push(ya[(it_+lag)*y_size+var]);
else
{
/*mexPrintf(" y[%d, %d]=",(it_+lag)*y_size, var );
mexPrintf("%f\n",y[(it_+lag)*y_size+var]);*/
Stack.push(y[(it_+lag)*y_size+var]);
}
#ifdef DEBUG
tmp_out << " y[" << it_+lag << ", " << var << "](" << y[(it_+lag)*y_size+var] << ")";
#endif
@ -1462,7 +1466,7 @@ Interpreter::compute_blocks(string file_name, string bin_basename, bool steady_s
else
result = simulate_a_block(fb->get_size(), fb->get_type(), file_name, bin_basename,true, steady_state, Block_Count,
fb->get_is_linear(), fb->get_endo_nbr(), fb->get_Max_Lag(), fb->get_Max_Lead(), fb->get_u_count_int());
mxFree(fb);
delete fb;
}
if(!result)
go_on = false;

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2007-2008 Dynare Team
*
* This file is part of Dynare.
@ -76,6 +76,7 @@ main( int argc, const char* argv[] )
int i, row_y, col_y, row_x, col_x;
double *yd, *xd;
double *direction;
int minimal_solving_periods;
string file_name(argv[1]);
@ -108,6 +109,7 @@ main( int argc, const char* argv[] )
double markowitz_c = f_tmp;
fscanf(fid,"%f",&f_tmp);
double solve_tolf = f_tmp;
fscanf(fid,"%d",&minimal_solving_periods);
fclose(fid);
tmp_out.str("");
@ -124,6 +126,12 @@ main( int argc, const char* argv[] )
fscanf(fid,"%d",&col_x);
fscanf(fid,"%d",&row_y);
fscanf(fid,"%d",&col_y);
int steady_row_y, steady_col_y;
int steady_row_x, steady_col_x;
fscanf(fid,"%d",&steady_row_y);
fscanf(fid,"%d",&steady_col_y);
fscanf(fid,"%d",&steady_row_x);
fscanf(fid,"%d",&steady_col_x);
int nb_row_xd;
fscanf(fid,"%d",&nb_row_xd);
double * params = (double*)malloc(nb_params*sizeof(params[0]));
@ -148,6 +156,19 @@ main( int argc, const char* argv[] )
fscanf(fid,"%f",&f_tmp);
xd[i] = f_tmp;
}
double *steady_yd, *steady_xd;
steady_yd = (double*)malloc(steady_row_y*steady_col_y*sizeof(steady_yd[0]));
steady_xd = (double*)malloc(steady_row_x*steady_col_x*sizeof(steady_xd[0]));
for(i=0; i < steady_row_y*steady_col_y; i++)
{
fscanf(fid,"%f",&f_tmp);
steady_yd[i] = f_tmp;
}
for(i=0; i < steady_row_x*steady_col_x; i++)
{
fscanf(fid,"%f",&f_tmp);
steady_xd[i] = f_tmp;
}
fclose(fid);
int size_of_direction=col_y*row_y*sizeof(double);
@ -166,7 +187,9 @@ main( int argc, const char* argv[] )
int y_size=row_y;
int nb_row_x=row_x;
clock_t t0= clock();
Interpreter interprete(params, y, ya, x, direction, y_size, nb_row_x, nb_row_xd, periods, y_kmin, y_kmax, maxit_, solve_tolf, size_of_direction, slowc, y_decal, markowitz_c, file_name);
Interpreter interprete( params, y, ya, x, steady_yd, steady_xd, direction, y_size, nb_row_x, nb_row_xd, periods, y_kmin, y_kmax, maxit_, solve_tolf, size_of_direction, slowc, y_decal, markowitz_c, file_name, minimal_solving_periods);
string f(file_name);
interprete.compute_blocks(f, f, steady_state, evaluate);
clock_t t1= clock();

View File

@ -6,6 +6,7 @@ global M_ oo_ options_;
fprintf(fid,'%6.20f\n',options_.slowc);
fprintf(fid,'%6.20f\n',options_.markowitz);
fprintf(fid,'%6.20f\n',options_.dynatol);
fprintf(fid,'%d\n',options_.minimal_solving_periods);
fclose(fid);
fid = fopen([M_.fname '_M.txt'],'wt');
@ -18,11 +19,19 @@ global M_ oo_ options_;
fprintf(fid,'%d\n',M_.endo_nbr);
fprintf(fid,'%d\n',size(oo_.endo_simul, 2));
fprintf(fid,'%d\n',M_.exo_det_nbr);
fprintf(fid,'%d\n',size(oo_.steady_state,1));
fprintf(fid,'%d\n',size(oo_.steady_state,2));
fprintf(fid,'%d\n',size(oo_.exo_steady_state,1));
fprintf(fid,'%d\n',size(oo_.exo_steady_state,2));
fprintf(fid,'%6.20f\n',M_.params);
fclose(fid);
fid = fopen([M_.fname '_oo.txt'],'wt');
fprintf(fid,'%6.20f\n',oo_.endo_simul);
fprintf(fid,'%6.20f\n',oo_.exo_simul);
fprintf(fid,'%6.20f\n',oo_.steady_state);
fprintf(fid,'%6.20f\n',oo_.exo_steady_state);
fclose(fid);