help-octave
[Top][All Lists]
Advanced

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

histc() - FWD: fast hist() / histogram() implementation in C++


From: Petr Mikulik
Subject: histc() - FWD: fast hist() / histogram() implementation in C++
Date: Mon, 6 Oct 2008 11:37:43 +0200 (CEST)

> Recently, I needed to group data into a histogram and noticed that
> Octave doesn't have the histc() function. Even though, according to
> the list archives, there has been some discussion about histc() on
> this list in May 2006

I have contributed C++ implementation of histc() + hist() in 2004, see
  http://osdir.com/ml/gnu.octave.general/2004-11/

According to benchmarking requested by people from the mailing list, 50x 
speedup has been achieved for linearly spaced bins, and 27x for 
logarithmically (or whichever non-linearly) spaced bins, compared to the 
Octave m-implementation at that time. Recently the algorithm for hist() in 
Octave has been improved, but I think the C++ implementation is still at 
least 2x faster.

You can still get the source code from here:
        http://www.physics.muni.cz/~mikulik/tmp/histc-Nov19.zip

It supports histogram of a vector and 2D matrix.

However, I don't know how to access dimensions for N-dim matrices and how to 
deal with vectors given by ranges. I haven't got help for these issues so I 
haven't continued further with the patch.

I would be glad if someone takes over the patch and finishes its 
implementation and testing. The gain in speed (a must for image analysis) 
may still be a reason to replace the m-implementation.

Note: I'm using my own similar "histogram()" function in order to fastly 
calculate histograms of images of sizes like >=1024^2 and therefore I had
no need to finish histc() myself.

Petr Mikulik


reply via email to

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