@@ -109,6 +109,13 @@ function sample(d::DomainSets.GenericSphere{StaticArraysCore.SVector{2, T}, T},
109
109
return data
110
110
end
111
111
112
+ function sample (d:: DomainSets.UnitCircle , points:: Int , alg:: QuasiMonteCarlo.SamplingAlgorithm )
113
+ θ = sample (points, [0.0 ], [2 π], alg)
114
+ data = [cos .(θ); sin .(θ)]
115
+ return data
116
+ end
117
+
118
+
112
119
function sample (d:: DomainSets.GenericSphere{StaticArraysCore.SVector{3, T}, T} , points:: Int , alg:: QuasiMonteCarlo.SamplingAlgorithm ) where {T}
113
120
(; center, radius) = d
114
121
r = sample (points, [- 1 ,- 1 ], [1 ,1 ], alg)
@@ -130,6 +137,11 @@ function sample(d::SetdiffDomain{S, <:Tuple{<:Rectangle, F}}, points::Int, alg::
130
137
return data[:, idx]
131
138
end
132
139
140
+ function sample (d:: UnionDomain , points:: Int , alg:: QuasiMonteCarlo.SamplingAlgorithm ) where {S, F}
141
+ data = mapreduce (x -> sample (x, points, alg), hcat, d. domains)
142
+ return data
143
+ end
144
+
133
145
function sample (d:: Rectangle , points:: Int , sampling_alg:: QuasiMonteCarlo.SamplingAlgorithm )
134
146
bounds = get_bounds (d)
135
147
return sample (points, bounds[1 ], bounds[2 ], sampling_alg)
@@ -148,6 +160,7 @@ function sample(points::Int, lb::AbstractVector, ub::AbstractVector, ::SobolSamp
148
160
return sobolsample (points, lb, ub)
149
161
end
150
162
163
+
151
164
function sobolsample (n:: Int , lb, ub)
152
165
s = cached_sobolseq (n, lb, ub)
153
166
return reduce (hcat, [Sobol. next! (s) for i in 1 : n])
0 commit comments