A computer readable medium storing computer program instructions for maintaining a multidimensional histogram for a data array having a data array size, the computer program instructions, which when executed on a processor, cause the processor to perform a method comprising:
- collecting a number of substantially-largest-coefficient linear combinations of then-current data, the number being smaller than the data array size, each of the substantially-largest-coefficient linear combinations being a tensor product of Haar wavelets of data in the data array;
- discarding one of the substantially-largest-coefficient linear combinations based on comparing a square of the one of the substantially-largest-coefficient linear combinations with a criterion;
- forming a multidimensional histogram for an intermediate data structure, the forming based on the collecting and the discarding.