Java Code Examples for org.apache.commons.math.util.MathUtils#equalsIncludingNaN()
The following examples show how to use
org.apache.commons.math.util.MathUtils#equalsIncludingNaN() .
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: SummaryStatistics.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a * <code>SummaryStatistics</code> instance and all statistics have the * same values as this. * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this) { return true; } if (object instanceof SummaryStatistics == false) { return false; } SummaryStatistics stat = (SummaryStatistics)object; return MathUtils.equalsIncludingNaN(stat.getGeometricMean(), getGeometricMean()) && MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getSumsq(), getSumsq()) && MathUtils.equalsIncludingNaN(stat.getVariance(), getVariance()); }
Example 2
Source File: MultivariateSummaryStatistics.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a <code>MultivariateSummaryStatistics</code> * instance and all statistics have the same values as this. * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof MultivariateSummaryStatistics == false) { return false; } MultivariateSummaryStatistics stat = (MultivariateSummaryStatistics) object; return MathUtils.equalsIncludingNaN(stat.getGeometricMean(), getGeometricMean()) && MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getSumSq(), getSumSq()) && MathUtils.equalsIncludingNaN(stat.getSumLog(), getSumLog()) && stat.getCovariance().equals( getCovariance()); }
Example 3
Source File: SummaryStatistics.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a * <code>SummaryStatistics</code> instance and all statistics have the * same values as this. * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this) { return true; } if (object instanceof SummaryStatistics == false) { return false; } SummaryStatistics stat = (SummaryStatistics)object; return MathUtils.equalsIncludingNaN(stat.getGeometricMean(), getGeometricMean()) && MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getSumsq(), getSumsq()) && MathUtils.equalsIncludingNaN(stat.getVariance(), getVariance()); }
Example 4
Source File: StatisticalSummaryValues.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a * <code>StatisticalSummaryValues</code> instance and all statistics have * the same values as this. * * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof StatisticalSummaryValues == false) { return false; } StatisticalSummaryValues stat = (StatisticalSummaryValues) object; return MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getVariance(), getVariance()); }
Example 5
Source File: MultivariateSummaryStatistics.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a <code>MultivariateSummaryStatistics</code> * instance and all statistics have the same values as this. * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof MultivariateSummaryStatistics == false) { return false; } MultivariateSummaryStatistics stat = (MultivariateSummaryStatistics) object; return MathUtils.equalsIncludingNaN(stat.getGeometricMean(), getGeometricMean()) && MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getSumSq(), getSumSq()) && MathUtils.equalsIncludingNaN(stat.getSumLog(), getSumLog()) && stat.getCovariance().equals( getCovariance()); }
Example 6
Source File: SummaryStatistics.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a * <code>SummaryStatistics</code> instance and all statistics have the * same values as this. * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this) { return true; } if (object instanceof SummaryStatistics == false) { return false; } SummaryStatistics stat = (SummaryStatistics)object; return MathUtils.equalsIncludingNaN(stat.getGeometricMean(), getGeometricMean()) && MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getSumsq(), getSumsq()) && MathUtils.equalsIncludingNaN(stat.getVariance(), getVariance()); }
Example 7
Source File: StatisticalSummaryValues.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a * <code>StatisticalSummaryValues</code> instance and all statistics have * the same values as this. * * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof StatisticalSummaryValues == false) { return false; } StatisticalSummaryValues stat = (StatisticalSummaryValues) object; return MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getVariance(), getVariance()); }
Example 8
Source File: MultivariateSummaryStatistics.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a <code>MultivariateSummaryStatistics</code> * instance and all statistics have the same values as this. * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof MultivariateSummaryStatistics == false) { return false; } MultivariateSummaryStatistics stat = (MultivariateSummaryStatistics) object; return MathUtils.equalsIncludingNaN(stat.getGeometricMean(), getGeometricMean()) && MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getSumSq(), getSumSq()) && MathUtils.equalsIncludingNaN(stat.getSumLog(), getSumLog()) && stat.getCovariance().equals( getCovariance()); }
Example 9
Source File: SummaryStatistics.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a * <code>SummaryStatistics</code> instance and all statistics have the * same values as this. * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this) { return true; } if (object instanceof SummaryStatistics == false) { return false; } SummaryStatistics stat = (SummaryStatistics)object; return MathUtils.equalsIncludingNaN(stat.getGeometricMean(), getGeometricMean()) && MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getSumsq(), getSumsq()) && MathUtils.equalsIncludingNaN(stat.getVariance(), getVariance()); }
Example 10
Source File: StatisticalSummaryValues.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a * <code>StatisticalSummaryValues</code> instance and all statistics have * the same values as this. * * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof StatisticalSummaryValues == false) { return false; } StatisticalSummaryValues stat = (StatisticalSummaryValues) object; return MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getVariance(), getVariance()); }
Example 11
Source File: MultivariateSummaryStatistics.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a <code>MultivariateSummaryStatistics</code> * instance and all statistics have the same values as this. * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof MultivariateSummaryStatistics == false) { return false; } MultivariateSummaryStatistics stat = (MultivariateSummaryStatistics) object; return MathUtils.equalsIncludingNaN(stat.getGeometricMean(), getGeometricMean()) && MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getSumSq(), getSumSq()) && MathUtils.equalsIncludingNaN(stat.getSumLog(), getSumLog()) && stat.getCovariance().equals( getCovariance()); }
Example 12
Source File: StatisticalSummaryValues.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns true iff <code>object</code> is a * <code>StatisticalSummaryValues</code> instance and all statistics have * the same values as this. * * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof StatisticalSummaryValues == false) { return false; } StatisticalSummaryValues stat = (StatisticalSummaryValues) object; return MathUtils.equalsIncludingNaN(stat.getMax(), getMax()) && MathUtils.equalsIncludingNaN(stat.getMean(), getMean()) && MathUtils.equalsIncludingNaN(stat.getMin(), getMin()) && MathUtils.equalsIncludingNaN(stat.getN(), getN()) && MathUtils.equalsIncludingNaN(stat.getSum(), getSum()) && MathUtils.equalsIncludingNaN(stat.getVariance(), getVariance()); }
Example 13
Source File: AbstractStorelessUnivariateStatistic.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Returns true iff <code>object</code> is an * <code>AbstractStorelessUnivariateStatistic</code> returning the same * values as this for <code>getResult()</code> and <code>getN()</code> * @param object object to test equality against. * @return true if object returns the same value as this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof AbstractStorelessUnivariateStatistic == false) { return false; } AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object; return MathUtils.equalsIncludingNaN(stat.getResult(), this.getResult()) && MathUtils.equalsIncludingNaN(stat.getN(), this.getN()); }
Example 14
Source File: AbstractStorelessUnivariateStatistic.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Returns true iff <code>object</code> is an * <code>AbstractStorelessUnivariateStatistic</code> returning the same * values as this for <code>getResult()</code> and <code>getN()</code> * @param object object to test equality against. * @return true if object returns the same value as this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof AbstractStorelessUnivariateStatistic == false) { return false; } AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object; return MathUtils.equalsIncludingNaN(stat.getResult(), this.getResult()) && MathUtils.equalsIncludingNaN(stat.getN(), this.getN()); }
Example 15
Source File: TestUtils.java From astor with GNU General Public License v2.0 | 5 votes |
/** verifies that two arrays are close (sup norm) */ public static void assertEquals(String msg, double[] expected, double[] observed, double tolerance) { StringBuilder out = new StringBuilder(msg); if (expected.length != observed.length) { out.append("\n Arrays not same length. \n"); out.append("expected has length "); out.append(expected.length); out.append(" observed length = "); out.append(observed.length); Assert.fail(out.toString()); } boolean failure = false; for (int i=0; i < expected.length; i++) { if (!MathUtils.equalsIncludingNaN(expected[i], observed[i], tolerance)) { failure = true; out.append("\n Elements at index "); out.append(i); out.append(" differ. "); out.append(" expected = "); out.append(expected[i]); out.append(" observed = "); out.append(observed[i]); } } if (failure) { Assert.fail(out.toString()); } }
Example 16
Source File: AbstractStorelessUnivariateStatistic.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Returns true iff <code>object</code> is an * <code>AbstractStorelessUnivariateStatistic</code> returning the same * values as this for <code>getResult()</code> and <code>getN()</code> * @param object object to test equality against. * @return true if object returns the same value as this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof AbstractStorelessUnivariateStatistic == false) { return false; } AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object; return MathUtils.equalsIncludingNaN(stat.getResult(), this.getResult()) && MathUtils.equalsIncludingNaN(stat.getN(), this.getN()); }
Example 17
Source File: AbstractStorelessUnivariateStatistic.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Returns true iff <code>object</code> is an * <code>AbstractStorelessUnivariateStatistic</code> returning the same * values as this for <code>getResult()</code> and <code>getN()</code> * @param object object to test equality against. * @return true if object returns the same value as this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof AbstractStorelessUnivariateStatistic == false) { return false; } AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object; return MathUtils.equalsIncludingNaN(stat.getResult(), this.getResult()) && MathUtils.equalsIncludingNaN(stat.getN(), this.getN()); }
Example 18
Source File: TestUtils.java From astor with GNU General Public License v2.0 | 5 votes |
/** verifies that two arrays are close (sup norm) */ public static void assertEquals(String msg, double[] expected, double[] observed, double tolerance) { StringBuilder out = new StringBuilder(msg); if (expected.length != observed.length) { out.append("\n Arrays not same length. \n"); out.append("expected has length "); out.append(expected.length); out.append(" observed length = "); out.append(observed.length); Assert.fail(out.toString()); } boolean failure = false; for (int i=0; i < expected.length; i++) { if (!MathUtils.equalsIncludingNaN(expected[i], observed[i], tolerance)) { failure = true; out.append("\n Elements at index "); out.append(i); out.append(" differ. "); out.append(" expected = "); out.append(expected[i]); out.append(" observed = "); out.append(observed[i]); } } if (failure) { Assert.fail(out.toString()); } }