Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/3247 json metric type - add field "metric_type" to metric.json file #3248

Merged
merged 7 commits into from
Dec 11, 2023
1 change: 1 addition & 0 deletions src/stan/mcmc/hmc/base_hmc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class base_hmc : public base_mcmc {
struct_writer.begin_record();
struct_writer.write("stepsize", get_nominal_stepsize());
struct_writer.write("inv_metric", z_.inv_e_metric_);
struct_writer.write("metric_type", z_.metric_type());
mitzimorris marked this conversation as resolved.
Show resolved Hide resolved
struct_writer.end_record();
}

Expand Down
2 changes: 2 additions & 0 deletions src/stan/mcmc/hmc/hamiltonians/dense_e_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class dense_e_point : public ps_point {
writer(inv_e_metric_ss.str());
}
}

inline std::string metric_type() { return "dense_e"; }
};

} // namespace mcmc
Expand Down
2 changes: 2 additions & 0 deletions src/stan/mcmc/hmc/hamiltonians/diag_e_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class diag_e_point : public ps_point {
inv_e_metric_ss << ", " << inv_e_metric_(i);
writer(inv_e_metric_ss.str());
}

inline std::string metric_type() { return "diag_e"; }
};

} // namespace mcmc
Expand Down
2 changes: 2 additions & 0 deletions src/stan/mcmc/hmc/hamiltonians/softabs_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class softabs_point : public ps_point {
virtual inline void write_metric(stan::callbacks::writer& writer) {
writer("No free parameters for SoftAbs metric");
}

inline std::string metric_type() { return "softabs"; }
};

} // namespace mcmc
Expand Down
2 changes: 2 additions & 0 deletions src/stan/mcmc/hmc/hamiltonians/unit_e_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class unit_e_point : public ps_point {
inline void write_metric(stan::callbacks::writer& writer) {
writer("No free parameters for unit metric");
}

inline std::string metric_type() { return "unit_e"; }
};

} // namespace mcmc
Expand Down