Java Code Examples for org.apache.commons.math.stat.descriptive.DescriptiveStatistics#INFINITE_WINDOW

The following examples show how to use org.apache.commons.math.stat.descriptive.DescriptiveStatistics#INFINITE_WINDOW . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double[] getValues() {

    int length = list.size();

    // If the window size is not INFINITE_WINDOW AND
    // the current list is larger that the window size, we need to
    // take into account only the last n elements of the list
    // as definied by windowSize

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        length = list.size() - Math.max(0, list.size() - windowSize);
    }

    // Create an array to hold all values
    double[] copiedArray = new double[length];

    for (int i = 0; i < copiedArray.length; i++) {
        copiedArray[i] = getElement(i);
    }
    return copiedArray;
}
 
Example 2
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double getElement(int index) {

    double value = Double.NaN;

    int calcIndex = index;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        calcIndex = (list.size() - windowSize) + index;
    }


    try {
        value = transformer.transform(list.get(calcIndex));
    } catch (MathException e) {
        e.printStackTrace();
    }

    return value;
}
 
Example 3
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public long getN() {
    int n = 0;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > windowSize) {
            n = windowSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
Example 4
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public long getN() {
    int n = 0;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > windowSize) {
            n = windowSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
Example 5
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double getElement(int index) {

    double value = Double.NaN;

    int calcIndex = index;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        calcIndex = (list.size() - windowSize) + index;
    }


    try {
        value = transformer.transform(list.get(calcIndex));
    } catch (MathException e) {
        e.printStackTrace();
    }

    return value;
}
 
Example 6
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double[] getValues() {

    int length = list.size();

    // If the window size is not INFINITE_WINDOW AND
    // the current list is larger that the window size, we need to
    // take into account only the last n elements of the list
    // as definied by windowSize

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        length = list.size() - Math.max(0, list.size() - windowSize);
    }

    // Create an array to hold all values
    double[] copiedArray = new double[length];

    for (int i = 0; i < copiedArray.length; i++) {
        copiedArray[i] = getElement(i);
    }
    return copiedArray;
}
 
Example 7
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public long getN() {
    int n = 0;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > windowSize) {
            n = windowSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
Example 8
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @see org.apache.commons.math.stat.descriptive.DescriptiveStatistics#getValues()
 */
public double[] getValues() {

    int length = list.size();

    // If the window size is not INFINITE_WINDOW AND
    // the current list is larger that the window size, we need to
    // take into account only the last n elements of the list
    // as definied by windowSize

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        length = list.size() - Math.max(0, list.size() - windowSize);
    }

    // Create an array to hold all values
    double[] copiedArray = new double[length];

    for (int i = 0; i < copiedArray.length; i++) {
        copiedArray[i] = getElement(i);
    }
    return copiedArray;
}
 
Example 9
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public long getN() {
    int n = 0;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > windowSize) {
            n = windowSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
Example 10
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double[] getValues() {

    int length = list.size();

    // If the window size is not INFINITE_WINDOW AND
    // the current list is larger that the window size, we need to
    // take into account only the last n elements of the list
    // as definied by windowSize

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        length = list.size() - Math.max(0, list.size() - windowSize);
    }

    // Create an array to hold all values
    double[] copiedArray = new double[length];

    for (int i = 0; i < copiedArray.length; i++) {
        copiedArray[i] = getElement(i);
    }
    return copiedArray;
}
 
Example 11
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double[] getValues() {

    int length = list.size();

    // If the window size is not INFINITE_WINDOW AND
    // the current list is larger that the window size, we need to
    // take into account only the last n elements of the list
    // as definied by windowSize

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        length = list.size() - Math.max(0, list.size() - windowSize);
    }

    // Create an array to hold all values
    double[] copiedArray = new double[length];

    for (int i = 0; i < copiedArray.length; i++) {
        copiedArray[i] = getElement(i);
    }
    return copiedArray;
}
 
Example 12
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double getElement(int index) {

    double value = Double.NaN;

    int calcIndex = index;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        calcIndex = (list.size() - windowSize) + index;
    }


    try {
        value = transformer.transform(list.get(calcIndex));
    } catch (MathException e) {
        e.printStackTrace();
    }

    return value;
}
 
Example 13
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double[] getValues() {

    int length = list.size();

    // If the window size is not INFINITE_WINDOW AND
    // the current list is larger that the window size, we need to
    // take into account only the last n elements of the list
    // as definied by windowSize

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        length = list.size() - Math.max(0, list.size() - windowSize);
    }

    // Create an array to hold all values
    double[] copiedArray = new double[length];

    for (int i = 0; i < copiedArray.length; i++) {
        copiedArray[i] = getElement(i);
    }
    return copiedArray;
}
 
Example 14
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public long getN() {
    int n = 0;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > windowSize) {
            n = windowSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
Example 15
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double[] getValues() {

    int length = list.size();

    // If the window size is not INFINITE_WINDOW AND
    // the current list is larger that the window size, we need to
    // take into account only the last n elements of the list
    // as definied by windowSize

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        length = list.size() - FastMath.max(0, list.size() - windowSize);
    }

    // Create an array to hold all values
    double[] copiedArray = new double[length];

    for (int i = 0; i < copiedArray.length; i++) {
        copiedArray[i] = getElement(i);
    }
    return copiedArray;
}
 
Example 16
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public long getN() {
    int n = 0;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > windowSize) {
            n = windowSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
Example 17
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double getElement(int index) {

    double value = Double.NaN;

    int calcIndex = index;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        calcIndex = (list.size() - windowSize) + index;
    }


    try {
        value = transformer.transform(list.get(calcIndex));
    } catch (MathException e) {
        e.printStackTrace();
    }

    return value;
}
 
Example 18
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double getElement(int index) {

    double value = Double.NaN;

    int calcIndex = index;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
        windowSize < list.size())
    {
        calcIndex = (list.size() - windowSize) + index;
    }


    try {
        value = transformer.transform(list.get(calcIndex));
    } catch (MathException e) {
        e.printStackTrace();
    }

    return value;
}
 
Example 19
Source File: ListUnivariateImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public long getN() {
    int n = 0;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > windowSize) {
            n = windowSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
Example 20
Source File: ListUnivariateImpl.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @see org.apache.commons.math.stat.descriptive.DescriptiveStatistics#getN()
 */
public long getN() {
    int n = 0;

    if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > windowSize) {
            n = windowSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}