@@ -21,23 +21,10 @@ namespace bounds
2121
2222 struct BoundCorrection
2323 {
24- virtual ~BoundCorrection () = default ;
25- Vector db;
26- Float diameter;
2724 size_t n_out_of_bounds = 0 ;
28- bool has_bounds;
2925
30- BoundCorrection (const Vector &lb, const Vector &ub) : db(ub - lb),
31- diameter ((ub - lb).norm()),
32- has_bounds(true )
33- {
34- // ! find a better way
35- if (!std::isfinite (diameter))
36- {
37- diameter = 10 ;
38- has_bounds = false ;
39- }
40- }
26+ virtual ~BoundCorrection () = default ;
27+ BoundCorrection () = default ;
4128
4229 void correct (const Eigen::Index i, parameters::Parameters &p);
4330
@@ -81,7 +68,7 @@ namespace bounds
8168 {
8269 sampling::Gaussian sampler;
8370
84- 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 .)) {}
71+ COTN (const size_t d ) : BoundCorrection(), sampler(d , rng::normal<Float>(0 , 1.0 / 3 .)) {}
8572
8673 Vector correct_x (const Vector &xi, const Mask &oob, const Float sigma, const parameters::Settings &settings) override ;
8774 };
@@ -97,7 +84,7 @@ namespace bounds
9784 {
9885 sampling::Uniform sampler;
9986
100- UniformResample (Eigen::Ref< const Vector> lb, Eigen::Ref< const Vector> ub ) : BoundCorrection(lb, ub ), sampler(static_cast < size_t >(lb.size()) ) {}
87+ UniformResample (const size_t d ) : BoundCorrection(), sampler(d ) {}
10188
10289 Vector correct_x (const Vector &xi, const Mask &oob, const Float sigma, const parameters::Settings &settings) override ;
10390 };
@@ -116,26 +103,26 @@ namespace bounds
116103 Vector correct_x (const Vector &xi, const Mask &oob, const Float sigma, const parameters::Settings &settings) override ;
117104 };
118105
119- inline std::shared_ptr<BoundCorrection> get (const parameters::CorrectionMethod &m, const Vector &lb, const Vector &ub )
106+ inline std::shared_ptr<BoundCorrection> get (const parameters::CorrectionMethod &m, const size_t d )
120107 {
121108 using namespace parameters ;
122109 switch (m)
123110 {
124111 case CorrectionMethod::MIRROR:
125- return std::make_shared<Mirror>(lb, ub );
112+ return std::make_shared<Mirror>();
126113 case CorrectionMethod::COTN:
127- return std::make_shared<COTN>(lb, ub );
114+ return std::make_shared<COTN>(d );
128115 case CorrectionMethod::UNIFORM_RESAMPLE:
129- return std::make_shared<UniformResample>(lb, ub );
116+ return std::make_shared<UniformResample>(d );
130117 case CorrectionMethod::SATURATE:
131- return std::make_shared<Saturate>(lb, ub );
118+ return std::make_shared<Saturate>();
132119 case CorrectionMethod::TOROIDAL:
133- return std::make_shared<Toroidal>(lb, ub );
120+ return std::make_shared<Toroidal>();
134121 case CorrectionMethod::RESAMPLE:
135- return std::make_shared<Resample>(lb, ub );
122+ return std::make_shared<Resample>();
136123 default :
137124 case CorrectionMethod::NONE:
138- return std::make_shared<NoCorrection>(lb, ub );
125+ return std::make_shared<NoCorrection>();
139126 }
140127 };
141128}
0 commit comments