Bytecode: simplify Interpreter::simple_bksub()

kalman-mex
Sébastien Villemot 2023-10-20 11:43:48 -04:00
parent 8573c6d06a
commit 12a0781bc4
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 5 additions and 6 deletions

View File

@ -2298,11 +2298,11 @@ Interpreter::bksub(int tbreak, int last_period)
}
void
Interpreter::simple_bksub(int it_, int Size, double slowc_l)
Interpreter::simple_bksub()
{
for (int i = 0; i < y_size; i++)
y[i+it_*y_size] = ya[i+it_*y_size];
for (int i = Size-1; i >= 0; i--)
for (int i = size-1; i >= 0; i--)
{
int pos = pivot[i];
auto [nb_var, first] = At_Row(pos);
@ -2317,7 +2317,7 @@ Interpreter::simple_bksub(int it_, int Size, double slowc_l)
}
yy = -(yy+y[eq+it_*y_size]+u[b[pos]]);
direction[eq+it_*y_size] = yy;
y[eq+it_*y_size] += slowc_l*yy;
y[eq+it_*y_size] += slowc*yy;
}
}
@ -3810,12 +3810,11 @@ Interpreter::Solve_ByteCode_Sparse_GaussianElimination()
u[b[row]] -= u[b[pivj]]*first_elem;
}
}
double slowc_lbx = slowc;
for (int i = 0; i < y_size; i++)
ya[i+it_*y_size] = y[i+it_*y_size];
slowc_save = slowc;
simple_bksub(it_, size, slowc_lbx);
simple_bksub();
End_GE();
mxFree(piv_v);
mxFree(pivj_v);

View File

@ -212,7 +212,7 @@ private:
int complete(int beg_t);
void bksub(int tbreak, int last_period);
void simple_bksub(int it_, int Size, double slowc_l);
void simple_bksub();
// Computes Aᵀ where A is are sparse. The result is sparse.
static mxArray *Sparse_transpose(const mxArray *A_m);
// Computes Aᵀ·B where A and B are sparse. The result is sparse.