octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #61305] In linear-algebra/null.m function, lin


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #61305] In linear-algebra/null.m function, line 63 should use upper case S instead of the lower case s. rank = sum (S > tol)
Date: Thu, 7 Oct 2021 10:26:49 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0

Follow-up Comment #1, bug #61305 (project octave):

@OP, can you provide more context about what you were trying to do, what you
got, and what you think the result should be?

For context, the function null.m is reproduced here with line numbers. The
line "rank = sum (...." part is on line 66 below.


    41  function Z = null (A, tol)
    42  
    43    if (nargin < 1)
    44      print_usage ();
    45    elseif (nargin == 2 && strcmp (tol, "r"))
    46      error ("null: option for rational not yet implemented");
    47    endif
    48  
    49    [~, S, V] = svd (A, 0);  # Use economy-sized svd if possible.
    50  
    51    ## In case of A = [], zeros (0,X), zeros (X,0) Matlab R2020b seems
to
    52    ## simply return the nullspace "V" of the svd-decomposition (bug
#59630).
    53    if (isempty (A))
    54      Z = V;
    55    else
    56      out_cls = class (V);
    57  
    58      if (rows (A) > 1)
    59        s = diag (S);
    60      else
    61        s = S.';
    62      end
    63      if (nargin == 1)
    64        tol = max (size (A)) * s(1) * eps (out_cls);
    65      endif
    66      rank = sum (s > tol);
    67  
    68      cols = columns (A);
    69      if (rank < cols)
    70        Z = V(:, rank+1:cols);
    71        Z(abs (Z) < eps (out_cls)) = 0;
    72      else
    73        Z = zeros (cols, 0, out_cls);
    74      endif
    75    endif
    76  
    77  endfunction



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61305>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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