From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: 2 basic questions : 'lock' and 'median'
Date: Wed, 16 Jun 2010 09:20:21 +0000 (UTC)
Organization: private
Lines: 17
Message-ID: <hva50l$op8$>
References: <hv8lfi$bnp$> <hv8pvu$qc0$> <hv8qik$5fk$> <hv8uu2$5dk$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1276680021 25384 (16 Jun 2010 09:20:21 GMT)
NNTP-Posting-Date: Wed, 16 Jun 2010 09:20:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1751547
Xref: comp.soft-sys.matlab:645293

"Roger Stafford" <> wrote in message <hv8uu2$5dk$>...
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <hv8qik$5fk$>...
> > "Roger Stafford" <> wrote in message <hv8pvu$qc0$>...
> > >  In any case, the median operation probably takes the lion's share of cpu time.
> > 
> > It's surely not optimally implemented in Matlab with sorting. The median could be retrieve in linear time.
> > 
> > Bruno
>   You are right about that Bruno (as usual.)  The recursive "median of the medians" algorithm, (which I've only just now become aware of,) can make it order N, though it is a rather complicated affair.  I wonder if Mathworks has actually implemented such an algorithm in their 'median' routine.
>   I still think it would take considerably more cpu time than the intermediate step of simply constructing a temporary vector of non-zeros in this problem, at least for long vectors.
> Roger Stafford

thanks guys, very instructive on points not even thought about initially, as always.