@@ -57,6 +57,7 @@ struct Walk
5757 template <typename GenericPolytope>
5858 Walk (GenericPolytope &P, Point const & p, NT const & a_i, RandomNumberGenerator &rng)
5959 {
60+ P.normalize ();
6061 _Len = compute_diameter<GenericPolytope>
6162 ::template compute<NT>(P);
6263 _omega = std::sqrt (NT (2 ) * a_i);
@@ -68,6 +69,7 @@ struct Walk
6869 Walk (GenericPolytope &P, Point const & p, NT const & a_i, RandomNumberGenerator &rng,
6970 parameters const & params)
7071 {
72+ P.normalize ();
7173 _Len = params.set_L ? params.m_L
7274 : compute_diameter<GenericPolytope>
7375 ::template compute<NT>(P);
@@ -80,7 +82,7 @@ struct Walk
8082 <
8183 typename GenericPolytope
8284 >
83- inline void apply (GenericPolytope& P,
85+ inline void apply (GenericPolytope const & P,
8486 Point& p,
8587 NT const & a_i,
8688 unsigned int const & walk_length,
@@ -89,9 +91,6 @@ struct Walk
8991 unsigned int n = P.dimension ();
9092 NT T;
9193
92- // normalize the Polyope
93- P.normalize ();
94-
9594 for (auto j=0u ; j<walk_length; ++j)
9695 {
9796 T = rng.sample_urdist () * _Len;
@@ -124,7 +123,7 @@ struct Walk
124123 <
125124 typename GenericPolytope
126125 >
127- inline void get_starting_point (GenericPolytope& P,
126+ inline void get_starting_point (GenericPolytope const & P,
128127 Point const & center,
129128 Point &q,
130129 unsigned int const & walk_length,
@@ -145,7 +144,7 @@ struct Walk
145144 <
146145 typename GenericPolytope
147146 >
148- inline void parameters_burnin (GenericPolytope& P,
147+ inline void parameters_burnin (GenericPolytope const & P,
149148 Point const & center,
150149 unsigned int const & num_points,
151150 unsigned int const & walk_length,
@@ -195,7 +194,7 @@ private :
195194 <
196195 typename GenericPolytope
197196 >
198- inline void initialize (GenericPolytope& P,
197+ inline void initialize (GenericPolytope const & P,
199198 Point const & p,
200199 NT const & a_i,
201200 RandomNumberGenerator &rng)
@@ -205,9 +204,6 @@ private :
205204 _p = p;
206205 _v = GetDirection<Point>::apply (n, rng, false );
207206
208- // normalize the Polyope
209- P.normalize ();
210-
211207 NT T = rng.sample_urdist () * _Len;
212208 int it = 0 ;
213209
0 commit comments