Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Efficient selection mechanism? (Thank you all)

by choroba (Cardinal)
on Jan 15, 2014 at 12:18 UTC ( [id://1070674]=note: print w/replies, xml ) Need Help??


in reply to Re: Efficient selection mechanism? (Thank you all)
in thread Efficient selection mechanism?

I learnt the craft of vec from you here on PerlMonks.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re^2: Efficient selection mechanism? (Thank you all)

Replies are listed 'Best First'.
Re^3: Efficient selection mechanism? (Thank you all)
by BrowserUk (Patriarch) on Jan 15, 2014 at 12:47 UTC

    Sometimes, you just need to see your problem through someone else's eyes.

    I'd been faffing around with multi-level hashes so that given the first quad's numbers I could use them to index down four levels to just that subset that didn't contain those four numbers. Which ought to work, but proved to be clumsy and produced a huge, unwieldy data structure.

    But the real problem is that once I've found the second non-overlapping quad I then want to find a third that doesn't overlap either of the first two; then a fourth that doesn't overlap any of the first three. And that requires two more, deeper, multi-level data structures be built.

    With the vec solution I just OR the masks and grep the previous subset again to produce the next.

    Simple once you've seen it, but I was so locked in on my multi-level hash approach that using bitmasks didn't cross my mind.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1070674]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-25 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found