Skip to content
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

Using unsigned fixed width integer types for data point arrays causes compile-time error #25

Open
georgeslabreche opened this issue May 2, 2021 · 0 comments

Comments

@georgeslabreche
Copy link

Description

Using fixed width unsigned integer types like uint8_t, uint16_t, or uint32_t causes a compile-time error.

Example

For instance, using uint8_t as the array data type:

array<uint8_t, 625> points;

And then invoking:

auto cluster_data = dkm::kmeans_lloyd(data, K);

Will throw the following compile-time error:

dkm/include/dkm.hpp: In instantiation of ‘std::tuple<std::vector<std::array<_Tp, _Nm>, std::allocator<std::array<_Tp, _Nm> > >, std::vector<unsigned int, std::allocator<unsigned int> > > dkm::kmeans_lloyd(const std::vector<std::array<_Tp, _Nm> >&, const dkm::clustering_parameters<T>&) [with T = unsigned char; long unsigned int N = 625]’:
dkm/include/dkm.hpp:315:21:   required from ‘std::tuple<std::vector<std::array<_Tp, _Nm>, std::allocator<std::array<_Tp, _Nm> > >, std::vector<unsigned int, std::allocator<unsigned int> > > dkm::kmeans_lloyd(const std::vector<std::array<_Tp, _Nm> >&, uint32_t, uint64_t, T) [with T = unsigned char; long unsigned int N = 625; uint32_t = unsigned int; uint64_t = long unsigned int]’
src/main.cpp:148:76:   required from here
dkm/include/dkm.hpp:273:2: error: static assertion failed: kmeans_lloyd requires the template parameter T to be a signed arithmetic type (e.g. float, double, int)
  static_assert(std::is_arithmetic<T>::value && std::is_signed<T>::value,
  ^~~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant