Path: news.mathworks.com!not-for-mail
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$1@fred.mathworks.com>
References: <hv8lfi$bnp$1@fred.mathworks.com> <hv8pvu$qc0$1@fred.mathworks.com> <hv8qik$5fk$1@fred.mathworks.com> <hv8uu2$5dk$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1276680021 25384 172.30.248.37 (16 Jun 2010 09:20:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 16 Jun 2010 09:20:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1751547
Xref: news.mathworks.com comp.soft-sys.matlab:645293

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hv8uu2$5dk$1@fred.mathworks.com>...
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <hv8qik$5fk$1@fred.mathworks.com>...
> > "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hv8pvu$qc0$1@fred.mathworks.com>...
> > >  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.