Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 4.6
  • 5.x
  • 6.x
  • aux_vars_fix
  • julia
  • llvm-15
  • master
  • python-codegen
  • rework_pac
  • uop
  • julia-6.2.0
  • julia-6.3.0
  • julia-6.4.0
  • julia-7.0.0
14 results

Target

Select target project
  • normann/preprocessor
  • Dynare/preprocessor
  • FerhatMihoubi/preprocessor
  • MichelJuillard/preprocessor
  • sebastien/preprocessor
  • lnsongxf/preprocessor
  • albop/preprocessor
  • DoraK/preprocessor
  • amg/preprocessor
  • wmutschl/preprocessor
  • JohannesPfeifer/preprocessor
11 results
Select Git revision
  • 4.6
  • aux_vars_fix
  • master
  • occbin
  • pac_composite_target_mce
  • ramsey_k_order
  • rework_pac
  • uop
  • created_preprocessor_repo
9 results
Show changes
Commits on Source (4)
......@@ -219,13 +219,13 @@ RIGHT_ARRAY_SUBSCRIPT(ExprNodeOutputType output_type)
}
// Left and right parentheses
inline string
constexpr string
LEFT_PAR(ExprNodeOutputType output_type)
{
return isLatexOutput(output_type) ? "\\left(" : "(";
}
inline string
constexpr string
RIGHT_PAR(ExprNodeOutputType output_type)
{
return isLatexOutput(output_type) ? "\\right)" : ")";
......
/*
* Copyright © 2015-2023 Dynare Team
* Copyright © 2015-2025 Dynare Team
*
* This file is part of Dynare.
*
......@@ -52,15 +52,8 @@ macroExpandModFile(const filesystem::path& filename, const istream& modfile, boo
string str(macro_output.str());
if (!line_macro)
{
/* Remove the @#line directives.
Unfortunately GCC 11 does not yet support std::regex::multiline
(despite it being in the C++17 standard), so we are forced to use
a trick to emulate the “usual” behaviour of the caret ^;
here, the latter only matches the beginning of file.
This also means that we are forced to remove the EOL before the
@#line, and not the one after it (matching the EOL before and the
EOL after in the same regexp does not work). */
str = regex_replace(str, regex(R"((^|\r?\n)@#line.*)"), "");
// Remove the @#line directives.
str = regex_replace(str, regex(R"(^@#line.*$)", std::regex::multiline), "");
/* Remove the EOLs at the beginning of the output, the first one
being a remnant of the first @#line directive. */
str = regex_replace(str, regex(R"(^(\r?\n)+)"), "");
......
......@@ -1010,7 +1010,6 @@ ModelTree::writeModelCFile(const string& basename, const string& mexext,
: ExprNodeOutputType::CStaticModel>();
vector<filesystem::path> header_files, object_files;
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix {dynamic ? "dynamic_" : "static_"};
const string ss_it_argin {dynamic ? ", const double *restrict steady_state, int it_" : ""};
const string ss_it_argout {dynamic ? ", steady_state, it_" : ""};
......@@ -2270,7 +2269,6 @@ template<bool dynamic>
void
ModelTree::writeJsonSparseIndicesHelper(ostream& output) const
{
// TODO: when C++20 support is complete, mark this constexpr
const string model_name {dynamic ? "dynamic" : "static"};
// Write indices for the sparse Jacobian (both naive and CSC storage)
......@@ -2382,7 +2380,6 @@ ModelTree::writeSparseModelJuliaFiles(const string& basename) const
: ExprNodeOutputType::juliaSparseStaticModel>();
filesystem::path julia_dir {filesystem::path {basename} / "model" / "julia"};
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix {dynamic ? "SparseDynamic" : "SparseStatic"};
const string ss_argin {dynamic ? ", steady_state::Vector{<: Real}" : ""};
const string ss_argout {dynamic ? ", steady_state" : ""};
......@@ -2495,7 +2492,6 @@ ModelTree::writeSparseModelMFiles(const string& basename,
auto [d_sparse_output, tt_sparse_output] = writeModelFileHelper<output_type>();
const filesystem::path m_dir {packageDir(basename) / "+sparse"};
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix {
(dynamic ? "dynamic_"s : "static_"s)
+ (heterogeneous_dimension ? "het"s + to_string(*heterogeneous_dimension + 1) + "_"s : ""s)};
......@@ -2672,7 +2668,6 @@ ModelTree::writeSparseModelCFiles(const string& basename, const string& mexext,
const filesystem::path mex_dir {packageDir(basename) / "+sparse"};
const filesystem::path model_src_dir {filesystem::path {basename} / "model" / "src" / "sparse"};
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix {dynamic ? "dynamic_" : "static_"};
const string extra_argin {
(dynamic ? ", const double *restrict steady_state"s : ""s)
......@@ -3029,15 +3024,18 @@ ModelTree::writeSparseModelCFiles(const string& basename, const string& mexext,
if (!evaluate)
output << " mxArray *residual_mx = mxCreateDoubleMatrix(" << blocks[blk].mfs_size
<< ", 1, mxREAL);" << endl
<< " double *restrict residual = mxGetPr(residual_mx);" << endl
<< " if (nlhs > 2)" << endl
<< " plhs[2] = residual_mx;" << endl;
<< " double *restrict residual = mxGetPr(residual_mx);" << endl;
output << " " << funcname << "_resid(y, x, params" << extra_argout << ", T"
<< (evaluate ? "" : ", residual") << ");" << endl;
if (!evaluate)
{
output << " if (nlhs > 2)" << endl
<< " plhs[2] = residual_mx;" << endl
<< " else" << endl
<< " mxDestroyArray(residual_mx);" << endl;
// Write Jacobian
output << " if (nlhs > 3)" << endl << " {" << endl;
sparse_jacobian_create(3, blocks[blk].mfs_size, g1_ncols,
......@@ -3062,7 +3060,6 @@ ModelTree::writeDebugModelMFiles(const string& basename) const
: ExprNodeOutputType::matlabSparseStaticModel};
const filesystem::path m_dir {packageDir(basename) / "+debug"};
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix {dynamic ? "dynamic_" : "static_"};
const filesystem::path resid_filename {m_dir / (prefix + "resid.m")};
......