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

The following examples show how to use org.apache.commons.math3.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 getElement(int index) {

    double value = Double.NaN;

    int calcIndex = index;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW && wSize < list.size()) {
        calcIndex = (list.size() - wSize) + index;
    }


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

    return value;
}
 
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[] 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

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

    // 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 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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > wSize) {
            n = wSize;
        } 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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > wSize) {
            n = wSize;
        } 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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW && wSize < list.size()) {
        calcIndex = (list.size() - wSize) + index;
    }


    try {
        value = transformer.transform(list.get(calcIndex));
    } catch (MathIllegalArgumentException 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

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

    // 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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > wSize) {
            n = wSize;
        } 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
/** {@inheritDoc} */
@Override
public double getElement(int index) {

    double value = Double.NaN;

    int calcIndex = index;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW && wSize < list.size()) {
        calcIndex = (list.size() - wSize) + index;
    }


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

    return value;
}
 
Example 9
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

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

    // 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 10
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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > wSize) {
            n = wSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
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

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

    // 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[] 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

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

    // 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 13
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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > wSize) {
            n = wSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
Example 14
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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW && wSize < list.size()) {
        calcIndex = (list.size() - wSize) + index;
    }


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

    return value;
}
 
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

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

    // 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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > wSize) {
            n = wSize;
        } 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 long getN() {
    int n = 0;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > wSize) {
            n = wSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
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[] 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

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

    // 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 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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW) {
        if (list.size() > wSize) {
            n = wSize;
        } else {
            n = list.size();
        }
    } else {
        n = list.size();
    }
    return n;
}
 
Example 20
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;

    final int wSize = getWindowSize();
    if (wSize != DescriptiveStatistics.INFINITE_WINDOW && wSize < list.size()) {
        calcIndex = (list.size() - wSize) + index;
    }


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

    return value;
}