astrofrog / astrofrog/fast-histogram

choice of returned histogram datatype

Open
#5 9 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
C
Stars
281
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Thanks for writing this fast histogram package. A task that we astronomers tend to do often and repeatedly :)

Coming back to the package itself, it seems to me that the return datatype of the histograms are `doubles`. Conceptually, the histogram is simply a count in that bin, and should be of an integral type. Is the return datatype chosen to be `double` to reflect the input array type? Or is that in keeping with the `numpy` convention?

Changing the histogram increment to be an integral type (i.e., the postfix `++` operator) might also lead to better performance. (There are some opportunity for performance improvements -- e.g., pointer operations, reduction of scope for variables, unrolled loops + separate counters)

Separately, any particular reason to perform a *bitwise and* (`&`) rather than the *logical and* (`&&`) [here](https://github.com/astrofrog/fast-histogram/blob/master/fast_histogram/_histogram_core.c#L109)?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting fast_histogram/_histogram_core.c, especially the linked code around line 109, and trace how histogram results are typed and returned. Review the discussion about integral counts, NumPy conventions, bitwise versus logical and, and possible performance changes; done requires a decided return-type and behavior specification, with agreement on the scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, numpy, python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.