Fix for clippy

pull/73/head
AlessandroBregoli 2 years ago
parent 28ed1a40b3
commit 44eaf8713f
  1. 6
      reCTBN/src/process/ctbn.rs
  2. 31
      reCTBN/tests/ctbn.rs

@ -77,12 +77,6 @@ impl CtbnNetwork {
/// ///
/// * The equivalent *CtmpProcess* computed from the current CtbnNetwork /// * The equivalent *CtmpProcess* computed from the current CtbnNetwork
pub fn amalgamation(&self) -> CtmpProcess { pub fn amalgamation(&self) -> CtmpProcess {
for v in self.nodes.iter() {
match v {
Params::DiscreteStatesContinousTime(_) => {}
_ => panic!("Unsupported node"),
}
}
let variables_domain = let variables_domain =
Array1::from_iter(self.nodes.iter().map(|x| x.get_reserved_space_as_parent())); Array1::from_iter(self.nodes.iter().map(|x| x.get_reserved_space_as_parent()));

@ -149,16 +149,10 @@ fn simple_amalgamation() {
} }
let ctmp = net.amalgamation(); let ctmp = net.amalgamation();
let p_ctbn = if let params::Params::DiscreteStatesContinousTime(p) = &net.get_node(0) { let params::Params::DiscreteStatesContinousTime(p_ctbn) = &net.get_node(0);
p.get_cim().as_ref().unwrap() let p_ctbn = p_ctbn.get_cim().as_ref().unwrap();
} else { let params::Params::DiscreteStatesContinousTime(p_ctmp) = &ctmp.get_node(0);
unreachable!(); let p_ctmp = p_ctmp.get_cim().as_ref().unwrap();
};
let p_ctmp = if let params::Params::DiscreteStatesContinousTime(p) = &ctmp.get_node(0) {
p.get_cim().as_ref().unwrap()
} else {
unreachable!();
};
assert!(p_ctmp.abs_diff_eq(p_ctbn, std::f64::EPSILON)); assert!(p_ctmp.abs_diff_eq(p_ctbn, std::f64::EPSILON));
} }
@ -211,11 +205,10 @@ fn chain_amalgamation() {
let ctmp = net.amalgamation(); let ctmp = net.amalgamation();
let p_ctmp = if let params::Params::DiscreteStatesContinousTime(p) = &ctmp.get_node(0) {
p.get_cim().as_ref().unwrap()
} else { let params::Params::DiscreteStatesContinousTime(p_ctmp) = &ctmp.get_node(0);
unreachable!(); let p_ctmp = p_ctmp.get_cim().as_ref().unwrap();
};
let p_ctmp_handmade = arr3(&[[ let p_ctmp_handmade = arr3(&[[
[ [
@ -308,11 +301,9 @@ fn chainfork_amalgamation() {
let ctmp = net.amalgamation(); let ctmp = net.amalgamation();
let p_ctmp = if let params::Params::DiscreteStatesContinousTime(p) = &ctmp.get_node(0) { let params::Params::DiscreteStatesContinousTime(p_ctmp) = &ctmp.get_node(0);
p.get_cim().as_ref().unwrap()
} else { let p_ctmp = p_ctmp.get_cim().as_ref().unwrap();
unreachable!();
};
let p_ctmp_handmade = arr3(&[[ let p_ctmp_handmade = arr3(&[[
[ [

Loading…
Cancel
Save