@@ -9,26 +9,27 @@ struct Population;
99namespace parameters
1010{
1111 struct Parameters ;
12+ struct Settings ;
1213}
1314
1415namespace bounds
1516{
1617 using Mask = Eigen::Array<bool , Eigen::Dynamic, 1 >;
1718
18- Mask is_out_of_bounds (const Vector& xi, const Vector& lb, const Vector& ub);
19- bool any_out_of_bounds (const Vector& xi, const Vector& lb, const Vector& ub);
19+ Mask is_out_of_bounds (const Vector & xi, const Vector & lb, const Vector & ub);
20+ bool any_out_of_bounds (const Vector & xi, const Vector & lb, const Vector & ub);
2021
2122 struct BoundCorrection
2223 {
2324 virtual ~BoundCorrection () = default ;
24- Vector lb, ub, db;
25+ Vector db;
2526 Float diameter;
2627 size_t n_out_of_bounds = 0 ;
2728 bool has_bounds;
2829
29- BoundCorrection (const Vector& lb, const Vector& ub) : lb(lb), ub(ub), db(ub - lb),
30- diameter ((ub - lb).norm()),
31- has_bounds(true )
30+ BoundCorrection (const Vector & lb, const Vector & ub) : db(ub - lb),
31+ diameter ((ub - lb).norm()),
32+ has_bounds(true )
3233 {
3334 // ! find a better way
3435 if (!std::isfinite (diameter))
@@ -38,13 +39,22 @@ namespace bounds
3839 }
3940 }
4041
41- void correct (const Eigen::Index i, parameters::Parameters& p);
42+ void correct (const Eigen::Index i, parameters::Parameters & p);
4243
43- virtual Vector correct_x (const Vector& xi, const Mask& oob, const Float sigma) = 0;
44+ virtual Vector correct_x (
45+ const Vector &xi,
46+ const Mask &oob,
47+ const Float sigma,
48+ const parameters::Settings &settings) = 0;
4449
45- [[nodiscard]] Mask is_out_of_bounds (const Vector& xi) const ;
50+ [[nodiscard]] Mask is_out_of_bounds (
51+ const Vector &xi,
52+ const parameters::Settings &settings) const ;
4653
47- [[nodiscard]] Vector delta_out_of_bounds (const Vector& xi, const Mask& oob) const ;
54+ [[nodiscard]] Vector delta_out_of_bounds (
55+ const Vector &xi,
56+ const Mask &oob,
57+ const parameters::Settings &settings) const ;
4858
4959 [[nodiscard]] bool any_out_of_bounds () const
5060 {
@@ -56,7 +66,7 @@ namespace bounds
5666 {
5767 using BoundCorrection::BoundCorrection;
5868
59- Vector correct_x (const Vector& xi, const Mask& oob, const Float sigma) override
69+ Vector correct_x (const Vector & xi, const Mask & oob, const Float sigma, const parameters::Settings &settings ) override
6070 {
6171 return xi;
6272 }
@@ -73,14 +83,14 @@ namespace bounds
7383
7484 COTN (Eigen::Ref<const Vector> lb, Eigen::Ref<const Vector> ub) : BoundCorrection(lb, ub), sampler(static_cast <size_t >(lb.size()), rng::normal<Float>(0 , 1.0 / 3 .)) {}
7585
76- Vector correct_x (const Vector& xi, const Mask& oob, const Float sigma) override ;
86+ Vector correct_x (const Vector & xi, const Mask & oob, const Float sigma, const parameters::Settings &settings ) override ;
7787 };
7888
7989 struct Mirror final : BoundCorrection
8090 {
8191 using BoundCorrection::BoundCorrection;
8292
83- Vector correct_x (const Vector& xi, const Mask& oob, const Float sigma) override ;
93+ Vector correct_x (const Vector & xi, const Mask & oob, const Float sigma, const parameters::Settings &settings ) override ;
8494 };
8595
8696 struct UniformResample final : BoundCorrection
@@ -89,24 +99,24 @@ namespace bounds
8999
90100 UniformResample (Eigen::Ref<const Vector> lb, Eigen::Ref<const Vector> ub) : BoundCorrection(lb, ub), sampler(static_cast <size_t >(lb.size())) {}
91101
92- Vector correct_x (const Vector& xi, const Mask& oob, const Float sigma) override ;
102+ Vector correct_x (const Vector & xi, const Mask & oob, const Float sigma, const parameters::Settings &settings ) override ;
93103 };
94104
95105 struct Saturate final : BoundCorrection
96106 {
97107 using BoundCorrection::BoundCorrection;
98108
99- Vector correct_x (const Vector& xi, const Mask& oob, const Float sigma) override ;
109+ Vector correct_x (const Vector & xi, const Mask & oob, const Float sigma, const parameters::Settings &settings ) override ;
100110 };
101111
102112 struct Toroidal final : BoundCorrection
103113 {
104114 using BoundCorrection::BoundCorrection;
105115
106- Vector correct_x (const Vector& xi, const Mask& oob, const Float sigma) override ;
116+ Vector correct_x (const Vector & xi, const Mask & oob, const Float sigma, const parameters::Settings &settings ) override ;
107117 };
108118
109- inline std::shared_ptr<BoundCorrection> get (const parameters::CorrectionMethod& m, const Vector& lb, const Vector& ub)
119+ inline std::shared_ptr<BoundCorrection> get (const parameters::CorrectionMethod & m, const Vector & lb, const Vector & ub)
110120 {
111121 using namespace parameters ;
112122 switch (m)
0 commit comments