Skip to main content

best_linear_approximation

Function best_linear_approximation 

Source
pub fn best_linear_approximation(
    truth: &[bool],
    skip_zero: bool,
) -> Option<(usize, f64)>
Expand description

The best linear approximation of a Boolean function: the mask w maximizing |Ŵ(w)|, with its bias |Pr[C(x)=⟨w,x⟩] − ½| = |Ŵ(w)| / 2^{n+1}. When skip_zero, the trivial constant mask w = 0 (which measures C’s own imbalance) is excluded. Returns (mask, bias), or None for a malformed table.