# An Optimal and Practical Cache-Oblivious Algorithm for Computing Multiresolution Rasters

## Abstract

In many scientific applications it is required to reconstruct a raster dataset many times, each time using a different resolution. This leads to the following problem; let \(\mathcal{G}\) be a raster of \(\sqrt{N}\) x \(\sqrt{N}\) cells. We want to compute for every integer 2 \(\leq \mu \leq \sqrt{N}\) a raster \(\mathcal{G}_\mu\) of [\(\sqrt{N}/\mu\)] x [\(\sqrt{N}/\mu\)] cells where each cell of \(\mathcal{G}_\mu\) stores the average of the values of *μ* x *μ* cells of \(\mathcal{G}\). Here we consider the case where \(\mathcal{G}\) is so large that it does not fit in the main memory of the computer.

We present a novel algorithm that solves this problem in *O*(scan(*N*)) data block transfers from/to the external memory, and in *θ*(*N*) CPU operations; here scan(*N*) is the number of block transfers that are needed to read the entire dataset from the external memory. Unlike previous results on this problem, our algorithm achieves this optimal performance without making any assumptions on the size of the main memory of the computer. Moreover, this algorithm is cache-oblivious; its performance does not depend on the data block size and the main memory size.

We have implemented the new algorithm and we evaluate its performance on datasets of various sizes; we show that it clearly outperforms previous approaches on this problem. In this way, we provide solid evidence that non-trivial cache-oblivious algorithms can be implemented so that they perform efficiently in practice.

## Keywords

Main Memory External Memory Input Size Internal Memory Block Transfer## Preview

Unable to display preview. Download preview PDF.

## References

- 1.Aggarwal, A., Vitter, J.S.: The Input/Output complexity of sorting and related problems. Communications of the ACM 31(9), 1116–1127 (1988)MathSciNetCrossRefGoogle Scholar
- 2.Arge, L., Haverkort, H., Tsirogiannis, C.: Fast Generation of Multiple Resolution Instances of Raster Data Sets. In: Proc. 20th ACM SIGSPATIAL Int. Conference on Advances in Geographic Information Systems (ACM GIS), pp. 52–60 (2012)Google Scholar
- 3.Bøcher, P.K., McCloy, K.R.: The Fundamentals of Average Local Variance - Part I: Detecting Regular Patterns. IEEE Trans. on Image Processing 15, 300–310 (2006)CrossRefGoogle Scholar
- 4.Fisher, P., Wood, J., Cheng, T.: Where is Helvellyn? Fuzziness of Multiscale Landscape Morphometry. Trans. Inst. of British Geographers 29(1), 106–128 (2004)CrossRefGoogle Scholar
- 5.Frigo, M., Leiserson, C.E., Prokop, H., Ramachandran, S.: Cache-Oblivious Algorithms. ACM Transactions on Algorithms 8(1), 1–22 (2012)MathSciNetCrossRefGoogle Scholar
- 6.Karatsuba, A.A., Voronin, S.M.: The Riemann Zeta-Function. Walter de Gruyter, Berlin (1992)zbMATHCrossRefGoogle Scholar
- 7.Rosser, J.B., Schoenfeld, L.: Approximate Formulas for Some Functions of Prime Numbers. Illinois Journal of Mathematics 6(1), 64–94 (1962)MathSciNetzbMATHGoogle Scholar
- 8.TPIE, the Templated Portable I/O Environment, http://www.madalgo.au.dk/tpie/
- 9.Woodcock, C.E., Strahler, A.H.: The Factor of Scale in Remote Sensing. Remote Sensing of Environment 21, 311–332 (1987)CrossRefGoogle Scholar