/// <summary> /// The maximum 'difference' between this instance and that instance. /// This returns the maximum absolute difference between the Log-odds of any element /// </summary> /// <param name="that">The other distribution</param> /// <returns>The resulting maximum difference</returns> /// <remarks><c>a.MaxDiff(b) == b.MaxDiff(a)</c></remarks> public double MaxDiff(object that) { SparseBernoulliListBase sbl = (SparseBernoulliListBase)that; // differences in log odds SparseVector absDiff = SparseVector.Zero(LogOddsVector.Count); absDiff.SetToFunction(LogOddsVector, sbl.LogOddsVector, (a, b) => MMath.AbsDiff(a, b)); return(absDiff.Max()); }