Global reindentation of MEX sources

time-shift
Sébastien Villemot 2019-12-20 14:50:19 +01:00
parent 22ab507c6c
commit b901b7af86
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
25 changed files with 432 additions and 412 deletions

View File

@ -921,9 +921,9 @@ Interpreter::extended_path(string file_name, string bin_basename, bool evaluate,
MainLoop(bin_basename, code, evaluate, block, true, true, sconstrained_extended_path, vector_table_conditional_local);
for (int j = 0; j < y_size; j++)
{
y_save[j + (t + y_kmin) * y_size] = y[ j + (y_kmin) * y_size];
y_save[j + (t + y_kmin) * y_size] = y[j + y_kmin * y_size];
if (y_kmin > 0)
y[j ] = y[ j + (y_kmin) * y_size];
y[j] = y[j + y_kmin * y_size];
}
for (int j = 0; j < col_x; j++)
{

View File

@ -6458,7 +6458,6 @@ dynSparseMatrix::solve_linear(const int block_num, const int y_size, const int y
void
dynSparseMatrix::solve_non_linear(const int block_num, const int y_size, const int y_kmin, const int y_kmax, const int size)
{
max_res_idx = 0;
bool cvg = false;

View File

@ -29,7 +29,9 @@ class DynamicModelAC
protected:
int ntt; // Size of vector of temporary terms
public:
DynamicModelAC(int ntt_arg) : ntt{ntt_arg} {};
DynamicModelAC(int ntt_arg) : ntt{ntt_arg}
{
};
virtual ~DynamicModelAC() = default;
virtual void eval(const Vector &y, const Vector &x, const Vector &params, const Vector &ySteady,
Vector &residual, std::vector<TwoDMatrix> &md) = 0;

View File

@ -236,4 +236,3 @@ DynareStateNameList::DynareStateNameList(const KordpDynare &dynare, const Dynare
for (int i = 0; i < dynare.nexog(); i++)
names.emplace_back(denl.getName(i));
}

View File

@ -312,4 +312,3 @@ extern "C" {
plhs[0] = mxCreateDoubleScalar(0);
} // end of mexFunction()
} // end of extern C

View File

@ -52,7 +52,8 @@ struct ParticleWorker : public sthread::detach_thread
ynext{ynext_arg}
{
}
void operator()(std::mutex &mut) override
void
operator()(std::mutex &mut) override
{
Vector dyu(npred_both+exo_nbr);
Vector dy(dyu, 0, npred_both);

View File

@ -39,7 +39,9 @@ public:
// Used to store error messages (as exceptions cannot cross the OpenMP boundary)
static std::string error_msg;
DynamicModelCaller(bool linear_arg, bool compute_jacobian_arg) : linear{linear_arg}, compute_jacobian{compute_jacobian_arg} {};
DynamicModelCaller(bool linear_arg, bool compute_jacobian_arg) : linear{linear_arg}, compute_jacobian{compute_jacobian_arg}
{
};
virtual ~DynamicModelCaller() = default;
virtual double &y(size_t i) const = 0;
virtual double jacobian(size_t i) const = 0;
@ -65,8 +67,16 @@ private:
public:
DynamicModelDllCaller(size_t ntt, mwIndex nx, mwIndex ny, size_t ndynvars, const double *x_arg, size_t nb_row_x_arg, const double *params_arg, const double *steady_state_arg, bool linear_arg, bool compute_jacobian_arg);
virtual ~DynamicModelDllCaller() = default;
double &y(size_t i) const override { return y_p[i]; };
double jacobian(size_t i) const override { return jacobian_p[i]; };
double &
y(size_t i) const override
{
return y_p[i];
};
double
jacobian(size_t i) const override
{
return jacobian_p[i];
};
void eval(int it, double *resid) override;
static void load_dll(const std::string &basename);
static void unload_dll();
@ -85,13 +95,23 @@ private:
public:
DynamicModelMatlabCaller(std::string basename_arg, size_t ntt, size_t ndynvars, const mxArray *x_mx_arg, const mxArray *params_mx_arg, const mxArray *steady_state_mx_arg, bool linear_arg, bool compute_jacobian_arg);
~DynamicModelMatlabCaller() override;
double &y(size_t i) const override { return mxGetPr(y_mx)[i]; };
double jacobian(size_t i) const override { return jacobian_mx ? mxGetPr(jacobian_mx)[i] : std::numeric_limits<double>::quiet_NaN(); };
double &
y(size_t i) const override
{
return mxGetPr(y_mx)[i];
};
double
jacobian(size_t i) const override
{
return jacobian_mx ? mxGetPr(jacobian_mx)[i] : std::numeric_limits<double>::quiet_NaN();
};
void eval(int it, double *resid) override;
class Exception {
class Exception
{
public:
const std::string msg;
Exception(std::string msg_arg) : msg{std::move(msg_arg)} {};
Exception(std::string msg_arg) : msg{std::move(msg_arg)}
{
};
};
};