[Debian-astro-maintainers] Bug#753089: Patch

Lars Kristian Lundin llundin at eso.org
Thu Jul 3 08:21:51 UTC 2014


tags -1 + patch
Index: cplcore/tests/cpl_matrix-test.c
===================================================================
--- cplcore/tests/cpl_matrix-test.c	(revision 160547)
+++ cplcore/tests/cpl_matrix-test.c	(working copy)
@@ -200,6 +200,7 @@
     FILE       * stream;
     const double * data;
     cpl_boolean  do_bench;
+    cpl_boolean  did_fail;
     cpl_error_code code;
     const cpl_matrix * null; /* This one is expected to be NULL */

@@ -1579,6 +1580,8 @@
   cpl_msg_info("", "Try to solve increasingly large systems A^TAx=A^Tb, "
                "with A(i,j) = 1/(2*n-(1+i+j)) and x(j) = 1");

+  k = 0;
+  did_fail = CPL_FALSE;
   for (size = 1; size < nreps * nelem; size++) {
       cpl_matrix * p2;
       double error, residual;
@@ -1595,6 +1598,12 @@
       cpl_test_nonnull(product);

       xsolv = cpl_matrix_solve_normal(matrix, product);
+      if (cpl_error_get_code()) {
+          cpl_test_error(CPL_ERROR_SINGULAR_MATRIX);
+          cpl_test_null(xsolv);
+          did_fail = CPL_TRUE;
+          break;
+      }
       cpl_test_nonnull(xsolv);

       x_min = cpl_matrix_get_min(xsolv);
@@ -1631,7 +1640,17 @@
                        "x_min=%g, x_max=%g", size, x_min, x_max);
           break;
       }
+      k++;
+  }

+  if (did_fail) {
+      /* Solving stopped prematurely. Normally, we should stop when the
system
+         is near-singular and so ill-conditioned that the solution has an
+         element where not even the most significant bit is correct.
For this
+         final iteration we will allow the solver to alternatively fail
(due a
+         singular matrix).
+         This should add support for Debian sbuild on mips64el */
+      cpl_test_leq(6, k);
   }

   cpl_msg_info("", "Compute the determinant of increasingly large "



More information about the Debian-astro-maintainers mailing list