/** * 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 NullArgumentException if either source or dest is null */ public static void copy(SecondMoment source, SecondMoment dest) { MathUtils.checkNotNull(source); MathUtils.checkNotNull(dest); FirstMoment.copy(source, dest); dest.m2 = source.m2; }
/** * {@inheritDoc} */ public override UnivariateStatistic copy()//TODO: Supposed to be public override SecondMoment copy() { SecondMoment result = new SecondMoment(); // no try-catch or advertised NAE because args are guaranteed non-null copy(this, result); return(result); }
/** * Copy constructor, creates a new {@code SecondMoment} identical * to the {@code original} * * @param original the {@code SecondMoment} instance to copy * @throws NullArgumentException if original is null */ public SecondMoment(SecondMoment original) : base(original) { m2 = original.m2; }
/** * Constructs a Variance with the specified <code>isBiasCorrected</code> * property and the supplied external second moment. * * @param isBiasCorrected setting for bias correction - true means * bias will be corrected * @param m2 the SecondMoment (Third or Fourth moments work * here as well.) */ public Variance(bool isBiasCorrected, SecondMoment m2) { incMoment = false; moment = m2; _isBiasCorrected = isBiasCorrected; }
/** * Constructs a Variance with the specified <code>isBiasCorrected</code> * property * * @param isBiasCorrected setting for bias correction - true means * bias will be corrected and is equivalent to using the argumentless * constructor */ public Variance(bool isBiasCorrected) { moment = new SecondMoment(); _isBiasCorrected = isBiasCorrected; }
/** * Constructs a Variance based on an external second moment. * When this constructor is used, the statistic may only be * incremented via the moment, i.e., {@link #increment(double)} * does nothing; whereas {@code m2.increment(value)} increments * both {@code m2} and the Variance instance constructed from it. * * @param m2 the SecondMoment (Third or Fourth moments work * here as well.) */ public Variance(SecondMoment m2) { incMoment = false; moment = m2; }
/** * Constructs a Variance with default (true) <code>isBiasCorrected</code> * property. */ public Variance() { moment = new SecondMoment(); }