octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #47707] hist takes up a lot of memory


From: Carnë Draug
Subject: [Octave-bug-tracker] [bug #47707] hist takes up a lot of memory
Date: Sat, 16 Apr 2016 14:07:16 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.7.1

Follow-up Comment #2, bug #47707 (project octave):

> The script doesn't say what issues it is trying to avoid. Do you know what
they are? I'd have thought that working with integers would be the way to go.

hg blame points to e8d953d03f6a .  This precedes meaningful commit messages,
but adds the following note on the ChangeLog file.

* plot/hist.m: Avoid saturation when the x values are in an inetger type.

There are no tests in hist for integer input so I will write them and see if
this conversion to double is really necessary or if it can be avoided in some
cases.

> Alternatively, do you need a histogram of your whole 4-D image, or is a
histogram over one or two dimensions? A compromise may be to convert only one
row/column/page/... at a time to double. 

No, I want a single histogram for the whole image (this is to compute global
threshold value).  I have worked around it by using histc like so:


  ## We use histc() instead of hist() to save memory (see bug #47707), but
  ## then we need to adjust the weird output of histc.
  h = histc (im(:), [linspace(min (im(:)), max(im(:)), nbins+1)(1:end-1)
Inf])(1:end-1);


> However, I thought that "hist" was being phased out by Matlab in favour of
"histogram". (I haven't checked the differences.) Perhaps we should just write
an efficient implementation of that and leave hist.

Doesn't mean that the function hist will be removed. I think it's been around
for far too long and widely used to just be dropped like that.  If I can also
make it better, good.

---

Another issue that I didn't mention at the start is that somewhere in the
code, this actually crashed Octave.  Sometimes it would error about not having
enough memory (fair enough), but roughly half of the times the kernel would
just kill the process due to out-of-memory.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47707>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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