Skip to content

Commit

Permalink
Remove unnecessary template keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
vfisikop committed Oct 9, 2024
1 parent 32e3421 commit fed37ad
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions include/preprocess/estimate_L_smooth_parameter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ template
typename NegativeGradientFunctor,
typename RandomNumberGenerator
>
double estimate_L_smooth(Polytope &P, Point &p, unsigned int const& walk_length,
double estimate_L_smooth(Polytope &P, Point &p, unsigned int const& walk_length,
NegativeGradientFunctor F, RandomNumberGenerator &rng)
{
typedef typename Point::FT NT;
Expand All @@ -44,11 +44,11 @@ double estimate_L_smooth(Polytope &P, Point &p, unsigned int const& walk_length,
RandomWalk walk(P, p, rng);
for (unsigned int i=0; i<rnum; ++i)
{
walk.template apply(P, p, walk_length, rng);
walk.apply(P, p, walk_length, rng);
randPoints[0] = p;
listOfPoints.push_back(randPoints);
}

NT L = std::numeric_limits<NT>::lowest(), Ltemp;

for (auto pit=listOfPoints.begin(); pit!=(listOfPoints.end()-1); ++pit)
Expand Down
2 changes: 1 addition & 1 deletion include/sampling/mmcs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool perform_mmcs_step(Polytope &P,
walk.template get_starting_point(P, p, q, 10, rng);
for (int i = 0; i < window; i++)
{
walk.template apply(P, q, walk_length, rng);
walk.apply(P, q, walk_length, rng);
winPoints.col(i) = q.getCoefficients();
}
estimator.update_estimator(winPoints);
Expand Down
2 changes: 1 addition & 1 deletion include/sampling/parallel_mmcs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool perform_parallel_mmcs_step(Polytope &P,
walk.template get_starting_point(P, p, thread_random_walk_parameters, 10, rng);
for (int i = 0; i < window; i++)
{
walk.template apply(P, thread_random_walk_parameters, walk_length, rng);
walk.apply(P, thread_random_walk_parameters, walk_length, rng);
winPoints_per_thread[thread_index].col(i) = thread_random_walk_parameters.p.getCoefficients();
}

Expand Down
18 changes: 9 additions & 9 deletions include/sampling/random_point_generators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct RandomPointGenerator
Walk walk(P, p, rng, parameters);
for (unsigned int i=0; i<rnum; ++i)
{
walk.template apply(P, p, walk_length, rng);
walk.apply(P, p, walk_length, rng);
policy.apply(randPoints, p);
}
}
Expand All @@ -59,7 +59,7 @@ struct RandomPointGenerator
Walk walk(P, p, rng);
for (unsigned int i=0; i<rnum; ++i)
{
walk.template apply(P, p, walk_length, rng);
walk.apply(P, p, walk_length, rng);
policy.apply(randPoints, p);
}
}
Expand Down Expand Up @@ -95,7 +95,7 @@ struct MultivariateGaussianRandomPointGenerator
Walk walk(P, p, E, rng, parameters);
for (unsigned int i=0; i<rnum; ++i)
{
walk.template apply(P, p, walk_length, rng);
walk.apply(P, p, walk_length, rng);
policy.apply(randPoints, p);
}
}
Expand All @@ -121,7 +121,7 @@ struct MultivariateGaussianRandomPointGenerator
Walk walk(P, p, E, rng);
for (unsigned int i=0; i<rnum; ++i)
{
walk.template apply(P, p, walk_length, rng);
walk.apply(P, p, walk_length, rng);
policy.apply(randPoints, p);
}
}
Expand Down Expand Up @@ -155,7 +155,7 @@ struct GaussianRandomPointGenerator
Walk walk(P, p, a_i, rng);
for (unsigned int i=0; i<rnum; ++i)
{
walk.template apply(P, p, a_i, walk_length, rng);
walk.apply(P, p, a_i, walk_length, rng);
policy.apply(randPoints, p);
}
}
Expand Down Expand Up @@ -184,7 +184,7 @@ struct GaussianRandomPointGenerator

