Commit aa23ed73 authored by sebastien's avatar sebastien
Browse files

preprocessor + bytecode DLL: various enhancements to block and bytecode options (changes by Ferhat)


git-svn-id: https://www.dynare.org/svn/dynare/trunk@3244 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 9f57f73d
...@@ -25,7 +25,7 @@ function model_info; ...@@ -25,7 +25,7 @@ function model_info;
nb_blocks=length(M_.block_structure.block); nb_blocks=length(M_.block_structure.block);
fprintf('The model has %d equations and is decomposed in %d blocks as follow:\n',M_.endo_nbr,nb_blocks); fprintf('The model has %d equations and is decomposed in %d blocks as follow:\n',M_.endo_nbr,nb_blocks);
fprintf('===============================================================================================================\n'); fprintf('===============================================================================================================\n');
fprintf('| %10s | %10s | %30s | %14s | %31s |\n','Block n','Size','Block Type','E quation','Dependent variable'); fprintf('| %10s | %10s | %30s | %14s | %31s |\n','Block no','Size','Block Type',' Equation','Dependent variable');
fprintf('|============|============|================================|================|=================================|\n'); fprintf('|============|============|================================|================|=================================|\n');
for i=1:nb_blocks for i=1:nb_blocks
size_block=length(M_.block_structure.block(i).equation); size_block=length(M_.block_structure.block(i).equation);
...@@ -44,7 +44,7 @@ function model_info; ...@@ -44,7 +44,7 @@ function model_info;
fprintf('\n'); fprintf('\n');
for k=1:M_.maximum_endo_lag+M_.maximum_endo_lead+1 for k=1:M_.maximum_endo_lag+M_.maximum_endo_lead+1
if(k==M_.maximum_endo_lag+1) if(k==M_.maximum_endo_lag+1)
fprintf('%-30s %s','the variable','is used in equations contemporously'); fprintf('%-30s %s','the variable','is used in equations ontemporaneously');
elseif(k<M_.maximum_endo_lag+1) elseif(k<M_.maximum_endo_lag+1)
fprintf('%-30s %s %d','the variable','is used in equations with lag ',M_.maximum_endo_lag+1-k); fprintf('%-30s %s %d','the variable','is used in equations with lag ',M_.maximum_endo_lag+1-k);
else else
......
...@@ -110,7 +110,7 @@ function steady_() ...@@ -110,7 +110,7 @@ function steady_()
ss(M_.blocksMFS{b}), ... ss(M_.blocksMFS{b}), ...
options_.jacobian_flag, b); options_.jacobian_flag, b);
if check ~= 0 if check ~= 0
error('STEADY: convergence problems') error(['STEADY: convergence problems in block ' int2str(b)])
end end
ss(M_.blocksMFS{b}) = y; ss(M_.blocksMFS{b}) = y;
end end
......
...@@ -11,7 +11,6 @@ nodist_bytecode_SOURCES = \ ...@@ -11,7 +11,6 @@ nodist_bytecode_SOURCES = \
Interpreter.cc \ Interpreter.cc \
Mem_Mngr.cc \ Mem_Mngr.cc \
SparseMatrix.cc \ SparseMatrix.cc \
bytecode.hh \
Interpreter.hh \ Interpreter.hh \
Mem_Mngr.hh \ Mem_Mngr.hh \
SparseMatrix.hh SparseMatrix.hh
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include "Interpreter.hh" #include "Interpreter.hh"
#define BIG 1.0e+8; #define BIG 1.0e+8;
#define SMALL 1.0e-5; #define SMALL 1.0e-5;
//#define DEBUG
Interpreter::Interpreter(double *params_arg, double *y_arg, double *ya_arg, double *x_arg, double *steady_y_arg, double *steady_x_arg, Interpreter::Interpreter(double *params_arg, double *y_arg, double *ya_arg, double *x_arg, double *steady_y_arg, double *steady_x_arg,
double *direction_arg, int y_size_arg, double *direction_arg, int y_size_arg,
...@@ -59,30 +57,12 @@ Interpreter::Interpreter(double *params_arg, double *y_arg, double *ya_arg, doub ...@@ -59,30 +57,12 @@ Interpreter::Interpreter(double *params_arg, double *y_arg, double *ya_arg, doub
double double
Interpreter::pow1(double a, double b) Interpreter::pow1(double a, double b)
{ {
/*double r;
if(a>=0)
r=pow_(a,b);
else
{
//r=0;
//max_res=res1=res2=BIG;
if(error_not_printed)
{
mexPrintf("Error: X^a with X<0\n");
error_not_printed = false;
}
//r = BIG;
//r = -pow_(-a, b);
//r = 0;
//r = SMALL;
//r = pow_(-a, b);
}*/
double r = pow_(a, b); double r = pow_(a, b);
if (isnan(r) || isinf(r)) if (isnan(r) || isinf(r))
{ {
if(a<0 && error_not_printed) if(a<0 && error_not_printed)
{ {
mexPrintf("Error: X^a with X=%5.25f\n",a); mexPrintf("Error: X^a with X=%5.15f\n",a);
error_not_printed = false; error_not_printed = false;
r = 0.0000000000000000000000001; r = 0.0000000000000000000000001;
} }
...@@ -96,30 +76,12 @@ Interpreter::pow1(double a, double b) ...@@ -96,30 +76,12 @@ Interpreter::pow1(double a, double b)
double double
Interpreter::log1(double a) Interpreter::log1(double a)
{ {
/*double r;
if(a>=0)
r=pow_(a,b);
else
{
//r=0;
//max_res=res1=res2=BIG;
if(error_not_printed)
{
mexPrintf("Error: X^a with X<0\n");
error_not_printed = false;
}
//r = BIG;
//r = -pow_(-a, b);
//r = 0;
//r = SMALL;
//r = pow_(-a, b);
}*/
double r = log(a); double r = log(a);
if (isnan(r) || isinf(r)) if (isnan(r) || isinf(r))
{ {
if(a<=0 && error_not_printed) if(a<=0 && error_not_printed)
{ {
mexPrintf("Error: log(X) with X<=0\n"); mexPrintf("Error: log(X) with X=%5.15f\n",a);
error_not_printed = false; error_not_printed = false;
} }
res1=NAN; res1=NAN;
...@@ -129,10 +91,8 @@ Interpreter::log1(double a) ...@@ -129,10 +91,8 @@ Interpreter::log1(double a)
return r; return r;
} }
void void
Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*throw(EvalException)*/ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num)
{ {
int var, lag = 0, op; int var, lag = 0, op;
ostringstream tmp_out; ostringstream tmp_out;
...@@ -161,9 +121,7 @@ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*thro ...@@ -161,9 +121,7 @@ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*thro
Stack.push(ya[(it_+lag)*y_size+var]); Stack.push(ya[(it_+lag)*y_size+var]);
else else
{ {
/*mexPrintf(" y[%d, %d]=",(it_+lag)*y_size, var ); Stack.push(y[(it_+lag)*y_size+var]);
mexPrintf("%f\n",y[(it_+lag)*y_size+var]);*/
Stack.push(y[(it_+lag)*y_size+var]);
} }
#ifdef DEBUG #ifdef DEBUG
tmp_out << " y[" << it_+lag << ", " << var << "](" << y[(it_+lag)*y_size+var] << ")"; tmp_out << " y[" << it_+lag << ", " << var << "](" << y[(it_+lag)*y_size+var] << ")";
...@@ -175,7 +133,6 @@ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*thro ...@@ -175,7 +133,6 @@ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*thro
Stack.push(x[it_+lag+var*nb_row_x]); Stack.push(x[it_+lag+var*nb_row_x]);
#ifdef DEBUG #ifdef DEBUG
tmp_out << " x[" << it_+lag << ", " << var << "](" << x[it_+lag+var*nb_row_x] << ")"; tmp_out << " x[" << it_+lag << ", " << var << "](" << x[it_+lag+var*nb_row_x] << ")";
//mexPrintf(" x[%d, %d](%f)\n", it_+lag, var, x[it_+lag+var*nb_row_x]);
#endif #endif
break; break;
case eExogenousDet : case eExogenousDet :
...@@ -681,7 +638,6 @@ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*thro ...@@ -681,7 +638,6 @@ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*thro
#endif #endif
break; break;
default: default:
/*throw EvalException();*/
; ;
} }
break; break;
...@@ -703,14 +659,12 @@ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*thro ...@@ -703,14 +659,12 @@ Interpreter::compute_block_time(int Per_u_, bool evaluate, int block_num) /*thro
if (Stack.size()>0) if (Stack.size()>0)
{ {
mexPrintf("error: Stack not empty!\n"); mexPrintf("error: Stack not empty!\n");
mexEvalString("st=fclose('all');clear all;"); mexErrMsgTxt("End of bytecode");
mexErrMsgTxt("End of simulate");
} }
break; break;
default : default :
mexPrintf("Unknown opcode %d!! FENDEQU=%d\n",it_code->first,FENDEQU); mexPrintf("Unknown opcode %d!! FENDEQU=%d\n",it_code->first,FENDEQU);
mexEvalString("st=fclose('all');clear all;"); mexErrMsgTxt("End of bytecode");
mexErrMsgTxt("End of simulate");
break; break;
} }
it_code++; it_code++;
...@@ -964,8 +918,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name, ...@@ -964,8 +918,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
if (!cvg) if (!cvg)
{ {
mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n",Block_Count,it_,iter); mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n",Block_Count,it_,iter);
mexEvalString("st=fclose('all');clear all;"); mexErrMsgTxt("End of bytecode");
mexErrMsgTxt("End of simulate");
} }
} }
} }
...@@ -1025,8 +978,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name, ...@@ -1025,8 +978,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
if (!cvg) if (!cvg)
{ {
mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n",Block_Count,it_,iter); mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n",Block_Count,it_,iter);
mexEvalString("st=fclose('all');clear all;"); mexErrMsgTxt("End of bytecode");
mexErrMsgTxt("End of simulate");
} }
} }
} }
...@@ -1080,7 +1032,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name, ...@@ -1080,7 +1032,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
} }
if (!cvg) if (!cvg)
{ {
mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n", Block_Count, it_, iter); mexPrintf("Convergence not achieved in block %d, after %d iterations\n", Block_Count, iter);
return false; return false;
} }
} }
...@@ -1143,8 +1095,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name, ...@@ -1143,8 +1095,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
if (!cvg) if (!cvg)
{ {
mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n", Block_Count, it_, iter); mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n", Block_Count, it_, iter);
mexEvalString("st=fclose('all');clear all;"); mexErrMsgTxt("End of bytecode");
mexErrMsgTxt("End of simulate");
} }
} }
} }
...@@ -1216,7 +1167,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name, ...@@ -1216,7 +1167,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
} }
if (!cvg) if (!cvg)
{ {
mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n", Block_Count, it_, iter); mexPrintf("Convergence not achieved in block %d, after %d iterations\n", Block_Count, iter);
return false; return false;
} }
} }
...@@ -1279,8 +1230,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name, ...@@ -1279,8 +1230,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
if (!cvg) if (!cvg)
{ {
mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n", Block_Count, it_, iter); mexPrintf("Convergence not achieved in block %d, at time %d after %d iterations\n", Block_Count, it_, iter);
mexEvalString("st=fclose('all');clear all;"); mexErrMsgTxt("End of bytecode");
mexErrMsgTxt("End of simulate");
} }
} }
} }
...@@ -1364,8 +1314,6 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name, ...@@ -1364,8 +1314,6 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
cvg = false; cvg = false;
else else
cvg=(max_res<solve_tolf); cvg=(max_res<solve_tolf);
/*if(cvg)
continue;*/
u_count=u_count_saved; u_count=u_count_saved;
simulate_NG1(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, periods, true, cvg, iter, minimal_solving_periods); simulate_NG1(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, periods, true, cvg, iter, minimal_solving_periods);
iter++; iter++;
...@@ -1373,8 +1321,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name, ...@@ -1373,8 +1321,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
if (!cvg) if (!cvg)
{ {
mexPrintf("Convergence not achieved in block %d, after %d iterations\n",Block_Count, iter); mexPrintf("Convergence not achieved in block %d, after %d iterations\n",Block_Count, iter);
mexEvalString("st=fclose('all');clear all;"); mexErrMsgTxt("End of bytecode");
mexErrMsgTxt("End of simulate");
} }
} }
else else
...@@ -1411,9 +1358,8 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name, ...@@ -1411,9 +1358,8 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
break; break;
default: default:
mexPrintf("Unknown type =%d\n",type); mexPrintf("Unknown type =%d\n",type);
mexEvalString("st=fclose('all');clear all;");
mexEvalString("drawnow;"); mexEvalString("drawnow;");
mexErrMsgTxt("End of simulate"); mexErrMsgTxt("End of bytecode");
} }
return true; return true;
} }
...@@ -1436,7 +1382,6 @@ Interpreter::compute_blocks(string file_name, string bin_basename, bool steady_s ...@@ -1436,7 +1382,6 @@ Interpreter::compute_blocks(string file_name, string bin_basename, bool steady_s
{ {
mexPrintf("%s.cod Cannot be opened\n",file_name.c_str()); mexPrintf("%s.cod Cannot be opened\n",file_name.c_str());
mexEvalString("drawnow;"); mexEvalString("drawnow;");
mexEvalString("st=fclose('all');clear all;");
filename+=" stopped"; filename+=" stopped";
mexEvalString("drawnow;"); mexEvalString("drawnow;");
mexErrMsgTxt(filename.c_str()); mexErrMsgTxt(filename.c_str());
...@@ -1500,9 +1445,8 @@ Interpreter::compute_blocks(string file_name, string bin_basename, bool steady_s ...@@ -1500,9 +1445,8 @@ Interpreter::compute_blocks(string file_name, string bin_basename, bool steady_s
break; break;
default : default :
mexPrintf("Unknown command \n"); mexPrintf("Unknown command \n");
mexEvalString("st=fclose('all');clear all;");
mexEvalString("drawnow;"); mexEvalString("drawnow;");
mexErrMsgTxt("End of simulate"); mexErrMsgTxt("End of bytecode");
break; break;
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Dynare. If not, see <http://www.gnu.org/licenses/>. * along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/ */
//#include "stdint.h"
#include "Mem_Mngr.hh" #include "Mem_Mngr.hh"
Mem_Mngr::Mem_Mngr() Mem_Mngr::Mem_Mngr()
...@@ -74,7 +74,6 @@ Mem_Mngr::mxMalloc_NZE() ...@@ -74,7 +74,6 @@ Mem_Mngr::mxMalloc_NZE()
} }
else /*We have to allocate extra memory space*/ else /*We have to allocate extra memory space*/
{ {
//mexPrintf("CHUNK_SIZE=%d CHUNK_BLCK_SIZE=%d Nb_CHUNK=%d\n",CHUNK_SIZE,CHUNK_BLCK_SIZE,Nb_CHUNK);
CHUNK_SIZE+=CHUNK_BLCK_SIZE; CHUNK_SIZE+=CHUNK_BLCK_SIZE;
Nb_CHUNK++; Nb_CHUNK++;
NZE_Mem=(NonZeroElem*)mxMalloc(CHUNK_BLCK_SIZE*sizeof(NonZeroElem)); /*The block of memory allocated*/ NZE_Mem=(NonZeroElem*)mxMalloc(CHUNK_BLCK_SIZE*sizeof(NonZeroElem)); /*The block of memory allocated*/
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#ifndef MEM_MNGR_HH_INCLUDED #ifndef MEM_MNGR_HH_INCLUDED
#define MEM_MNGR_HH_INCLUDED #define MEM_MNGR_HH_INCLUDED
//#include <stack>
#include <vector> #include <vector>
#include <fstream> #include <fstream>
#ifndef DEBUG_EX #ifndef DEBUG_EX
...@@ -34,7 +34,7 @@ struct NonZeroElem ...@@ -34,7 +34,7 @@ struct NonZeroElem
{ {
int u_index; int u_index;
int r_index, c_index, lag_index; int r_index, c_index, lag_index;
NonZeroElem *NZE_R_N, *NZE_C_N/*, *NZE_C_P*/; NonZeroElem *NZE_R_N, *NZE_C_N;
}; };
typedef vector<NonZeroElem*> v_NonZeroElem; typedef vector<NonZeroElem*> v_NonZeroElem;
...@@ -42,9 +42,6 @@ typedef vector<NonZeroElem*> v_NonZeroElem; ...@@ -42,9 +42,6 @@ typedef vector<NonZeroElem*> v_NonZeroElem;
class Mem_Mngr class Mem_Mngr
{ {
public: public:
/*void write_swp_f(int *save_op_all,long int *nop_all);
bool read_swp_f(int **save_op_all,long int *nop_all);
void close_swp_f();*/
void Print_heap(); void Print_heap();
void init_Mem(); void init_Mem();
void mxFree_NZE(void* pos); void mxFree_NZE(void* pos);
...@@ -53,15 +50,11 @@ public: ...@@ -53,15 +50,11 @@ public:
void Free_All(); void Free_All();
Mem_Mngr(); Mem_Mngr();
void fixe_file_name(string filename_arg); void fixe_file_name(string filename_arg);
/*int* malloc_std(long int nop);
int* realloc_std(int* save_op_o, long int &nopa);
void chk_avail_mem(int **save_op_all,long int *nop_all,long int *nopa_all,int add, int t);*/
bool swp_f; bool swp_f;
//bool verbose;
private: private:
v_NonZeroElem Chunk_Stack; v_NonZeroElem Chunk_Stack;
int CHUNK_SIZE, CHUNK_BLCK_SIZE, Nb_CHUNK; int CHUNK_SIZE, CHUNK_BLCK_SIZE, Nb_CHUNK;
int CHUNK_heap_pos/*, CHUNK_heap_max_size*/; int CHUNK_heap_pos;
NonZeroElem** NZE_Mem_add; NonZeroElem** NZE_Mem_add;
NonZeroElem* NZE_Mem; NonZeroElem* NZE_Mem;
vector<NonZeroElem*> NZE_Mem_Allocated; vector<NonZeroElem*> NZE_Mem_Allocated;
......
...@@ -143,24 +143,6 @@ SparseMatrix::Delete(const int r, const int c) ...@@ -143,24 +143,6 @@ SparseMatrix::Delete(const int r, const int c)
{ {
NonZeroElem *first = FNZE_R[r], *firsta = NULL; NonZeroElem *first = FNZE_R[r], *firsta = NULL;
//mexPrintf("Delete r=%d, c=%d\n", r, c);
/*map<pair<int, int>,NonZeroElem*>::const_iterator it;
it = Mapped_Array.find(make_pair(r, c));
if(it==Mapped_Array.end())
mexPrintf("Not Found\n");
first = it->second;
if(it != Mapped_Array.begin())
{
it--;
if(it->first.first == r)
firsta = it->second;
else
firsta = NULL;
}
else
firsta = NULL;
Mapped_Array.erase(make_pair(r, c));*/
while (first->c_index != c) while (first->c_index != c)
{ {
firsta = first; firsta = first;
...@@ -179,14 +161,6 @@ SparseMatrix::Delete(const int r, const int c) ...@@ -179,14 +161,6 @@ SparseMatrix::Delete(const int r, const int c)
firsta = first; firsta = first;
first = first->NZE_C_N; first = first->NZE_C_N;
} }
//firsta = first->NZE_C_P;
/*if(first->NZE_C_N != NULL)
{
//mexPrintf("ultime\n");
(first->NZE_C_N)->NZE_C_P = firsta;
}*/
//mexPrintf("ok1\n");
if (firsta != NULL) if (firsta != NULL)
firsta->NZE_C_N = first->NZE_C_N; firsta->NZE_C_N = first->NZE_C_N;
...@@ -196,24 +170,6 @@ SparseMatrix::Delete(const int r, const int c) ...@@ -196,24 +170,6 @@ SparseMatrix::Delete(const int r, const int c)
u_liste.push_back(first->u_index); u_liste.push_back(first->u_index);
mem_mngr.mxFree_NZE(first); mem_mngr.mxFree_NZE(first);
NbNZCol[c]--; NbNZCol[c]--;
/*Check the deletition*/
/*int nb_var=NbNZRow[r];
first=FNZE_R[r];
for(int j=0;j<nb_var;j++)
{
if(!first)
mexPrintf("Error in Delete (Row) r=%d and c=%d \n",r,c);
first=first->NZE_R_N;
}
nb_var=NbNZCol[c];
first=FNZE_C[c];
for(int j=0;j<nb_var;j++)
{
if(!first)
mexPrintf("Error in Delete (Col) r=%d and c=%d \n",r,c);
first=first->NZE_C_N;
}*/
//mexPrintf("done\n");
} }
void void
...@@ -288,7 +244,7 @@ SparseMatrix::Insert(const int r, const int c, const int u_index, const int lag_ ...@@ -288,7 +244,7 @@ SparseMatrix::Insert(const int r, const int c, const int u_index, const int lag_
firsta->NZE_R_N = firstn; firsta->NZE_R_N = firstn;
firstn->NZE_R_N = first; firstn->NZE_R_N = first;
} }
else /*first.c_index<c*/ else
{ {
first->NZE_R_N = firstn; first->NZE_R_N = firstn;
firstn->NZE_R_N = NULL; firstn->NZE_R_N = NULL;
...@@ -309,42 +265,20 @@ SparseMatrix::Insert(const int r, const int c, const int u_index, const int lag_ ...@@ -309,42 +265,20 @@ SparseMatrix::Insert(const int r, const int c, const int u_index, const int lag_
firsta->NZE_C_N = firstn; firsta->NZE_C_N = firstn;
firstn->NZE_C_N = first; firstn->NZE_C_N = first;
} }
else /*first.r_index<r*/ else
{ {
first->NZE_C_N = firstn; first->NZE_C_N = firstn;
firstn->NZE_C_N = NULL; firstn->NZE_C_N = NULL;
} }
//if (firsta != NULL)
/*firstn->NZE_C_P = firsta;
if(first != NULL)
first->NZE_C_P = firstn;*/
NbNZCol[c]++; NbNZCol[c]++;
//Mapped_Array[make_pair(r, c)] = firstn;
/*Check the insertion*/
/*int nb_var=NbNZRow[r];
first=FNZE_R[r];
for(int j=0;j<nb_var;j++)
{
if(!first)
mexPrintf("Error in insert (Row) r=%d and c=%d \n",r,c);
first=first->NZE_R_N;
}
nb_var=NbNZCol[c];
first=FNZE_C[c];
for(int j=0;j<nb_var;j++)
{
if(!first)
mexPrintf("Error in insert (Col) r=%d and c=%d \n",r,c);
first=first->NZE_C_N;
}*/
}