Skip to content

Commit

Permalink
Merge pull request #383 from bluescarni/pr/func_cleanup
Browse files Browse the repository at this point in the history
Cleanup several unused/obsolete API
  • Loading branch information
bluescarni authored Jan 7, 2024
2 parents 6e1b758 + b9bbf1f commit affe2f7
Show file tree
Hide file tree
Showing 48 changed files with 2 additions and 2,360 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ set(HEYOKA_SRC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/src/expression_fix.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/lagrangian.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/hamiltonian.cpp"
# "${CMAKE_CURRENT_SOURCE_DIR}/src/gp.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/logging.cpp"
# VSOP2013 details.
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/vsop2013/vsop2013_1_1.cpp"
Expand Down
1 change: 0 additions & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function(ADD_HEYOKA_BENCHMARK arg1)
set_property(TARGET ${arg1} PROPERTY CXX_EXTENSIONS NO)
endfunction()

# ADD_HEYOKA_BENCHMARK(evaluate_dbl)
# ADD_HEYOKA_BENCHMARK(genetics)
ADD_HEYOKA_BENCHMARK(taylor_jet_batch_benchmark)
ADD_HEYOKA_BENCHMARK(two_body_long_term)
Expand Down
143 changes: 0 additions & 143 deletions benchmark/evaluate_dbl.cpp

This file was deleted.

10 changes: 0 additions & 10 deletions benchmark/mascon_models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,6 @@ taylor_adaptive<double> taylor_factory(const P &mascon_points, const M &mascon_m
return taylor;
}

// template <typename P, typename M>
// double compute_energy(const std::vector<double> x, const P &mascon_points, const M &mascon_masses, double p, double
// q,
// double r, double G)
// {
// auto energy = energy_mascon_system(kw::state = x, kw::points = mascon_points, kw::masses = mascon_masses,
// kw::omega = std::vector<double>{p, q, r}, kw::Gconst = G);
// return eval_dbl(energy, std::unordered_map<std::string, double>());
// }

template <typename P, typename M>
void compare_taylor_vs_rkf(const P &mascon_points, const M &mascon_masses, taylor_adaptive<double> &taylor, double wz,
double test_time = 10.)
Expand Down
20 changes: 0 additions & 20 deletions benchmark/taylor_ANN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,6 @@ int main()
// Longer times result in reaching limit cycles and thus loss of precision
auto state = neural_network_ode.get_state();

// Uncomment these lines to print the state on screen during the first steps
// std::unordered_map<std::string, double> eval_map;
// eval_map["a0"] = state[0];
// eval_map["a1"] = state[1];
// for (decltype(w.size()) i = 0u; i < w.size(); ++i) {
// eval_map["w" + std::to_string(i + offset_w_names)] = ic[4 + i];
//}
// auto V = eval_dbl(-out[0] - 1_dbl / pow(x[0] * x[0] + x[1] * x[1], 0.5_dbl), eval_map);
// auto E0 = V + 0.5 * (state[2] * state[2] + state[3] * state[3]);
// for (auto i = 0u; i < 100; ++i) {
// auto res = neural_network_ode.step();
// state = neural_network_ode.get_state();
// eval_map["a0"] = state[0];
// eval_map["a1"] = state[1];
// V = eval_dbl(-out[0] - 1_dbl / pow(x[0] * x[0] + x[1] * x[1], 0.5_dbl), eval_map);
// auto E = V + 0.5 * (state[2] * state[2] + state[3] * state[3]);
// std::cout << neural_network_ode.get_time() << "," << state[0] << "," << state[1] << "," << E - E0 << ", "
// << static_cast<int>(std::get<0>(res)) << ", " << V << ", " << std::endl;
//}

neural_network_ode.propagate_until(100.);
neural_network_ode.propagate_until(0.);
stop = high_resolution_clock::now();
Expand Down
51 changes: 0 additions & 51 deletions include/heyoka/expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,57 +580,6 @@ dtens diff_tensors(const std::vector<expression> &v_ex, const KwArgs &...kw_args
return detail::diff_tensors(v_ex, d_args, order);
}

HEYOKA_DLL_PUBLIC double eval_dbl(const expression &, const std::unordered_map<std::string, double> &,
const std::vector<double> & = {});
HEYOKA_DLL_PUBLIC long double eval_ldbl(const expression &, const std::unordered_map<std::string, long double> &,
const std::vector<long double> & = {});
#if defined(HEYOKA_HAVE_REAL128)

HEYOKA_DLL_PUBLIC mppp::real128 eval_f128(const expression &, const std::unordered_map<std::string, mppp::real128> &,
const std::vector<mppp::real128> & = {});

#endif

template <typename T>
inline T eval(const expression &e, const std::unordered_map<std::string, T> &map, const std::vector<T> &pars = {})
{
if constexpr (std::is_same_v<T, double>) {
return eval_dbl(e, map, pars);
} else if constexpr (std::is_same_v<T, long double>) {
return eval_ldbl(e, map, pars);
#if defined(HEYOKA_HAVE_REAL128)
} else if constexpr (std::is_same_v<T, mppp::real128>) {
return eval_f128(e, map, pars);
#endif
} else {
static_assert(detail::always_false_v<T>, "Unhandled type.");
}
}

HEYOKA_DLL_PUBLIC void eval_batch_dbl(std::vector<double> &, const expression &,
const std::unordered_map<std::string, std::vector<double>> &,
const std::vector<double> & = {});

// When traversing the expression tree with some recursive algorithm we may have to do some book-keeping and use
// preallocated memory to store the result, in which case the corresponding function is called update_*. A corresponding
// method, more friendly to use, takes care of allocating memory and initializing the book-keeping variables, its called
// compute_*.
HEYOKA_DLL_PUBLIC std::vector<std::vector<std::size_t>> compute_connections(const expression &);
HEYOKA_DLL_PUBLIC void update_connections(std::vector<std::vector<std::size_t>> &, const expression &, std::size_t &);
HEYOKA_DLL_PUBLIC std::vector<double> compute_node_values_dbl(const expression &,
const std::unordered_map<std::string, double> &,
const std::vector<std::vector<std::size_t>> &);
HEYOKA_DLL_PUBLIC void update_node_values_dbl(std::vector<double> &, const expression &,
const std::unordered_map<std::string, double> &,
const std::vector<std::vector<std::size_t>> &, std::size_t &);

HEYOKA_DLL_PUBLIC std::unordered_map<std::string, double>
compute_grad_dbl(const expression &, const std::unordered_map<std::string, double> &,
const std::vector<std::vector<std::size_t>> &);
HEYOKA_DLL_PUBLIC void update_grad_dbl(std::unordered_map<std::string, double> &, const expression &,
const std::unordered_map<std::string, double> &, const std::vector<double> &,
const std::vector<std::vector<std::size_t>> &, std::size_t &, double = 1.);

namespace detail
{

Expand Down
Loading

0 comments on commit affe2f7

Please sign in to comment.