New top story on Hacker News: Show HN: Rectfillcurve – generate rectangle-filling curves

Show HN: Rectfillcurve – generate rectangle-filling curves
7 by dalke | 1 comments on Hacker News.
How do you visit every coordinate in an NxM grid once? The easiest is to process line-by-line, from the first to last column, but if you want better caching you might try alternating the column direction for each row. The Morton/Z-order and Hilbert order give even better cache coherency for some tasks, although the classic versions only work on squares with power-of-two length sides. Luckily for me, people have developed generalized versions of those algorithms which can handle arbitrary-sized rectangles. I've taken those and packaged all of the those curves into "rectfillcurve", with an iterator API for generating those curves, and a bonus "mlcg curve" with a pseudo-random visit order that should have poor cache behavior. Implemented in stand-alone C, and also available as a Python module.

How do you visit every coordinate in an NxM grid once? The easiest is to process line-by-line, from the first to last column, but if you want better caching you might try alternating the column direction for each row. The Morton/Z-order and Hilbert order give even better cache coherency for some tasks, although the classic versions only work on squares with power-of-two length sides. Luckily for me, people have developed generalized versions of those algorithms which can handle arbitrary-sized rectangles. I've taken those and packaged all of the those curves into "rectfillcurve", with an iterator API for generating those curves, and a bonus "mlcg curve" with a pseudo-random visit order that should have poor cache behavior. Implemented in stand-alone C, and also available as a Python module. 1 https://ift.tt/2aRBOd0 7 Show HN: Rectfillcurve – generate rectangle-filling curves

Comments

diet weight loss

diet weight loss

diet weight loss

Legal Notice: Product prices and availability are subject to change. Visit corresponding website for more details. Trade marks & images are copyrighted by their respective owners.

helth

health

health

Legal Notice: Product prices and availability are subject to change. Visit corresponding website for more details. Trade marks & images are copyrighted by their respective owners.