From: Lucio <lcetto@mathworks.com>
Path: news.mathworks.com!newsfeed-00.mathworks.com!webcrossing
Newsgroups: comp.soft-sys.matlab
Subject: Re: Obfuscation
Message-ID: <ef55232.9@webcrossing.raydaftYaTP>
Date: Wed, 9 May 2007 13:44:58 -0400
References: <ef55232.2@webcrossing.raydaftYaTP> <ef55232.3@webcrossing.raydaftYaTP> <ef55232.5@webcrossing.raydaftYaTP> <ef55232.7@webcrossing.raydaftYaTP> <ef55232.8@webcrossing.raydaftYaTP>
Lines: 72
NNTP-Posting-Host: 144.212.4.9
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Xref: news.mathworks.com comp.soft-sys.matlab:407959



OK to run in 7.1 change the following lines, sorry for the wrapping,
we will update the zip file and investigate further the other Windy's
problem (Windy, what release are you using?)

% c = c(:,~(sum(bsxfun(mf,1:size(c,2),(1:size(c,2))'))>1))';
  
CHANGE TO:

  MF = zeros(size(c,2));
  for i1 = 1:size(c,2)
      for i2 = 1:size(c,2)
          MF(i1,i2) = mf(i1,i2);
      end
  end
  c = c(:,~sum(MF)>1)';

% patch(bsxfun(@plus,j(:)',.1*sin(-2*pi:pi/4:2*pi)'),...
% bsxfun(@plus,i(:)',.1*cos(-2*pi:pi/4:2*pi)'),...
% zeros(17,numel(i)),'faceC',[0 .5 0],'FaceL','none');

CHANGE TO:

patch(repmat(j(:)',17,1)+repmat(.1*sin(-2*pi:pi/4:2*pi)',1,numel(j)),.
..
       
repmat(i(:)',17,1)+repmat(.1*cos(-2*pi:pi/4:2*pi)',1,numel(i)),...
        zeros(17,numel(i)),'faceC',[0 .5 0],'FaceL','none');

Lucio

 Alan Chalker wrote:
>
>
> Markus wrote:
>>
>>
>> Hi!
>>
>> I am having the same problem with the bsxfun error message, as
I
> am
>> running R2006a. The contest team did a good job in obfuscation,
> or
>> what do you think about these lines?
>>
>> % mf = @(g,h) arrayfun(@(h)
>> all(inpolygon(c{1,g},c{2,g},c{1,h},c{2,h})),h);
>> % c =
c(:,~(sum(bsxfun(mf,1:size(c,2),(1:size(c,2))'))>1))';
>>
>> This source couldn't be easier to read I guess :-)
>>
>> A good contest to all of you!
>>
>> Markus
>
>
> It's not deliberate obscufation that I can tell. The first line is
> setting up an nested anonymous function handle (search for
> anonymous
> functions in the MATLAB help for info). bsxfun is a new one to me,
> but it applies element by element binary operations to 2 arrays.
>
> The bottom line is they have used some of the more advanced
> functionality to setup a demo solver and runcontest program that is
> vectorized versus containing a lot of loops. This also factors
> into
> the new Complexity rating.
>
> Kudos to them for setting the bar high on this contest by trying to
> start us off on a vectorized path instead of the 'easier to follow'
> looping path many people would prefer to take.