/** * Returns {@code true} if, both for the real part and for the imaginary * part, there is no double value strictly between the arguments or the * relative difference between them is smaller or equal to the given * tolerance. Returns {@code false} if either of the arguments is NaN. * * @param x First value (cannot be {@code null}). * @param y Second value (cannot be {@code null}). * @param eps Amount of allowed relative error. * @return {@code true} if the values are two adjacent floating point * numbers or they are within range of each other. * * @see Precision#equalsWithRelativeTolerance(double,double,double) * @since 3.3 */ public static boolean equalsWithRelativeTolerance(Complex x, Complex y, double eps) { return Precision.equalsWithRelativeTolerance(x.real, y.real, eps) && Precision.equalsWithRelativeTolerance(x.imaginary, y.imaginary, eps); }
/** {@inheritDoc} */ public boolean converged(final int iteration, final Evaluation previous, final Evaluation current) { final double prevRms = previous.getRMS(); final double currRms = current.getRMS(); return Precision.equals(prevRms, currRms, this.absTol) || Precision.equalsWithRelativeTolerance(prevRms, currRms, this.relTol); }
/** * Returns {@code true} if, both for the real part and for the imaginary * part, there is no double value strictly between the arguments or the * relative difference between them is smaller or equal to the given * tolerance. Returns {@code false} if either of the arguments is NaN. * * @param x First value (cannot be {@code null}). * @param y Second value (cannot be {@code null}). * @param eps Amount of allowed relative error. * @return {@code true} if the values are two adjacent floating point * numbers or they are within range of each other. * * @see Precision#equalsWithRelativeTolerance(double,double,double) * @since 3.3 */ public static boolean equalsWithRelativeTolerance(Complex x, Complex y, double eps) { return Precision.equalsWithRelativeTolerance(x.real, y.real, eps) && Precision.equalsWithRelativeTolerance(x.imaginary, y.imaginary, eps); }
/** * Returns {@code true} if, both for the real part and for the imaginary * part, there is no double value strictly between the arguments or the * relative difference between them is smaller or equal to the given * tolerance. Returns {@code false} if either of the arguments is NaN. * * @param x First value (cannot be {@code null}). * @param y Second value (cannot be {@code null}). * @param eps Amount of allowed relative error. * @return {@code true} if the values are two adjacent floating point * numbers or they are within range of each other. * * @see Precision#equalsWithRelativeTolerance(double,double,double) * @since 3.3 */ public static boolean equalsWithRelativeTolerance(Complex x, Complex y, double eps) { return Precision.equalsWithRelativeTolerance(x.real, y.real, eps) && Precision.equalsWithRelativeTolerance(x.imaginary, y.imaginary, eps); }
/** {@inheritDoc} */ public boolean converged(final int iteration, final Evaluation previous, final Evaluation current) { final double prevRms = previous.getRMS(); final double currRms = current.getRMS(); return Precision.equals(prevRms, currRms, this.absTol) || Precision.equalsWithRelativeTolerance(prevRms, currRms, this.relTol); }
/** {@inheritDoc} */ public boolean converged(final int iteration, final Evaluation previous, final Evaluation current) { final double prevRms = previous.getRMS(); final double currRms = current.getRMS(); return Precision.equals(prevRms, currRms, this.absTol) || Precision.equalsWithRelativeTolerance(prevRms, currRms, this.relTol); }