diff scripts/linear-algebra/onenormest.m @ 7795:df9519e9990c

Handle single precision eps values
author David Bateman <dbateman@free.fr>
date Mon, 12 May 2008 22:57:11 +0200
parents b48a21816f2e
children bc982528de11
line wrap: on
line diff
--- a/scripts/linear-algebra/onenormest.m	Mon May 12 01:35:30 2008 +0200
+++ b/scripts/linear-algebra/onenormest.m	Mon May 12 22:57:11 2008 +0200
@@ -111,6 +111,7 @@
     else
       t = min (n, default_t);
     endif
+    issing = isa (varargin {1}, "single");
   else
     if (size (varargin, 2) < 3)
       print_usage();
@@ -123,6 +124,7 @@
     else
       t = default_t;
     endif
+    issing = isa (varargin {3}, "single");
   endif
 
   ## Initial test vectors X.
@@ -133,6 +135,13 @@
   est_old = 0; # To check if the estimate has increased.
   S = zeros (n, t); # Normalized vector of signs.  The normalization is 
 
+  if (issing)
+    myeps = eps ("single");
+    X = single (X);
+  else
+    myeps = eps;
+  endif
+
   for iter = 1 : itmax + 1
     Y = feval (apply, X);