@@ -57,6 +57,7 @@ struct Walk
57
57
template <typename GenericPolytope>
58
58
Walk (GenericPolytope &P, Point const & p, NT const & a_i, RandomNumberGenerator &rng)
59
59
{
60
+ P.normalize ();
60
61
_Len = compute_diameter<GenericPolytope>
61
62
::template compute<NT>(P);
62
63
_omega = std::sqrt (NT (2 ) * a_i);
@@ -68,6 +69,7 @@ struct Walk
68
69
Walk (GenericPolytope &P, Point const & p, NT const & a_i, RandomNumberGenerator &rng,
69
70
parameters const & params)
70
71
{
72
+ P.normalize ();
71
73
_Len = params.set_L ? params.m_L
72
74
: compute_diameter<GenericPolytope>
73
75
::template compute<NT>(P);
@@ -80,7 +82,7 @@ struct Walk
80
82
<
81
83
typename GenericPolytope
82
84
>
83
- inline void apply (GenericPolytope& P,
85
+ inline void apply (GenericPolytope const & P,
84
86
Point& p,
85
87
NT const & a_i,
86
88
unsigned int const & walk_length,
@@ -89,9 +91,6 @@ struct Walk
89
91
unsigned int n = P.dimension ();
90
92
NT T;
91
93
92
- // normalize the Polyope
93
- P.normalize ();
94
-
95
94
for (auto j=0u ; j<walk_length; ++j)
96
95
{
97
96
T = rng.sample_urdist () * _Len;
@@ -124,7 +123,7 @@ struct Walk
124
123
<
125
124
typename GenericPolytope
126
125
>
127
- inline void get_starting_point (GenericPolytope& P,
126
+ inline void get_starting_point (GenericPolytope const & P,
128
127
Point const & center,
129
128
Point &q,
130
129
unsigned int const & walk_length,
@@ -145,7 +144,7 @@ struct Walk
145
144
<
146
145
typename GenericPolytope
147
146
>
148
- inline void parameters_burnin (GenericPolytope& P,
147
+ inline void parameters_burnin (GenericPolytope const & P,
149
148
Point const & center,
150
149
unsigned int const & num_points,
151
150
unsigned int const & walk_length,
@@ -195,7 +194,7 @@ private :
195
194
<
196
195
typename GenericPolytope
197
196
>
198
- inline void initialize (GenericPolytope& P,
197
+ inline void initialize (GenericPolytope const & P,
199
198
Point const & p,
200
199
NT const & a_i,
201
200
RandomNumberGenerator &rng)
@@ -205,9 +204,6 @@ private :
205
204
_p = p;
206
205
_v = GetDirection<Point>::apply (n, rng, false );
207
206
208
- // normalize the Polyope
209
- P.normalize ();
210
-
211
207
NT T = rng.sample_urdist () * _Len;
212
208
int it = 0 ;
213
209
0 commit comments