File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,6 +135,8 @@ include("entities/AliasScalarSampling.jl")
135135include (" entities/OptionalDensities.jl" )
136136include (" entities/BeliefTypes.jl" )
137137
138+ include (" services/HypoRecipe.jl" )
139+
138140#
139141include (" manifolds/services/ManifoldsExtentions.jl" )
140142include (" manifolds/services/ManifoldSampling.jl" )
Original file line number Diff line number Diff line change @@ -20,31 +20,3 @@ Base.@kwdef struct HypoRecipeCompute{
2020 activehypo:: Vector{Int} = Int[]
2121end
2222
23-
24- function Base. isapprox (
25- a:: HypoRecipe ,
26- b:: HypoRecipe
27- )
28- if ! (isnothing (a. hypotheses) && isnothing (b. hypotheses))
29- return isapprox (a. hypotheses. p, b. hypotheses. p)
30- end
31- if ! (isnothing (a. certainhypo) && isnothing (b. certainhypo))
32- return isapprox (a. certainhypo, b. certainhypo)
33- end
34-
35- if 0 < length (a. activehypo)
36- if length (a. activehypo) == length (b. activehypo)
37- return isapprox (a. activehypo, b. activehypo)
38- else
39- return false
40- end
41- end
42-
43- return true
44- end
45-
46-
47- Base.:(== )(
48- a:: HypoRecipe ,
49- b:: HypoRecipe
50- ) = isapprox (a,b)
Original file line number Diff line number Diff line change 1+
2+ function Base. isapprox (
3+ a:: HypoRecipe ,
4+ b:: HypoRecipe ;
5+ iakws...
6+ )
7+ if ! (
8+ isapprox (a. certainidx, b. certainidx; iakws... ) &&
9+ isapprox (a. mhidx, b. mhidx; iakws... )
10+ )
11+ @debug " HypoRecipe a vs b not the same on either .certainidx or .mhidx"
12+ return false
13+ end
14+ if length (a. allelements) != length (b. allelements)
15+ @debug " HypoRecipe different lengths on a vs b .allelements"
16+ return false
17+ end
18+ for (i,el) in enumerate (a. allelements)
19+ if ! isapprox (el, b. allelements[i]; iakws... )
20+ @debug " HypoRecipe a vs b different on .allelements"
21+ return false
22+ end
23+ end
24+ if length (a. allelements) != length (b. allelements)
25+ @debug " HypoRecipe different lengths on a vs b .activehypo"
26+ return false
27+ end
28+ for (i,el) in enumerate (a. activehypo)
29+ if el[1 ] != b. activehypo[i][1 ] || ! isapprox (el[2 ], b. activehypo[i][2 ]; iakws... )
30+ @debug " HypoRecipe a vs b different on .activehypo"
31+ return false
32+ end
33+ end
34+ return true
35+ end
36+
37+ Base.:(== )(
38+ a:: HypoRecipe ,
39+ b:: HypoRecipe
40+ ) = isapprox (a,b)
41+
42+ function Base. isapprox (
43+ a:: HypoRecipeCompute ,
44+ b:: HypoRecipeCompute ;
45+ iakws...
46+ )
47+ if ! (isnothing (a. hypotheses) && isnothing (b. hypotheses))
48+ return isapprox (a. hypotheses. p, b. hypotheses. p; iakws... )
49+ end
50+ if ! (isnothing (a. certainhypo) && isnothing (b. certainhypo))
51+ return isapprox (a. certainhypo, b. certainhypo; iakws... )
52+ end
53+
54+ if 0 < length (a. activehypo)
55+ if length (a. activehypo) == length (b. activehypo)
56+ return isapprox (a. activehypo, b. activehypo; iakws... )
57+ else
58+ return false
59+ end
60+ end
61+
62+ return true
63+ end
64+
65+
66+ Base.:(== )(
67+ a:: HypoRecipeCompute ,
68+ b:: HypoRecipeCompute
69+ ) = isapprox (a,b)
You can’t perform that action at this time.
0 commit comments