From 3b77488a5f3508b0f1d7e6f5130ad4fc6a3884f5 Mon Sep 17 00:00:00 2001 From: vgnecula Date: Fri, 12 Jul 2024 13:56:47 -0400 Subject: [PATCH] templates passing update --- .../volume/volume_cooling_gaussians_crhmc.hpp | 53 +++++++++++++------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/include/volume/volume_cooling_gaussians_crhmc.hpp b/include/volume/volume_cooling_gaussians_crhmc.hpp index 2e88117b9..a62273525 100644 --- a/include/volume/volume_cooling_gaussians_crhmc.hpp +++ b/include/volume/volume_cooling_gaussians_crhmc.hpp @@ -25,7 +25,6 @@ template < typename CRHMCWalkType, typename crhmc_walk_params, - typename CRHMCRandomPointGenerator, int simdLen, typename Grad, typename Func, @@ -64,6 +63,8 @@ NT get_next_gaussian(Polytope& P, PushBackWalkPolicy push_back_policy; bool raw_output = false; + typedef CrhmcRandomPointGenerator CRHMCRandomPointGenerator; + CRHMCRandomPointGenerator::apply(problem, p, N, walk_length, randPoints, push_back_policy, rng, g, f, parameters, crhmc_walk, simdLen, raw_output); @@ -97,15 +98,7 @@ NT get_next_gaussian(Polytope& P, // Compute the sequence of spherical gaussians template < - typename CRHMCWalkType, - typename crhmc_walk_params, - typename CRHMCRandomPointGenerator, int simdLen, - typename Grad, - typename Func, - typename Hess, - typename func_params, - typename Input, typename Polytope, typename NT, typename RandomNumberGenerator @@ -122,9 +115,37 @@ void compute_annealing_schedule(Polytope& P, RandomNumberGenerator& rng) { - typedef typename Polytope::PointType Point; - typedef typename Polytope::VT VT; + + typedef typename Polytope::MT MT; + typedef typename GaussianFunctor::FunctionFunctor Func; + typedef typename GaussianFunctor::GradientFunctor Grad; + typedef typename GaussianFunctor::HessianFunctor Hess; + typedef typename GaussianFunctor::parameters func_params; + + typedef crhmc_input Input; + typedef crhmc_problem CrhmcProblem; + + typedef ImplicitMidpointODESolver Solver; + + typedef typename CRHMCWalk::template Walk + < + Point, + CrhmcProblem, + RandomNumberGenerator, + Grad, + Func, + Solver + > CRHMCWalkType; + + typedef typename CRHMCWalk::template parameters + < + NT, + Grad + > crhmc_walk_params; + + typedef CrhmcRandomPointGenerator CRHMCRandomPointGenerator; + // Compute the first gaussian // This uses the function from the standard volume_cooling_gaussians.hpp @@ -185,7 +206,7 @@ void compute_annealing_schedule(Polytope& P, CRHMCWalkType walk = CRHMCWalkType(problem, p, input.df, input.f, params); // Compute the next gaussian - NT next_a = get_next_gaussian + NT next_a = get_next_gaussian (P, p, a_vals[it], N, ratio, C, walk_length, rng, g, f, params, problem, walk); #ifdef VOLESTI_DEBUG @@ -270,6 +291,8 @@ double volume_cooling_gaussians(Polytope& Pin, NT, Grad > crhmc_walk_params; + + typedef CrhmcRandomPointGenerator CRHMCRandomPointGenerator; //const NT maxNT = std::numeric_limits::max();//1.79769e+308; //const NT minNT = std::numeric_limits::min();//-1.79769e+308; @@ -302,11 +325,7 @@ double volume_cooling_gaussians(Polytope& Pin, NT C = parameters.C; unsigned int N = parameters.N; - compute_annealing_schedule - < - CRHMCWalkType, crhmc_walk_params,CrhmcRandomPointGenerator, - simdLen, Grad, Func, Hess, func_params, Input - >(P, ratio, C, parameters.frac, N, walk_length, radius, error, a_vals, rng); + compute_annealing_schedule(P, ratio, C, parameters.frac, N, walk_length, radius, error, a_vals, rng); #ifdef VOLESTI_DEBUG std::cout<<"All the variances of schedule_annealing computed in = "