Skip to content

Commit

Permalink
fixed the use of integer types in pow()
Browse files Browse the repository at this point in the history
  • Loading branch information
yannabraham committed Nov 11, 2019
1 parent 068a779 commit 2c408d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: hilbertSimilarity
Type: Package
Title: Hilbert Similarity Index for High Dimensional Data
Version: 0.4.2.9000
Date: 2019-10-29
Version: 0.4.3
Date: 2019-11-11
Authors@R: c(person('Yann','Abraham',email='[email protected]',role=c('aut','cre')),
person('Marilisa','Neri',email='[email protected]',role='aut'),
person('John','Skilling',role='ctb'))
Expand Down
3 changes: 1 addition & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

## reviewers comments

* I fixed the problem with changing user parameters, using on.exit() as suggested
* I added missing \value to the documentation of add.cut, do.cut, hilbert.order and show.cut
* I fixed the comment on using math.pow with integer arguments

## Reverse dependencies

Expand Down
12 changes: 8 additions & 4 deletions src/mapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ NumericVector hilbertMapping(NumericMatrix x, int bits) {
X[i] = x(k,i);
}
AxestoTranspose (X, bits, ndim); // Hilbert transpose for bits and Ndim dimensions
for (int j=bits-1, power=(bits*ndim)-1; j>=0; j--) {
for (int i=0; i<ndim; i++, power--) {
out(k) += (X[i]>>j & 1) * pow (2, power);
}
{
int j;
float power;
for ( j=bits-1, power=(bits*ndim)-1; j>=0; j--) {
for (int i=0; i<ndim; i++, power--) {
out(k) += (X[i]>>j & 1) * pow (2.0, power);
}
}
}
}
return out;
Expand Down

0 comments on commit 2c408d3

Please sign in to comment.