pub fn inverse_mobius_transform(a: &[Q]) -> Vec<Q> ⓘExpand description
Inverse of mobius_transform (SymPy inverse_mobius_transform(seq)):
recovers a from its subset sums, a[k] = Σ_{s ⊆ k} (−1)^{|k∖s|} A[s].
§Examples
use symplex::discrete::inverse_mobius_transform;
use num_bigint::BigInt;
use num_rational::Ratio;
let q = |v: &[i64]| -> Vec<Ratio<BigInt>> {
v.iter().map(|&t| Ratio::from_integer(BigInt::from(t))).collect()
};
// SymPy: inverse_mobius_transform([1, 3, 4, 10]) == [1, 2, 3, 4]
assert_eq!(inverse_mobius_transform(&q(&[1, 3, 4, 10])), q(&[1, 2, 3, 4]));
// SymPy: inverse_mobius_transform([1, 2, 3, 4]) == [1, 1, 2, 0]
assert_eq!(inverse_mobius_transform(&q(&[1, 2, 3, 4])), q(&[1, 1, 2, 0]));