Skip navigation links
org.matheclipse.core.stat.descriptive

Class AbstractSymbolicStorelessUnivariateStatistic

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      abstract void clear()
      Clears the internal state of the Statistic
      IExpr evaluate(IAST values)
      This default implementation calls clear(), then invokes increment(org.matheclipse.core.interfaces.IExpr) in a loop over the the input array, and then uses getResult() to compute the return value.
      IExpr evaluate(IAST values, int begin, int length)
      This default implementation calls clear(), then invokes increment(org.matheclipse.core.interfaces.IExpr) in a loop over the specified portion of the input array, and then uses getResult() to compute the return value.
      abstract long getN()
      Returns the number of values that have been added.
      abstract IExpr getResult()
      Returns the current value of the Statistic.
      abstract void increment(IExpr d)
      Updates the internal state of the statistic to reflect the addition of the new value.
      void incrementAll(IAST values)
      This default implementation just calls increment(org.matheclipse.core.interfaces.IExpr) in a loop over the input array.
      void incrementAll(IAST values, int begin, int length)
      This default implementation just calls increment(org.matheclipse.core.interfaces.IExpr) in a loop over the specified portion of the input array.
      protected boolean test(IAST values, IAST weights, int begin, int length)
      This method is used by evaluate(double[], double[], int, int) methods to verify that the begin and length parameters designate a subarray of positive length and the weights are all non-negative, non-NaN, finite, and not all zero.
      protected boolean test(IAST values, IAST weights, int begin, int length, boolean allowEmpty)
      This method is used by evaluate(double[], double[], int, int) methods to verify that the begin and length parameters designate a subarray of positive length and the weights are all non-negative, non-NaN, finite, and not all zero.
      protected boolean test(IAST values, int begin, int length)
      This method is used by evaluate(double[], int, int) methods to verify that the input parameters designate a subarray of positive length.
      protected boolean test(IAST values, int begin, int length, boolean allowEmpty)
      This method is used by evaluate(double[], int, int) methods to verify that the input parameters designate a subarray of positive length.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractSymbolicStorelessUnivariateStatistic

        public AbstractSymbolicStorelessUnivariateStatistic()
    • Method Detail

      • evaluate

        public IExpr evaluate(IAST values)
        This default implementation calls clear(), then invokes increment(org.matheclipse.core.interfaces.IExpr) in a loop over the the input array, and then uses getResult() to compute the return value.

        Note that this implementation changes the internal state of the statistic. Its side effects are the same as invoking clear() and then #incrementAll(double[]).

        Implementations may override this method with a more efficient and possibly more accurate implementation that works directly with the input array.

        If the array is null, an IllegalArgumentException is thrown.

        Specified by:
        evaluate in interface SymbolicUnivariateStatistic
        Parameters:
        values - input array
        Returns:
        the value of the statistic applied to the input array
        See Also:
        UnivariateStatistic.evaluate(double[])
      • evaluate

        public IExpr evaluate(IAST values,
                              int begin,
                              int length)
        This default implementation calls clear(), then invokes increment(org.matheclipse.core.interfaces.IExpr) in a loop over the specified portion of the input array, and then uses getResult() to compute the return value.

        Note that this implementation changes the internal state of the statistic. Its side effects are the same as invoking clear() and then #incrementAll(double[], int, int).

        Implementations may override this method with a more efficient and possibly more accurate implementation that works directly with the input array.

        If the array is null or the index parameters are not valid, an IllegalArgumentException is thrown.

        Specified by:
        evaluate in interface SymbolicUnivariateStatistic
        Parameters:
        values - the input array
        begin - the index of the first element to include
        length - the number of elements to include
        Returns:
        the value of the statistic applied to the included array entries
        See Also:
        UnivariateStatistic.evaluate(double[], int, int)
      • getResult

        public abstract IExpr getResult()
        Returns the current value of the Statistic.
        Specified by:
        getResult in interface StorelessSymbolicUnivariateStatistic
        Returns:
        value of the statistic, Double.NaN if it has been cleared or just instantiated.
      • incrementAll

        public void incrementAll(IAST values,
                                 int begin,
                                 int length)
        This default implementation just calls increment(org.matheclipse.core.interfaces.IExpr) in a loop over the specified portion of the input array.

        Throws IllegalArgumentException if the input values array is null.

        Specified by:
        incrementAll in interface StorelessSymbolicUnivariateStatistic
        Parameters:
        values - array holding values to add
        begin - index of the first array element to add
        length - number of array elements to add
        Throws:
        java.lang.IllegalArgumentException - if values is null
        See Also:
        StorelessUnivariateStatistic.incrementAll(double[], int, int)
      • test

        protected boolean test(IAST values,
                               int begin,
                               int length)
        This method is used by evaluate(double[], int, int) methods to verify that the input parameters designate a subarray of positive length.

        • returns true iff the parameters designate a subarray of positive length
        • throws IllegalArgumentException if the array is null or or the indices are invalid
        • returns false
        • if the array is non-null, but length is 0.

        Parameters:
        values - the input array
        begin - index of the first array element to include
        length - the number of elements to include
        Returns:
        true if the parameters are valid and designate a subarray of positive length
        Throws:
        java.lang.IllegalArgumentException - if the indices are invalid or the array is null
      • test

        protected boolean test(IAST values,
                               int begin,
                               int length,
                               boolean allowEmpty)
        This method is used by evaluate(double[], int, int) methods to verify that the input parameters designate a subarray of positive length.

        • returns true iff the parameters designate a subarray of non-negative length
        • throws IllegalArgumentException if the array is null or or the indices are invalid
        • returns false
        • if the array is non-null, but length is 0 unless allowEmpty is true

        Parameters:
        values - the input array
        begin - index of the first array element to include
        length - the number of elements to include
        allowEmpty - if true then zero length arrays are allowed
        Returns:
        true if the parameters are valid
        Throws:
        java.lang.IllegalArgumentException - if the indices are invalid or the array is null
        Since:
        3.0
      • test

        protected boolean test(IAST values,
                               IAST weights,
                               int begin,
                               int length)
        This method is used by evaluate(double[], double[], int, int) methods to verify that the begin and length parameters designate a subarray of positive length and the weights are all non-negative, non-NaN, finite, and not all zero.

        • returns true iff the parameters designate a subarray of positive length and the weights array contains legitimate values.
        • throws IllegalArgumentException if any of the following are true:
          • the values array is null
          • the weights array is null
          • the weights array does not have the same length as the values array
          • the weights array contains one or more infinite values
          • the weights array contains one or more NaN values
          • the weights array contains negative values
          • the start and length arguments do not determine a valid array
        • returns false
        • if the array is non-null, but length is 0.

        Parameters:
        values - the input array
        weights - the weights array
        begin - index of the first array element to include
        length - the number of elements to include
        Returns:
        true if the parameters are valid and designate a subarray of positive length
        Throws:
        java.lang.IllegalArgumentException - if the indices are invalid or the array is null
        Since:
        2.1
      • test

        protected boolean test(IAST values,
                               IAST weights,
                               int begin,
                               int length,
                               boolean allowEmpty)
        This method is used by evaluate(double[], double[], int, int) methods to verify that the begin and length parameters designate a subarray of positive length and the weights are all non-negative, non-NaN, finite, and not all zero.

        • returns true iff the parameters designate a subarray of non-negative length and the weights array contains legitimate values.
        • throws IllegalArgumentException if any of the following are true:
          • the values array is null
          • the weights array is null
          • the weights array does not have the same length as the values array
          • the weights array contains one or more infinite values
          • the weights array contains one or more NaN values
          • the weights array contains negative values
          • the start and length arguments do not determine a valid array
        • returns false
        • if the array is non-null, but length is 0 unless allowEmpty is true.

        Parameters:
        values - the input array.
        weights - the weights array.
        begin - index of the first array element to include.
        length - the number of elements to include.
        allowEmpty - if true than allow zero length arrays to pass.
        Returns:
        true if the parameters are valid.
        Throws:
        java.lang.IllegalArgumentException - if the indices are invalid or the array is null.
        Since:
        3.0