for (unsigned int i=0; i<rnum; ++i)
{
walk.template apply(P, p, a_i, walk_length, rng);
walk.apply(P, p, a_i, walk_length, rng);
policy.apply(randPoints, p);
}
}
Expand Down Expand Up @@ -215,7 +215,7 @@ struct BoundaryRandomPointGenerator
Point p1(P.dimension()), p2(P.dimension());
for (unsigned int i=0; i<rnum; ++i)
{
walk.template apply(P, p1, p2, walk_length, rng);
walk.apply(P, p1, p2, walk_length, rng);
policy.apply(randPoints, p1);
policy.apply(randPoints, p2);
}
Expand Down Expand Up @@ -344,7 +344,7 @@ struct ExponentialRandomPointGenerator
bool success;
for (unsigned int i=0; i<rnum; ++i)
{
success = walk.template apply(P, p, walk_length, rng);
success = walk.apply(P, p, walk_length, rng);
if (!success) {
//return;
throw std::range_error("A generated point is outside polytope");
Expand Down Expand Up @@ -379,7 +379,7 @@ struct ExponentialRandomPointGenerator

for (unsigned int i=0; i<rnum; ++i)
{
success = walk.template apply(P, p, walk_length, rng);
success = walk.apply(P, p, walk_length, rng);
if (!success) {
//return;
throw std::range_error("A generated point is outside polytope");
Expand Down
20 changes: 10 additions & 10 deletions include/sampling/random_point_generators_multithread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ template <typename GenericWalk>
struct policy_storing
{
template <typename WalkPolicy, typename PointList, typename ThreadParameters>
static void store(WalkPolicy &policy, PointList &randPoints, ThreadParameters &thread_random_walk_parameters)
static void store(WalkPolicy &policy, PointList &randPoints, ThreadParameters &thread_random_walk_parameters)
{
policy.apply(randPoints, thread_random_walk_parameters.p);
}
Expand All @@ -30,15 +30,15 @@ template <>
struct policy_storing<BRDHRWalk_multithread>
{
template <typename WalkPolicy, typename PointList, typename ThreadParameters>
static void store(WalkPolicy &policy, PointList &randPoints, ThreadParameters &thread_random_walk_parameters)
static void store(WalkPolicy &policy, PointList &randPoints, ThreadParameters &thread_random_walk_parameters)
{
policy.apply(randPoints, thread_random_walk_parameters.p1);
policy.apply(randPoints, thread_random_walk_parameters.p2);
}
};

template <>
struct policy_storing<BCDHRWalk_multithread> : policy_storing<BRDHRWalk_multithread>
struct policy_storing<BCDHRWalk_multithread> : policy_storing<BRDHRWalk_multithread>
{};


Expand Down Expand Up @@ -72,7 +72,7 @@ struct RandomPointGeneratorMultiThread

omp_set_num_threads(num_threads);
unsigned int d = P.dimension(), m = P.num_of_hyperplanes();

std::vector<int> num_points_per_thread(rnum%num_threads, rnum/num_threads+1);
std::vector<int> a(num_threads - rnum%num_threads, rnum/num_threads);
num_points_per_thread.insert(num_points_per_thread.end(), a.begin(), a.end());
Expand All @@ -88,7 +88,7 @@ struct RandomPointGeneratorMultiThread

for (unsigned int it = 0; it < num_points_per_thread[thread_index]; it++)
{
walk.template apply(P, thread_random_walk_parameters, walk_length, rng);
walk.apply(P, thread_random_walk_parameters, walk_length, rng);
#pragma omp critical
{
policy_storing<Walk>::template store(policy, randPoints, thread_random_walk_parameters);
Expand Down Expand Up @@ -135,7 +135,7 @@ struct RandomPointGeneratorMultiThread

for (unsigned int it = 0; it < num_points_per_thread[thread_index]; it++)
{
walk.template apply(P, thread_random_walk_parameters, walk_length, rng);
walk.apply(P, thread_random_walk_parameters, walk_length, rng);
#pragma omp critical
{
policy_storing<Walk>::template store(policy, randPoints, thread_random_walk_parameters);
Expand Down Expand Up @@ -178,7 +178,7 @@ struct GaussianPointGeneratorMultiThread

omp_set_num_threads(num_threads);
unsigned int d = P.dimension(), m = P.num_of_hyperplanes();

std::vector<int> num_points_per_thread(rnum%num_threads, rnum/num_threads+1);
std::vector<int> a(num_threads - rnum%num_threads, rnum/num_threads);
num_points_per_thread.insert(num_points_per_thread.end(), a.begin(), a.end());
Expand All @@ -194,7 +194,7 @@ struct GaussianPointGeneratorMultiThread

for (unsigned int it = 0; it < num_points_per_thread[thread_index]; it++)
{
walk.template apply(P, thread_random_walk_parameters, a_i, walk_length, rng);
walk.apply(P, thread_random_walk_parameters, a_i, walk_length, rng);
#pragma omp critical
{
policy_storing<Walk>::template store(policy, randPoints, thread_random_walk_parameters);
Expand Down Expand Up @@ -226,7 +226,7 @@ struct GaussianPointGeneratorMultiThread

omp_set_num_threads(num_threads);
unsigned int d = P.dimension(), m = P.num_of_hyperplanes();

std::vector<int> num_points_per_thread(rnum%num_threads, rnum/num_threads+1);
std::vector<int> a(num_threads - rnum%num_threads, rnum/num_threads);
num_points_per_thread.insert(num_points_per_thread.end(), a.begin(), a.end());
Expand All @@ -242,7 +242,7 @@ struct GaussianPointGeneratorMultiThread

for (unsigned int it = 0; it < num_points_per_thread[thread_index]; it++)
{
walk.template apply(P, thread_random_walk_parameters, a_i, walk_length, rng);
walk.apply(P, thread_random_walk_parameters, a_i, walk_length, rng);
#pragma omp critical
{
policy_storing<Walk>::template store(policy, randPoints, thread_random_walk_parameters);
Expand Down
6 changes: 3 additions & 3 deletions include/volume/volume_cooling_balls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ NT estimate_ratio(PolyBall1 &Pb1,

do
{
walk.template apply(Pb1, p, walk_length, rng);
walk.apply(Pb1, p, walk_length, rng);
} while(!estimate_ratio_generic(Pb2, p, error, ratio_parameters));

return NT(ratio_parameters.count_in) / NT(ratio_parameters.tot_count);
Expand Down Expand Up @@ -674,14 +674,14 @@ NT estimate_ratio_interval(PolyBall1 &Pb1,

for (int i = 0; i < ratio_parameters.W; ++i)
{
walk.template apply(Pb1, p, walk_length, rng);
walk.apply(Pb1, p, walk_length, rng);
full_sliding_window(Pb2, p, ratio_parameters);
}

ratio_parameters.mean = ratio_parameters.sum / NT(ratio_parameters.W);

do {
walk.template apply(Pb1, p, walk_length, rng);
walk.apply(Pb1, p, walk_length, rng);
} while (!estimate_ratio_interval_generic(Pb2, p, error, zp, ratio_parameters));

return NT(ratio_parameters.count_in) / NT(ratio_parameters.tot_count);
Expand Down
4 changes: 2 additions & 2 deletions include/volume/volume_cooling_gaussians.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void compute_annealing_schedule(Polytope& P,
// Compute some ratios to decide if this is the last gaussian
for (unsigned int j = 0; j < steps; j++)
{
walk.template apply(P, p, a_vals[it], walk_length, rng);
walk.apply(P, p, a_vals[it], walk_length, rng);
curr_its += 1.0;
curr_fn += eval_exp(p, next_a) / eval_exp(p, a_vals[it]);
}
Expand Down Expand Up @@ -398,7 +398,7 @@ double volume_cooling_gaussians(Polytope& Pin,

while (!done || (*itsIt)<min_steps)
{
walk.template apply(P, p, *avalsIt, walk_length, rng);
walk.apply(P, p, *avalsIt, walk_length, rng);

*itsIt = *itsIt + 1.0;
*fnIt = *fnIt + eval_exp(p,*(avalsIt+1)) / eval_exp(p,*avalsIt);
Expand Down

0 comments on commit fed37ad

Please sign in to comment.