mscore::algorithm::isotope

Function convolve_pow

Source
pub fn convolve_pow(dist: &Vec<(f64, f64)>, n: i32) -> Vec<(f64, f64)>
Expand description

convolve a distribution with itself n times

Arguments:

  • dist - distribution of masses and abundances
  • n - number of times to convolve the distribution with itself

Returns:

  • Vec<(f64, f64)> - distribution of masses and abundances

ยงExamples

use mscore::algorithm::isotope::convolve_pow;

let dist = vec![(100.0, 0.5), (101.0, 0.5)];
let result = convolve_pow(&dist, 2);
assert_eq!(result, vec![(200.0, 0.25), (201.0, 0.5), (202.0, 0.25)]);