Exemplo n.º 1
0
 /**
  * Check norm of difference of Matrices. *
  *
  * @param X Description of the Parameter
  * @param Y Description of the Parameter
  */
 private static void check(Matrix X, Matrix Y) {
   double eps = Math.pow(2.0, -52.0);
   if (X.norm1() == 0. & Y.norm1() < 10 * eps) {
     return;
   }
   if (Y.norm1() == 0. & X.norm1() < 10 * eps) {
     return;
   }
   if (X.minus(Y).norm1() > 1000 * eps * Math.max(X.norm1(), Y.norm1())) {
     throw new RuntimeException(
         "The norm of (X-Y) is too large: " + Double.toString(X.minus(Y).norm1()));
   }
 }
Exemplo n.º 2
0
 /**
  * Check magnitude of difference of scalars. *
  *
  * @param x Description of the Parameter
  * @param y Description of the Parameter
  */
 private static void check(double x, double y) {
   double eps = Math.pow(2.0, -52.0);
   if (x == 0 & Math.abs(y) < 10 * eps) {
     return;
   }
   if (y == 0 & Math.abs(x) < 10 * eps) {
     return;
   }
   if (Math.abs(x - y) > 10 * eps * Math.max(Math.abs(x), Math.abs(y))) {
     throw new RuntimeException(
         "The difference x-y is too large: x = "
             + Double.toString(x)
             + "  y = "
             + Double.toString(y));
   }
 }