Skip to content

Commit db26dfb

Browse files
committed
fix multithreading
1 parent 1157a1c commit db26dfb

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ParameterSpacePartitions"
22
uuid = "64931d76-8770-46b0-8423-0a5d3a7d2d72"
33
authors = ["itsdfish"]
4-
version = "0.3.8"
4+
version = "0.3.9"
55

66
[deps]
77
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ A second function categorizes the predicted data into a qualitative pattern. At
3131

3232
```julia
3333
function p_fun(location, hypercube::HyperCube, args...; kwargs...)
34-
p_bounds = hypercube.p_bounds
35-
nb = length(p_bounds)
36-
nd = length(location)
37-
vals = fill(-100, nd)
38-
for j in 1:nd
39-
for i in 1:(nb-1)
40-
if (location[j] p_bounds[i]) && (location[j] p_bounds[i+1])
41-
vals[j] = i
42-
continue
43-
end
34+
p_bounds = hypercube.p_bounds
35+
nb = length(p_bounds)
36+
nd = length(location)
37+
vals = fill(-100, nd)
38+
for j in 1:nd
39+
for i in 1:(nb-1)
40+
if (location[j] p_bounds[i]) && (location[j] p_bounds[i+1])
41+
vals[j] = i
42+
continue
4443
end
4544
end
46-
return vals
4745
end
46+
return vals
47+
end
4848
```
4949

5050
## Model Configuration

src/sampler.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ Uses threading to generate patterns associated with a vector of proposals
7373
- `options`: a set of options for configuring the algorithm
7474
7575
"""
76-
function t_eval_patterns(proposals, model, p_fun, options, patterns)
76+
function t_eval_patterns(proposals, model, p_fun, options, chains)
77+
(;bounds) = options
78+
return tmap((c,p) -> eval_pattern(p_fun, model, bounds, c, p), chains, proposals)
79+
end
80+
81+
function t_eval_patterns(proposals, model, p_fun)
7782
return tmap(p -> p_fun(model(p)), proposals)
7883
end
7984

0 commit comments

Comments
 (0)