diff --git a/src/config/check.rs b/src/config/check.rs index 74a46762aa5a75472c65960f2597612f6af61058..18ddb66a18b77a46cb008c1aeb45698442388967 100644 --- a/src/config/check.rs +++ b/src/config/check.rs @@ -3,6 +3,7 @@ use core::fmt; use std::{ + cmp::Ordering, collections::HashSet, path::{Path, PathBuf}, }; @@ -171,6 +172,7 @@ impl TryFrom<&RawFilters> for Filters { impl Parameters<f64> { fn try_from(init: &InitialParameters, raw_gft: &RawGeneFlowTimes) -> Result<Self, Error> { + use Ordering as O; let &InitialParameters { theta, tau_1, @@ -207,12 +209,21 @@ impl Parameters<f64> { check_positive!(theta, tau_1, tau_2); check_prob!(p_ab, p_ac, p_bc, p_ancient_gf); - if tau_2 < tau_1 { - err!( - ("The second coalescence time must be older than the first: \ + match tau_2.total_cmp(&tau_1) { + O::Less => { + err!( + ("The second coalescence time must be older than the first: \ maybe tau_1 ({tau_1}) and tau_2 ({tau_2}) were meant to be reversed?") - ) - } + ) + } + O::Equal => { + err!( + ("The two coalescence times cannot be identical: \ + here tau_1 == tau_2 == {tau_1}.") + ) + } + O::Greater => {} + }; let s = p_ab + p_bc + p_ac; if 1. < s {