diff --git a/mex/sources/bytecode/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc index 0ca9e5890924c9c7f038ec05a12bc5abc989e7f6..26784fa7b9922e95ebd6288fb21af1bfa6aa2a0a 100644 --- a/mex/sources/bytecode/Interpreter.cc +++ b/mex/sources/bytecode/Interpreter.cc @@ -290,7 +290,7 @@ Interpreter::evaluate_a_block(bool initialization, bool single_block, const stri case BlockSimulationType::solveForwardComplete: if (initialization) { - fixe_u(&u, u_count_int, u_count_int); + fixe_u(); Read_SparseMatrix(bin_base_name, size, 1, 0, 0, false, stack_solve_algo, solve_algo); } #ifdef DEBUG @@ -385,7 +385,7 @@ Interpreter::evaluate_a_block(bool initialization, bool single_block, const stri case BlockSimulationType::solveBackwardComplete: if (initialization) { - fixe_u(&u, u_count_int, u_count_int); + fixe_u(); Read_SparseMatrix(bin_base_name, size, 1, 0, 0, false, stack_solve_algo, solve_algo); } r = static_cast<double *>(mxMalloc(size*sizeof(double))); @@ -420,7 +420,7 @@ Interpreter::evaluate_a_block(bool initialization, bool single_block, const stri case BlockSimulationType::solveTwoBoundariesComplete: if (initialization) { - fixe_u(&u, u_count_int, u_count_int); + fixe_u(); Read_SparseMatrix(bin_base_name, size, periods, y_kmin, y_kmax, true, stack_solve_algo, solve_algo); } u_count = u_count_int*(periods+y_kmax+y_kmin); @@ -495,7 +495,7 @@ Interpreter::simulate_a_block(const vector_table_conditional_local_type &vector_ evaluate_a_block(true, single_block, bin_base_name); else { - fixe_u(&u, u_count_int, u_count_int); + fixe_u(); Read_SparseMatrix(bin_base_name, size, 1, 0, 0, false, stack_solve_algo, solve_algo); } Per_u_ = 0; @@ -517,7 +517,7 @@ Interpreter::simulate_a_block(const vector_table_conditional_local_type &vector_ evaluate_a_block(true, single_block, bin_base_name); else { - fixe_u(&u, u_count_int, u_count_int); + fixe_u(); Read_SparseMatrix(bin_base_name, size, 1, 0, 0, false, stack_solve_algo, solve_algo); } Per_u_ = 0; @@ -546,7 +546,7 @@ Interpreter::simulate_a_block(const vector_table_conditional_local_type &vector_ evaluate_a_block(true, single_block, bin_base_name); else { - fixe_u(&u, u_count_int, u_count_int); + fixe_u(); Read_SparseMatrix(bin_base_name, size, periods, y_kmin, y_kmax, true, stack_solve_algo, solve_algo); } u_count = u_count_int*(periods+y_kmax+y_kmin); @@ -5021,18 +5021,18 @@ Interpreter::Simulate_Newton_Two_Boundaries(bool cvg, const vector_table_conditi } void -Interpreter::fixe_u(double **u, int u_count_int, int max_lag_plus_max_lead_plus_1) +Interpreter::fixe_u() { u_count = u_count_int * periods; u_count_alloc = 2*u_count; #ifdef DEBUG mexPrintf("fixe_u : alloc(%d double)\n", u_count_alloc); #endif - *u = static_cast<double *>(mxMalloc(u_count_alloc*sizeof(double))); - test_mxMalloc(*u, __LINE__, __FILE__, __func__, u_count_alloc*sizeof(double)); + u = static_cast<double *>(mxMalloc(u_count_alloc*sizeof(double))); + test_mxMalloc(u, __LINE__, __FILE__, __func__, u_count_alloc*sizeof(double)); #ifdef DEBUG - mexPrintf("*u=%d\n", *u); + mexPrintf("u=%d\n", u); #endif - fill_n(*u, u_count_alloc, 0); - u_count_init = max_lag_plus_max_lead_plus_1; + fill_n(u, u_count_alloc, 0); + u_count_init = u_count_int; } diff --git a/mex/sources/bytecode/Interpreter.hh b/mex/sources/bytecode/Interpreter.hh index 2dbc0a14f059a7fca2a7ca3ddb0a68cd892a75bf..ee4b61baf6938c2b385b893a3203b79d371f367a 100644 --- a/mex/sources/bytecode/Interpreter.hh +++ b/mex/sources/bytecode/Interpreter.hh @@ -169,7 +169,7 @@ private: pair<bool, vector<int>> MainLoop(const string &bin_basename, bool evaluate, int block, bool constrained, const vector<s_plan> &sconstrained_extended_path, const vector_table_conditional_local_type &vector_table_conditional_local); void Simulate_Newton_Two_Boundaries(bool cvg, const vector_table_conditional_local_type &vector_table_conditional_local); void Simulate_Newton_One_Boundary(bool forward); - void fixe_u(double **u, int u_count_int, int max_lag_plus_max_lead_plus_1); + void fixe_u(); void Read_SparseMatrix(const string &file_name, int Size, int periods, int y_kmin, int y_kmax, bool two_boundaries, int stack_solve_algo, int solve_algo); void Singular_display(int block, int Size); void End_Solver();