/** * {@inheritDoc} */ @Override public FirstMoment copy() { FirstMoment result = new FirstMoment(); copy(this, result); return result; }
/** * {@inheritDoc} */ @Override public void clear() { if (incMoment) { moment.clear(); } }
/** * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#getN() */ public long getN() { return moment.getN(); }
/** * {@inheritDoc} */ @Override public void increment(final double d) { if (n < 1) { m1 = m2 = 0.0; } super.increment(d); m2 += ((double) n - 1) * dev * nDev; }
/** Constructs a Mean. */ public Mean() { incMoment = true; moment = new FirstMoment(); }
/** * Copy constructor, creates a new {@code FirstMoment} identical * to the {@code original} * * @param original the {@code FirstMoment} instance to copy */ public FirstMoment(FirstMoment original) { super(); copy(original, this); }
/** * Copies source to dest. * <p>Neither source nor dest can be null.</p> * * @param source FirstMoment to copy * @param dest FirstMoment to copy to * @throws NullPointerException if either source or dest is null */ public static void copy(FirstMoment source, FirstMoment dest) { dest.setData(source.getDataRef()); dest.n = source.n; dest.m1 = source.m1; dest.dev = source.dev; dest.nDev = source.nDev; } }
/** * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#increment(double) */ public void increment(final double d) { if (incMoment) { moment.increment(d); } }
/** Constructs a Mean. */ public Mean() { incMoment = true; moment = new FirstMoment(); }
/** * Copies source to dest. * <p>Neither source nor dest can be null.</p> * * @param source SecondMoment to copy * @param dest SecondMoment to copy to * @throws NullPointerException if either source or dest is null */ public static void copy(SecondMoment source, SecondMoment dest) { FirstMoment.copy(source, dest); dest.m2 = source.m2; }
/** * {@inheritDoc} */ @Override public void increment(final double d) { if (n < 1) { m1 = m2 = 0.0; } super.increment(d); m2 += ((double) n - 1) * dev * nDev; }
/** * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#clear() */ public void clear() { super.clear(); m2 = Double.NaN; }
/** * {@inheritDoc} */ @Override public FirstMoment copy() { FirstMoment result = new FirstMoment(); copy(this, result); return result; }
/** Constructs a Mean. */ public Mean() { incMoment = true; moment = new FirstMoment(); }
/** * {@inheritDoc} */ public long getN() { return moment.getN(); }
/** * Copies source to dest. * <p>Neither source nor dest can be null.</p> * * @param source Mean to copy * @param dest Mean to copy to * @throws NullPointerException if either source or dest is null */ public static void copy(Mean source, Mean dest) { dest.incMoment = source.incMoment; dest.moment = source.moment.copy(); } }
/** * {@inheritDoc} */ @Override public void increment(final double d) { if (incMoment) { moment.increment(d); } }
/** * {@inheritDoc} */ @Override public void clear() { super.clear(); m2 = Double.NaN; }
/** * {@inheritDoc} */ public long getN() { return moment.getN(); }
/** * Copies source to dest. * <p>Neither source nor dest can be null.</p> * * @param source SecondMoment to copy * @param dest SecondMoment to copy to * @throws NullPointerException if either source or dest is null */ public static void copy(SecondMoment source, SecondMoment dest) { FirstMoment.copy(source, dest); dest.m2 = source.m2; }