help-octave
[Top][All Lists]
Advanced

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

Re: Simple Matrix Manipulation Extressions


From: John W. Eaton
Subject: Re: Simple Matrix Manipulation Extressions
Date: Mon, 10 Nov 1997 03:43:19 -0600

On 10-Nov-1997, Dirk Laurie <address@hidden> wrote:

|  do_fortran_indexing=1; 
|  [x,j]=sort(A(:));                 % The method works for two vectors
|  [x,k]=sort([x; v(:)]);   
|  m=1:length(k); m(k)=1:length(k);
|  count=A; count(j)=m(1:length(j))-(1:length(j));
| 
| I suppose this is `a bit horrible' but it does have complexity
| less than length(x)*length(v) and there are no loops.  It will
| not work properly if the internal sorting algorithm of octave
| allows equal elements to exchange places.

No, it doesn't -- Octave's sort function is based on algorithm 5.2.4L
from Knuth, Volume 3, and it is stable.

jwe



reply via email to

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