Skip to content

Commit

Permalink
templates passing update
Browse files Browse the repository at this point in the history
  • Loading branch information
vgnecula committed Jul 18, 2024
1 parent e5c011a commit 3b77488
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions include/volume/volume_cooling_gaussians_crhmc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ template
<
typename CRHMCWalkType,
typename crhmc_walk_params,
typename CRHMCRandomPointGenerator,
int simdLen,
typename Grad,
typename Func,
Expand Down Expand Up @@ -64,6 +63,8 @@ NT get_next_gaussian(Polytope& P,
PushBackWalkPolicy push_back_policy;
bool raw_output = false;

typedef CrhmcRandomPointGenerator<CRHMCWalkType> CRHMCRandomPointGenerator;

CRHMCRandomPointGenerator::apply(problem, p, N, walk_length, randPoints,
push_back_policy, rng, g, f, parameters, crhmc_walk, simdLen, raw_output);

Expand Down Expand Up @@ -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
Expand All @@ -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<Point> Func;
typedef typename GaussianFunctor::GradientFunctor<Point> Grad;
typedef typename GaussianFunctor::HessianFunctor<Point> Hess;
typedef typename GaussianFunctor::parameters<NT, Point> func_params;

typedef crhmc_input<MT, Point, Func, Grad, Hess> Input;
typedef crhmc_problem<Point, Input> CrhmcProblem;

typedef ImplicitMidpointODESolver<Point, NT, CrhmcProblem, Grad, simdLen> 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<CRHMCWalkType> CRHMCRandomPointGenerator;


// Compute the first gaussian
// This uses the function from the standard volume_cooling_gaussians.hpp
Expand Down Expand Up @@ -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<CRHMCWalkType, crhmc_walk_params, CRHMCRandomPointGenerator, simdLen, Grad, Func, CrhmcProblem>
NT next_a = get_next_gaussian<CRHMCWalkType, crhmc_walk_params, simdLen, Grad, Func, CrhmcProblem>
(P, p, a_vals[it], N, ratio, C, walk_length, rng, g, f, params, problem, walk);

#ifdef VOLESTI_DEBUG
Expand Down Expand Up @@ -270,6 +291,8 @@ double volume_cooling_gaussians(Polytope& Pin,
NT,
Grad
> crhmc_walk_params;

typedef CrhmcRandomPointGenerator<CRHMCWalkType> CRHMCRandomPointGenerator;

//const NT maxNT = std::numeric_limits<NT>::max();//1.79769e+308;
//const NT minNT = std::numeric_limits<NT>::min();//-1.79769e+308;
Expand Down Expand Up @@ -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<CRHMCWalkType>,
simdLen, Grad, Func, Hess, func_params, Input
>(P, ratio, C, parameters.frac, N, walk_length, radius, error, a_vals, rng);
compute_annealing_schedule<simdLen>(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 = "
Expand Down

0 comments on commit 3b77488

Please sign in to comment.