@@ -55,8 +55,9 @@ struct Walk
55
55
typedef typename Polytope::VT VT;
56
56
57
57
template <typename GenericPolytope>
58
- Walk (GenericPolytope & P, Point const & p, NT const & a_i, RandomNumberGenerator &rng)
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);
@@ -65,9 +66,10 @@ struct Walk
65
66
}
66
67
67
68
template <typename GenericPolytope>
68
- Walk (GenericPolytope & P, Point const & p, NT const & a_i, RandomNumberGenerator &rng,
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,18 +82,16 @@ 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,
87
89
RandomNumberGenerator &rng)
88
90
{
91
+
89
92
unsigned int n = P.dimension ();
90
93
NT T;
91
94
92
- // normalize the Polyope
93
- P.normalize ();
94
-
95
95
for (auto j=0u ; j<walk_length; ++j)
96
96
{
97
97
T = rng.sample_urdist () * _Len;
@@ -124,7 +124,7 @@ struct Walk
124
124
<
125
125
typename GenericPolytope
126
126
>
127
- inline void get_starting_point (GenericPolytope& P,
127
+ inline void get_starting_point (GenericPolytope const & P,
128
128
Point const & center,
129
129
Point &q,
130
130
unsigned int const & walk_length,
@@ -145,7 +145,7 @@ struct Walk
145
145
<
146
146
typename GenericPolytope
147
147
>
148
- inline void parameters_burnin (GenericPolytope& P,
148
+ inline void parameters_burnin (GenericPolytope const & P,
149
149
Point const & center,
150
150
unsigned int const & num_points,
151
151
unsigned int const & walk_length,
@@ -195,7 +195,7 @@ private :
195
195
<
196
196
typename GenericPolytope
197
197
>
198
- inline void initialize (GenericPolytope& P,
198
+ inline void initialize (GenericPolytope const & P,
199
199
Point const & p,
200
200
NT const & a_i,
201
201
RandomNumberGenerator &rng)
@@ -205,9 +205,6 @@ private :
205
205
_p = p;
206
206
_v = GetDirection<Point >::apply (n, rng, false );
207
207
208
- // normalize the Polyope
209
- P.normalize ();
210
-
211
208
NT T = rng.sample_urdist () * _Len;
212
209
int it = 0 ;
213
210
0 commit comments