changeset 32208:d350f3e1faf2

maint: merge stable to default
author Rik <rik@octave.org>
date Tue, 18 Jul 2023 17:46:09 -0700
parents b8e1440b3b29 (current diff) b73ebf017461 (diff)
children 20c84bfef1af
files libinterp/corefcn/__ichol__.cc
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/__ichol__.cc	Mon Jul 17 11:47:52 2023 -0700
+++ b/libinterp/corefcn/__ichol__.cc	Tue Jul 18 17:46:09 2023 -0700
@@ -27,6 +27,8 @@
 #  include "config.h"
 #endif
 
+#include <limits>
+
 #include "oct-locbuf.h"
 #include "oct-norm.h"
 
@@ -57,7 +59,7 @@
 
 bool ichol_checkpivot_complex (Complex pivot)
 {
-  if (pivot.imag () != 0)
+  if (fabs (pivot.imag ()) > std::numeric_limits<double>::epsilon())
     error ("ichol: non-real pivot encountered.  The matrix must be Hermitian.");
   else if (pivot.real () < 0)
     error ("ichol: negative pivot encountered");
--- a/scripts/sparse/pcg.m	Mon Jul 17 11:47:52 2023 -0700
+++ b/scripts/sparse/pcg.m	Tue Jul 18 17:46:09 2023 -0700
@@ -616,8 +616,8 @@
 %! b = A * ones (N, 1);
 %! M2 = chol (A + 0.1 * eye (N));  # Factor of a perturbed matrix
 %! M = M2' * M2;
-%! Hermitian_A = ishermitian (A);
-%! Hermitian_M = ishermitian (M);
+%! Hermitian_A = ishermitian (A, eps);  # AVX optimization can cause matrix
+%! Hermitian_M = ishermitian (M, eps);  # to miss being Hermitian by eps.
 %! [x, flag] = pcg (A, b, [], 2*N, M);
 %! assert (Hermitian_A, true);
 %! assert (Hermitian_M, true);