[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fast hist() / histogram() implementation in C++

From: Petr Mikulik
Subject: fast hist() / histogram() implementation in C++
Date: Thu, 27 May 2004 11:07:53 -0500

It seems that the M-language does not provide an efficient way to implement
histogram function. It is order(s) of magnitude worse than  ndat*log2(nbins)
efficiency of a loop-friendly language, like C/C++. As an example, try the
following histograming code for a 2048x2048 image:
        tic; [y,x]=hist(a(:),nbins); toc

I'm using my own function called "histogram" with this syntax:
  [ [x, ] h ] = histogram ( image [, bins [, zfrom, zto] [, do_log ]] )

I've put its M and well as C++ (=>.oct) code to

It would be great if someone uses its code (...or his own code) for a C++
(thus => .oct routine) implementation of
        histc(data, edges)
function for calculating histogram based on given vector of bin edges. Then,
hist() function should call this histc.oct instead of its current inefficient
M-language implementation.

Looking forward to

Petr Mikulik

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]