Skip to content

Commit

Permalink
Add another numerical check
Browse files Browse the repository at this point in the history
  • Loading branch information
jmskov committed Sep 6, 2023
1 parent 69d463b commit 1f40b07
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cluster.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 1f40b07

Please sign in to comment.