Sven - MATLAB Cody - MATLAB Central

Sven

1324
Rank
4
Badges
1788
Score
51 – 100 of 263

Sven submitted a Comment to Solution 111016

Hehe... yep I'm sure that would send us scrambling to add a tolerance to whatever-the-current-best-solution-was. But if this were intended for a bwboundaries(BW,'noholes','minimal') type option to bwboundaries, then all coordinates could be assumed integers and even the normalisation would be an unnecessary step since bwboundaries never skips a pixel.

on 13 Jul 2012

Sven submitted a Comment to Solution 110965

Well then, I bet that the following would run faster and work on any dimensioned data (such as a [10,2,50] sized matrix representing 50 sets of 10 XY vectors): normr = @(v)bsxfun(@rdivide, v, sqrt(sum(v.^2, 2)));

on 13 Jul 2012

Sven submitted a Comment to Solution 111016

It's alright Richard... when I get home I'll just add normr=@(x)normaliseVector3d(x) to the top of my script and we'll be back in business... we might be near an optimised business but business nonetheless. As long as we don't resort to hacking the test suite via some huge regexp string then I'm still in the game.

on 12 Jul 2012

Sven submitted a Comment to Solution 110965

Hah, "Undefined function or variable 'normr'." A while back I had a version with normalizeVector3d(), part of the geom3d() package I use all the time... I'd be interested to see under the hood of normr... I hope it's vectorized via bsxfun()

on 12 Jul 2012

Sven submitted a Comment to Solution 110421

Hi Anton, here's a hint: You're chopping down P then taking the difference between itself and its circshift. This is very close to just a simple diff() command. Circshift is a useful function, but not quite where you've got it ;) Think of it this way: A diff() will get vectors from one point to the next. If any neighbouring vectors point in the exact same direction, they are fair game to remove. More specifically, whenever the direction of the line *changes*, you've found a vertex you want to keep. How can you detect that?

on 12 Jul 2012

Sven submitted a Comment to Solution 110965

I thought that maybe we could get rid of the extra arguments to sum(,2) and any(,2) by converting to a row matrix, but doing so would add arguments circshift(), so that way may not have any improvements left. I do know that *every single line* of our function generates an M-Lint warning :) Oh, except the function name now.

on 12 Jul 2012

Sven submitted a Comment to Solution 110965

Cheers, obviously I shamelessly adopted your favourite function. I honestly thought we'd converged to an optimum (although a slightly distorted use of that word) back at around 64, then 55, then 48... so I only tentatively think we've reached the end. I'd certainly be relieved to call it a draw :)

on 12 Jul 2012

Sven submitted a Comment to Solution 110870

Ha! I just knew I'd come back from soccer and see you drop the score a bit. Nice one. Best tool in MATLAB? I like bsxfun, but that's already there... maybe it's an anonymous function... we'll see...

on 12 Jul 2012

Sven submitted a Comment to Solution 110339

Richard, this one's a team effort indeed!

on 11 Jul 2012

Sven submitted a Comment to Solution 109911

Yeah, there's one more you'll find that should get you to 51... unless it's already there :)

on 11 Jul 2012

51 – 100 of 263
Go to top of page