java.lang.Object
be.kuleuven.cs.distrinet.sparta.core.analysis.StatsUtil

public class StatsUtil extends Object
This class provides a number of simple statistical helper functions.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    calcSeqVulnerability(double[] tcap, double[]... diffs)
    Calculate the vulnerability of set of attack attempts.
    static double[]
    calcVulnerability(double[] tcap, double[] diffs)
    Calculate the vulnerability of set of attack attempts.
    static double[]
    ebeMult(double[] value1, double[] value2)
    Provide the element-by-element multiplication of double[]
    static double
    max(double[] values)
    Calculate the maximum value in a double[].
    static double
    median(double[] valuation)
    Get the median element of a double[]
    static double
    min(double[] values)
    Calculate the minimum value in a double[].
    static double
    mode(double[] values)
    Calculate the mode of a double[].
    static double
    mode(double[] values, int numbins)
    Calculate the mode of a double[].
    static double[]
    scalProd(double[] vect, double mult)
    Do a scalar multiplication of a double[] vector.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • max

      public static double max(double[] values)
      Calculate the maximum value in a double[].
      Parameters:
      values - - the double[] to use
      Returns:
      the maximum
    • min

      public static double min(double[] values)
      Calculate the minimum value in a double[].
      Parameters:
      values - - the double[] to use
      Returns:
      the minimum
    • mode

      public static double mode(double[] values)
      Calculate the mode of a double[].
      Parameters:
      values - - the double[] to use
      Returns:
      the mode
    • mode

      public static double mode(double[] values, int numbins)
      Calculate the mode of a double[].
      Parameters:
      values - - the double[] to use
      numbins - - the number of bins to use for counting
      Returns:
      the mode
    • calcVulnerability

      public static double[] calcVulnerability(double[] tcap, double[] diffs)
      Calculate the vulnerability of set of attack attempts.
      Parameters:
      tcap - - the threat capabilities
      diffs - - the difficulties of the countermeasure
      Returns:
      a double[] with 0/1 indicating whether the attack attempt was successful or not
    • calcSeqVulnerability

      public static double[] calcSeqVulnerability(double[] tcap, double[]... diffs)
      Calculate the vulnerability of set of attack attempts.
      Parameters:
      tcap - - the threat capabilities
      diffs - - the difficulties of multiple countermeasures
      Returns:
      a double[] with 0/1 indicating whether the attack attempt was successful or not
    • ebeMult

      public static double[] ebeMult(double[] value1, double[] value2)
      Provide the element-by-element multiplication of double[]
      Parameters:
      value1 - - first array
      value2 - - second array
      Returns:
      The element-wise product of the two arrays.
    • median

      public static double median(double[] valuation)
      Get the median element of a double[]
      Parameters:
      valuation - the double[] from which to retrieve the median
      Returns:
      the median of the double[]
    • scalProd

      public static double[] scalProd(double[] vect, double mult)
      Do a scalar multiplication of a double[] vector.
      Parameters:
      vect - - the vector
      mult - - the scalar
      Returns:
      the scalar product