logo
pub fn scaled_combinations(n: u64, k: u64, scale: f64) -> f64
Expand description

Calculate the number of combinations when choosing k elements from n elements without replacement, multiplied by a scaling factor. Time complexity: O(min(k, n - k))

Examples

use approx::assert_relative_eq;
use bio::stats::combinatorics::scaled_combinations;
assert_relative_eq!(scaled_combinations(5, 3, 0.5), 5., epsilon = f64::EPSILON);