@@ -31,7 +31,8 @@ impl Prior {
31
31
Prior :: Sobol ( points, seed)
32
32
}
33
33
34
- pub fn get_points ( & self ) -> usize {
34
+ /// Get the number of initial support points
35
+ pub fn points ( & self ) -> usize {
35
36
match self {
36
37
Prior :: Sobol ( points, _) => * points,
37
38
Prior :: Latin ( points, _) => * points,
@@ -42,7 +43,8 @@ impl Prior {
42
43
}
43
44
}
44
45
45
- pub fn get_seed ( & self ) -> usize {
46
+ /// Get the seed used for the random number generator
47
+ pub fn seed ( & self ) -> usize {
46
48
match self {
47
49
Prior :: Sobol ( _, seed) => * seed,
48
50
Prior :: Latin ( _, seed) => * seed,
@@ -62,6 +64,28 @@ impl Default for Prior {
62
64
63
65
/// This function generates the grid of support points according to the sampler specified in the [Settings]
64
66
pub fn sample_space ( settings : & Settings ) -> Result < Theta > {
67
+ // Ensure that the parameter ranges are not infinite
68
+ for param in settings. parameters ( ) . iter ( ) {
69
+ if param. lower . is_infinite ( ) || param. upper . is_infinite ( ) {
70
+ bail ! (
71
+ "Parameter '{}' has infinite bounds: [{}, {}]" ,
72
+ param. name,
73
+ param. lower,
74
+ param. upper
75
+ ) ;
76
+ }
77
+
78
+ // Ensure that the lower bound is less than the upper bound
79
+ if param. lower >= param. upper {
80
+ bail ! (
81
+ "Parameter '{}' has invalid bounds: [{}, {}]. Lower bound must be less than upper bound." ,
82
+ param. name,
83
+ param. lower,
84
+ param. upper
85
+ ) ;
86
+ }
87
+ }
88
+
65
89
// Otherwise, parse the sampler type and generate the grid
66
90
let prior = match settings. prior ( ) {
67
91
Prior :: Sobol ( points, seed) => sobol:: generate ( settings. parameters ( ) , * points, * seed) ?,
0 commit comments