-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for wrapped coordinates #80
Conversation
@@ -37,11 +37,11 @@ | |||
} | |||
|
|||
// use a custom deleter to destroy all objects and deallocate the memory | |||
auto deleter = [size](Allocator* ptr) { | |||
auto deleter = [size](Allocator* pointer) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 13.1 rule Note
for (size_t i = size; i > 0; --i) { | ||
(ptr + i - 1)->~Allocator(); | ||
(pointer + i - 1)->~Allocator(); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 18.4 rule Note
for (size_t i = size; i > 0; --i) { | ||
(ptr + i - 1)->~Allocator(); | ||
(pointer + i - 1)->~Allocator(); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 10.4 rule Note
|
||
ALPAKA_FN_HOST_ACC inline constexpr float normalizeCoordinate(float coord, int dim) const { | ||
const float range = min_max.range(dim); | ||
float remainder = coord - static_cast<int>(coord / range) * range; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 10.4 rule Note
if (remainder >= min_max.max(dim)) | ||
remainder -= range; | ||
else if (remainder < min_max.min(dim)) | ||
remainder += range; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.7 rule Note
4b4e84f
to
25924f2
Compare
m_view->coords = floatBuffer; | ||
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim; | ||
m_view->weights = floatBuffer + m_info.nPoints * Ndim; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule Note
m_view->coords = floatBuffer; | ||
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim; | ||
m_view->weights = floatBuffer + m_info.nPoints * Ndim; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 18.4 rule Note
f6859f2
to
b87767f
Compare
b87767f
to
4b31626
Compare
4b31626
to
0de78ea
Compare
for (int dim{}; dim != Ndim; ++dim) { | ||
dist_ij_sq += (coords_j[dim] - coords_i[dim]) * (coords_j[dim] - coords_i[dim]); | ||
} | ||
float dist_ij_sq = tiles->distance(coords_i, coords_j); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
int dim) const { | ||
const float range = minmax->range(dim); | ||
float remainder = coord - static_cast<int>(coord / range) * range; | ||
if (remainder >= minmax->max(dim)) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.6 rule Note
float remainder = coord - static_cast<int>(coord / range) * range; | ||
if (remainder >= minmax->max(dim)) | ||
remainder -= range; | ||
else if (remainder < minmax->min(dim)) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.6 rule Note
template <typename TAcc> | ||
ALPAKA_FN_ACC inline constexpr int getBin(const TAcc& acc, | ||
float coord, | ||
int dim) const { | ||
int coord_bin{(int)((coord - minmax->min(dim)) / tilesizes[dim])}; | ||
int coord_bin; | ||
if (wrapping[dim]) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
dim_sb.push_back_unsafe(getBin(acc, sb_extremes[dim][1], dim)); | ||
auto infBin = getBin(acc, sb_extremes[dim][0], dim); | ||
auto supBin = getBin(acc, sb_extremes[dim][1], dim); | ||
if (wrapping[dim] and infBin > supBin) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule Note
dim_sb.push_back_unsafe(getBin(acc, sb_extremes[dim][1], dim)); | ||
auto infBin = getBin(acc, sb_extremes[dim][0], dim); | ||
auto supBin = getBin(acc, sb_extremes[dim][1], dim); | ||
if (wrapping[dim] and infBin > supBin) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.6 rule Note
ALPAKA_FN_ACC inline float distance(const float* coord_i, const float* coord_j) { | ||
float dist_sq = 0.f; | ||
for (int dim = 0; dim != Ndim; ++dim) { | ||
if (wrapping[dim]) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
ALPAKA_FN_ACC inline float distance(const float* coord_i, const float* coord_j) { | ||
float dist_sq = 0.f; | ||
for (int dim = 0; dim != Ndim; ++dim) { | ||
if (wrapping[dim]) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.6 rule Note
bf0daf9
to
3d70271
Compare
m_view->coords = floatBuffer; | ||
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim; | ||
m_view->weights = floatBuffer + m_info.nPoints * Ndim; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 18.4 rule Note
m_view->coords = floatBuffer; | ||
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim; | ||
m_view->weights = floatBuffer + m_info.nPoints * Ndim; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule Note
m_view->clusterIndexes = intBuffer; | ||
m_view->isSeed = intBuffer + m_shape.nPoints; | ||
m_view->isSeed = intBuffer + m_info.nPoints; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 18.4 rule Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update to version 2.5.1
please?
done :) |
No description provided.