Skip to content

Commit

Permalink
Polytope normalization within Walk Constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
vgnecula committed Jun 16, 2024
1 parent 2de3fef commit 1611388
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct Walk
template <typename GenericPolytope>
Walk(GenericPolytope &P, Point const& p, NT const& a_i, RandomNumberGenerator &rng)
{
P.normalize();
_Len = compute_diameter<GenericPolytope>
::template compute<NT>(P);
_omega = std::sqrt(NT(2) * a_i);
Expand All @@ -68,6 +69,7 @@ struct Walk
Walk(GenericPolytope &P, Point const& p, NT const& a_i, RandomNumberGenerator &rng,
parameters const& params)
{
P.normalize();
_Len = params.set_L ? params.m_L
: compute_diameter<GenericPolytope>
::template compute<NT>(P);
Expand All @@ -80,7 +82,7 @@ struct Walk
<
typename GenericPolytope
>
inline void apply(GenericPolytope& P,
inline void apply(GenericPolytope const& P,
Point& p,
NT const& a_i,
unsigned int const& walk_length,
Expand All @@ -89,9 +91,6 @@ struct Walk
unsigned int n = P.dimension();
NT T;

//normalize the Polyope
P.normalize();

for (auto j=0u; j<walk_length; ++j)
{
T = rng.sample_urdist() * _Len;
Expand Down Expand Up @@ -124,7 +123,7 @@ struct Walk
<
typename GenericPolytope
>
inline void get_starting_point(GenericPolytope& P,
inline void get_starting_point(GenericPolytope const& P,
Point const& center,
Point &q,
unsigned int const& walk_length,
Expand All @@ -145,7 +144,7 @@ struct Walk
<
typename GenericPolytope
>
inline void parameters_burnin(GenericPolytope& P,
inline void parameters_burnin(GenericPolytope const& P,
Point const& center,
unsigned int const& num_points,
unsigned int const& walk_length,
Expand Down Expand Up @@ -195,7 +194,7 @@ private :
<
typename GenericPolytope
>
inline void initialize(GenericPolytope& P,
inline void initialize(GenericPolytope const& P,
Point const& p,
NT const& a_i,
RandomNumberGenerator &rng)
Expand All @@ -205,9 +204,6 @@ private :
_p = p;
_v = GetDirection<Point>::apply(n, rng, false);

//normalize the Polyope
P.normalize();

NT T = rng.sample_urdist() * _Len;
int it = 0;

Expand Down

0 comments on commit 1611388

Please sign in to comment.