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

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

[Octave-bug-tracker] [bug #33197] sortrows does not work with single row


From: Marco Caliari
Subject: [Octave-bug-tracker] [bug #33197] sortrows does not work with single row arrays
Date: Mon, 02 May 2011 13:04:38 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13

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

I confirm the problem.

When you call sortrows with a row as first argument and a scalar as second
argument, then sort_rows_idx in ov-base-scalar.h is called, which gives an
empty vector 1x0 as output. I don't know if there is a reason for that. I can
fix the problem if I replace


return Array<octave_idx_type> (dim_vector (1, 0));
-verbatim

with


Array<octave_idx_type> idx;
idx.resize (dim_vector (1, 1));
idx(0) = 0;
return idx;


which is somehow similar to the result of sort some lines above. But maybe it
is safer to modify sortrows.m with something like


if (rows (A) == 1)
  i = 1;
elseif (issparse (A))
  ...


Marco

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?33197>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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