help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: null(single_row_vector) causes spurious warning in 6.1.0


From: Etienne Grossmann
Subject: Re: null(single_row_vector) causes spurious warning in 6.1.0
Date: Thu, 31 Dec 2020 14:45:11 -0800
User-agent: Internet Messaging Program (IMP) H3 (4.3.10)

  Hello,

just to add: below is a snippet that re-creates what null() does.

It seems the warning in 6.1.0 is legit; 5.2.0 seems lax about the argument of the : operator.

The problem is that diag() has two distinct operations: it turns a vector to a matrix, or vice-versa.

  The patch below fixes this.

========================
--- /usr/local/share/octave/6.1.0/m/linear-algebra/null.m    2020-12-28 13:16:50.326141734 -0800
+++ null.m    2020-12-31 14:41:11.179056624 -0800
@@ -56,7 +56,11 @@
     [U, S, V] = svd (A);
     out_cls = class (V);

-    s = diag (S);
+    if isvector(S)
+      s = S(:);
+    else
+      s = diag (S);
+    end
     if (nargin == 1)
       tol = max (size (A)) * s (1) * eps (out_cls);
     endif
===========================

  Alternatively, we could have safer diag_matrix() and diag_elements() functions, the latter being used instead of diag() in null().

  HTH,

  Etienne

Etienne Grossmann <etienne@isr.tecnico.ulisboa.pt> (Thu, 31 Dec 2020 13:53:11 -0800) wrote:

  Hello,

I see that when null() is passed a single-row vector in Octave 6.1.0, it produces a spurious warning. This warning did not exist in 5.2.0.

  Thanks for making Octave available,

  Etienne

--
http://www.isr.ist.utl.pt/~etienne



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

--
http://www.egdn.net/etienne.html



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]