寻找一个快速/高效直方图算法(pre指定的垃圾桶)直方图、高效、垃圾桶、算法

2023-09-11 03:00:42 作者:望断江南岸

我不这样做的matlab多编码之外,但我有一个需要出口我的Matlab的code到另一种语言,最有可能的C.我的Matlab的code具有直方图功能,histc()该放置我的输入数据(这是双precision,不整数)转换成箱的一指定的数组,以形成一个直方图。

I don't do much coding outside of Matlab, but I have a need to export my Matlab code to another language, most likely C. My Matlab code includes a histogram function, histc(), that places my input data (which is double-precision, not integer) into a specified array of bins, to form a histogram.

我敢肯定,我可以拼凑了几个嵌套的循环在一起,以产生一个直方图功能,但我需要这个功能是快速和内存光,因为它会被反复和经常访问的。

I'm sure I can piece together a couple nested loops to generate a histogram function, but I need this function to be fast and memory-light, as it will be accessed repeatedly and often.

要避免重新发明轮子,任何人都知道,如果C语言中有任何现有的直方图功能(S)可以使用,或者人们是否需要这样的事情通常创建它自己呢?

To avoid re-inventing the wheel, anyone know if C language has any existing histogram function(s) available for use, or whether people needing such a thing generally create it themselves?

任何人都知道一个高效的算法,用于创建直方图?伪code是好的。

Anyone know an efficient algorithm for creating a histogram? Pseudo-code is fine.

在此先感谢。

推荐答案

GSL(GNU科学库)包含一个直方图实现。

GSL (GNU Scientific Library) contains a histogram implementation.

下面的文档:http://www.gnu.org/software/gsl/manual/html_node/Histograms.html.

下面是一个例子使用:http://www.gnu.org/software/gsl/manual/html_node/Example-programs-for-histograms.html.

And here is an example use: http://www.gnu.org/software/gsl/manual/html_node/Example-programs-for-histograms.html.