changeset 29415:eb52033f4e2a

null.m: suppress unnecessary warning (bug #60190). * null.m: Check whether matrix from SVD de-composition is a true diagonal matrix, in which case call diag() on it, or a row vector, in which case make it a column vector.
author Rik <rik@octave.org>
date Mon, 08 Mar 2021 11:58:10 -0800
parents 0006d00aa097
children 3f45f5b6fa7f
files scripts/linear-algebra/null.m
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/linear-algebra/null.m	Mon Mar 08 19:10:58 2021 +0100
+++ b/scripts/linear-algebra/null.m	Mon Mar 08 11:58:10 2021 -0800
@@ -55,9 +55,13 @@
   else
     out_cls = class (V);
 
-    s = diag (S);
+    if (rows (A) > 1)
+      s = diag (S);
+    else
+      s = S.';
+    end
     if (nargin == 1)
-      tol = max (size (A)) * s (1) * eps (out_cls);
+      tol = max (size (A)) * s(1) * eps (out_cls);
     endif
     rank = sum (s > tol);