From 1f40b07e8768d6b7672bbbcd9bc68dc50bcbf654 Mon Sep 17 00:00:00 2001 From: John Skovbekk Date: Wed, 6 Sep 2023 16:55:31 +0000 Subject: [PATCH] Add another numerical check --- src/cluster.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cluster.jl b/src/cluster.jl index ea3f2a2..2b3d637 100644 --- a/src/cluster.jl +++ b/src/cluster.jl @@ -116,6 +116,11 @@ function calculate_implicit_p(P̌_row, P̂_row, image, states, prior_results::Ab p_true_upper = true_transition_probabilities(all_P̌, all_P̂, idx_perm_upper) p̂_new = sum(p_true_upper .* all_succ_res_upper) + # check for numerical accuracy + if p̂_new > 1 && p̂_new - 1 < 1e-8 + p̂_new = 1 + end + @assert p̌_new ≤ 1.0 @assert sum(p_true) ≈ 1 @assert sum(p_true_upper) ≈ 1 @@ -130,7 +135,6 @@ function calculate_implicit_p(P̌_row, P̂_row, image, states, prior_results::Ab @assert all_P̌[i] ≤ p_true[i] ≤ all_P̂[i] end - if log_flag @info "p̌_cluster: ", p̌_cluster @info "all_succ_res: ", sort(all_succ_res)