diff scripts/optimization/qp.m @ 7795:df9519e9990c

Handle single precision eps values
author David Bateman <dbateman@free.fr>
date Mon, 12 May 2008 22:57:11 +0200
parents a1dbe9d80eee
children 5ee11a81688e
line wrap: on
line diff
--- a/scripts/optimization/qp.m
+++ b/scripts/optimization/qp.m
@@ -188,7 +188,12 @@
     n_in = length (bin);
 
     ## Check if the initial guess is feasible.
-    rtol = sqrt (eps);
+    if (isa (x0, "single") || isa (H, "single") || isa (q, "single") || isa (A, "single")
+	|| isa (b, "single"))
+      rtol = sqrt (eps ("single"));
+    else
+      rtol = sqrt (eps);
+    endif
 
     eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+norm (b)));
     in_infeasible = (n_in > 0 && any (Ain*x0-bin < -rtol*(1+norm (bin))));