LeastSquareResults { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final LeastSquareResults other = (LeastSquareResults) obj; if (Double.doubleToLongBits(_chiSq) != Double.doubleToLongBits(other._chiSq)) { return false; } if (!ObjectUtils.equals(_covariance, other._covariance)) { return false; } if (!ObjectUtils.equals(_inverseJacobian, other._inverseJacobian)) { return false; } return ObjectUtils.equals(_parameters, other._parameters); } LeastSquareResults(LeastSquareResults from);  LeastSquareResults(final double chiSq, final DoubleMatrix1D parameters, final DoubleMatrix2D covariance);  LeastSquareResults(final double chiSq, final DoubleMatrix1D parameters, final DoubleMatrix2D covariance, final DoubleMatrix2D inverseJacobian); @Override String toString(); double getChiSq(); DoubleMatrix1D getFitParameters(); DoubleMatrix2D getCovariance(); DoubleMatrix2D getFittingParameterSensitivityToData(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testEquals() { LeastSquareResults ls1 = new LeastSquareResults(1.0, PARAMS, COVAR); LeastSquareResults ls2 = new LeastSquareResults(1.0, new DoubleMatrix1D(new double[] {1.0, 2.0 }), new DoubleMatrix2D(new double[][] { {0.1, 0.2 }, {0.2, 0.3 } })); assertEquals(ls1, ls2); ls2 = new LeastSquareResults(1.0, PARAMS, COVAR, null); assertEquals(ls1, ls2); ls2 = new LeastSquareResults(1.1, PARAMS, COVAR); assertFalse(ls1.equals(ls2)); ls2 = new LeastSquareResults(1.0, new DoubleMatrix1D(new double[] {1.1, 2.0 }), new DoubleMatrix2D(new double[][] { {0.1, 0.2 }, {0.2, 0.3 } })); assertFalse(ls1.equals(ls2)); ls2 = new LeastSquareResults(1.0, new DoubleMatrix1D(new double[] {1.0, 2.0 }), new DoubleMatrix2D(new double[][] { {0.1, 0.2 }, {0.2, 0.4 } })); assertFalse(ls1.equals(ls2)); ls2 = new LeastSquareResults(1.0, PARAMS, COVAR, INV_JAC); assertFalse(ls1.equals(ls2)); ls1 = new LeastSquareResults(1, PARAMS, COVAR, INV_JAC); ls2 = new LeastSquareResults(1, PARAMS, COVAR, COVAR); assertFalse(ls1.equals(ls2)); }