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

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

[Octave-bug-tracker] [bug #65616] complex sorting should be only for com


From: Rik
Subject: [Octave-bug-tracker] [bug #65616] complex sorting should be only for complex numbers
Date: Sun, 21 Apr 2024 16:22:03 -0400 (EDT)

Update of bug #65616 (group octave):

                  Status:                    None => Wont Fix               
             Open/Closed:                    Open => Closed                 
        Operating System:       Microsoft Windows => Any                    

    _______________________________________________________

Follow-up Comment #4:

Matlab and Octave distinguish complex arrays from real arrays and use the
appropriate sort algorithm for the array type.  Note that the decision on
which algorithm to use is made based on the array itself, and not portions of
the array which may or may not be complex.  This behavior will not be changed
unless Matlab should decide to behave differently.

If you really must have the sort algorithm depend on whether a row is complex
then extract each row and sort it individually.

Sample Code:


x = [1 0 -1; 0 1+0.001i -1];  # Sample data

sz = size (x);
nr = sz(1);
y = zeros (sz);
for r = 1:nr
  y(r,:) = sort (x(r,:));
endfor


This isn't guaranteed to be particularly fast if your array is very large.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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