We present a computational framework for piecewise constant functions (PCFs) and use this for several types of computations that are useful in statistics, e.g., averages, similarity matrices, and so on. We give a linear-time, allocation-free algorithm for working with pairs of PCFs at machine precision. From this, we derive algorithms for computing reductions of several PCFs. The algorithms have been implemented in a highly scalable fashion for parallel execution on CPU and, in some cases, (multi-)GPU, and are provided in a \proglang{Python} package. In addition, we provide support for multidimensional arrays of PCFs and vectorized operations on these. As a stress test, we have computed a distance matrix from 500,000 PCFs using 8 GPUs.
翻译:我们提出了一种针对分段常数函数(PCF)的计算框架,并将其用于统计学中多种类型的计算(例如平均值、相似矩阵等)。我们给出了一种线性时间、无内存分配的算法,能以机器精度处理成对PCF。基于此,我们推导出了用于计算多个PCF约简的算法。这些算法已高度可扩展地实现,支持在CPU以及某些情况下的(多)GPU上并行执行,并作为\proglang{Python}软件包提供。此外,我们还提供了对PCF多维数组的支持及其向量化操作。作为压力测试,我们使用8个GPU从500,000个PCF计算了一个距离矩阵。