Global reindentation of MEX sources
parent
22ab507c6c
commit
b901b7af86
|
@ -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);
|
MainLoop(bin_basename, code, evaluate, block, true, true, sconstrained_extended_path, vector_table_conditional_local);
|
||||||
for (int j = 0; j < y_size; j++)
|
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)
|
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++)
|
for (int j = 0; j < col_x; j++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6458,7 +6458,6 @@ dynSparseMatrix::solve_linear(const int block_num, const int y_size, const int y
|
||||||
|
|
||||||
void
|
void
|
||||||
dynSparseMatrix::solve_non_linear(const int block_num, const int y_size, const int y_kmin, const int y_kmax, const int size)
|
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;
|
max_res_idx = 0;
|
||||||
bool cvg = false;
|
bool cvg = false;
|
||||||
|
|
|
@ -29,7 +29,9 @@ class DynamicModelAC
|
||||||
protected:
|
protected:
|
||||||
int ntt; // Size of vector of temporary terms
|
int ntt; // Size of vector of temporary terms
|
||||||
public:
|
public:
|
||||||
DynamicModelAC(int ntt_arg) : ntt{ntt_arg} {};
|
DynamicModelAC(int ntt_arg) : ntt{ntt_arg}
|
||||||
|
{
|
||||||
|
};
|
||||||
virtual ~DynamicModelAC() = default;
|
virtual ~DynamicModelAC() = default;
|
||||||
virtual void eval(const Vector &y, const Vector &x, const Vector ¶ms, const Vector &ySteady,
|
virtual void eval(const Vector &y, const Vector &x, const Vector ¶ms, const Vector &ySteady,
|
||||||
Vector &residual, std::vector<TwoDMatrix> &md) = 0;
|
Vector &residual, std::vector<TwoDMatrix> &md) = 0;
|
||||||
|
|
|
@ -236,4 +236,3 @@ DynareStateNameList::DynareStateNameList(const KordpDynare &dynare, const Dynare
|
||||||
for (int i = 0; i < dynare.nexog(); i++)
|
for (int i = 0; i < dynare.nexog(); i++)
|
||||||
names.emplace_back(denl.getName(i));
|
names.emplace_back(denl.getName(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,4 +312,3 @@ extern "C" {
|
||||||
plhs[0] = mxCreateDoubleScalar(0);
|
plhs[0] = mxCreateDoubleScalar(0);
|
||||||
} // end of mexFunction()
|
} // end of mexFunction()
|
||||||
} // end of extern C
|
} // end of extern C
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,8 @@ struct ParticleWorker : public sthread::detach_thread
|
||||||
ynext{ynext_arg}
|
ynext{ynext_arg}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void operator()(std::mutex &mut) override
|
void
|
||||||
|
operator()(std::mutex &mut) override
|
||||||
{
|
{
|
||||||
Vector dyu(npred_both+exo_nbr);
|
Vector dyu(npred_both+exo_nbr);
|
||||||
Vector dy(dyu, 0, npred_both);
|
Vector dy(dyu, 0, npred_both);
|
||||||
|
|
|
@ -39,7 +39,9 @@ public:
|
||||||
// Used to store error messages (as exceptions cannot cross the OpenMP boundary)
|
// Used to store error messages (as exceptions cannot cross the OpenMP boundary)
|
||||||
static std::string error_msg;
|
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 ~DynamicModelCaller() = default;
|
||||||
virtual double &y(size_t i) const = 0;
|
virtual double &y(size_t i) const = 0;
|
||||||
virtual double jacobian(size_t i) const = 0;
|
virtual double jacobian(size_t i) const = 0;
|
||||||
|
@ -65,8 +67,16 @@ private:
|
||||||
public:
|
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);
|
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;
|
virtual ~DynamicModelDllCaller() = default;
|
||||||
double &y(size_t i) const override { return y_p[i]; };
|
double &
|
||||||
double jacobian(size_t i) const override { return jacobian_p[i]; };
|
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;
|
void eval(int it, double *resid) override;
|
||||||
static void load_dll(const std::string &basename);
|
static void load_dll(const std::string &basename);
|
||||||
static void unload_dll();
|
static void unload_dll();
|
||||||
|
@ -85,13 +95,23 @@ private:
|
||||||
public:
|
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(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;
|
~DynamicModelMatlabCaller() override;
|
||||||
double &y(size_t i) const override { return mxGetPr(y_mx)[i]; };
|
double &
|
||||||
double jacobian(size_t i) const override { return jacobian_mx ? mxGetPr(jacobian_mx)[i] : std::numeric_limits<double>::quiet_NaN(); };
|
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;
|
void eval(int it, double *resid) override;
|
||||||
class Exception {
|
class Exception
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
const std::string msg;
|
const std::string msg;
|
||||||
Exception(std::string msg_arg) : msg{std::move(msg_arg)} {};
|
Exception(std::string msg_arg) : msg{std::move(msg_arg)}
|
||||||
|
{
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue