diff --git a/.github/workflows/gitlab.yml b/.github/workflows/gitlab.yml index ce5703c..56b0eef 100644 --- a/.github/workflows/gitlab.yml +++ b/.github/workflows/gitlab.yml @@ -28,4 +28,8 @@ jobs: access_token: ${{ secrets.DEPLOY_ACCESS_TOKEN }} id: '3102' ref: 'main' - variables: '{"PROJECT":"bico"}' + variables: | + { + "PROJECT": "bico", + "GIT_HASH": "${{ github.event.pull_request.head.sha || github.sha }}" + } diff --git a/bico/_core.cpp b/bico/_core.cpp index 0e08e4f..b119d33 100644 --- a/bico/_core.cpp +++ b/bico/_core.cpp @@ -35,7 +35,7 @@ class BicoExternal virtual ~BicoExternal(); void addData(double const *array, uint n); void addPoint(double const *array); - int compute(int *sample_weights, + size_t compute(double *sample_weights, double *points); private: @@ -66,7 +66,7 @@ void BicoExternal::addPoint(double const *array) *_bico << p; } -int BicoExternal::compute(int *sample_weights, +size_t BicoExternal::compute(double *sample_weights, double *points) { // Retrieve coreset @@ -82,7 +82,7 @@ int BicoExternal::compute(int *sample_weights, points[i * _d + j] = sol->proxysets[0][i][j]; } } - int m = sol->proxysets[0].size(); + size_t m = sol->proxysets[0].size(); delete sol; return m; @@ -123,7 +123,7 @@ extern "C" #if defined(_WIN32) || defined(__CYGWIN__) __declspec(dllexport) #endif - int compute(BicoExternal *bico, int *sample_weights, + size_t compute(BicoExternal *bico, double *sample_weights, double *points) { return bico->compute(sample_weights, points); } #if defined(_WIN32) || defined(__CYGWIN__) diff --git a/bico/base/proxyprovider.h b/bico/base/proxyprovider.h index 5e8411d..32d5151 100644 --- a/bico/base/proxyprovider.h +++ b/bico/base/proxyprovider.h @@ -24,7 +24,7 @@ template class ProxyProvider { * number of computed clusters, proxies (e.g. cluster centers) or the size of a coreset. * The sizes can be retrieved by a call to size_of_solution(). */ - virtual unsigned int number_of_solutions() const = 0; + virtual size_t number_of_solutions() const = 0; /** * @brief returns the size of a particular solution @@ -32,7 +32,7 @@ template class ProxyProvider { * @param index number between 0 and @ref number_of_solutions()-1 * @return the size for the requested clustering */ - virtual unsigned int size_of_solution(unsigned int index) const = 0; + virtual size_t size_of_solution(unsigned int index) const = 0; /** * @brief returns the proxy for the specified clustering and cluster diff --git a/bico/base/weightmodifier.h b/bico/base/weightmodifier.h index 721d105..b9f6610 100644 --- a/bico/base/weightmodifier.h +++ b/bico/base/weightmodifier.h @@ -28,4 +28,4 @@ template class WeightModifier } -#endif +#endif diff --git a/bico/clustering/bico.h b/bico/clustering/bico.h index 362d620..e56158c 100644 --- a/bico/clustering/bico.h +++ b/bico/clustering/bico.h @@ -143,7 +143,7 @@ template class Bico : public StreamingAlgorithm int bucket_min = bucket_number; int mins; - if ((bucket_number < 0) || (bucket_number > outer.buckets[0].size() - 1)) + if ((bucket_number < 0) || (bucket_number > static_cast(outer.buckets[0].size()) - 1)) { // The bucket does not exist (yet) mins = 0; @@ -151,26 +151,26 @@ template class Bico : public StreamingAlgorithm else { // Search for the projection with smallest bucket size - mins = outer.buckets[mini][bucket_min].size(); - for (int i = 1; i < outer.L; i++) + mins = static_cast(outer.buckets[mini][bucket_min].size()); + for (size_t i = 1; i < outer.L; i++) { - val = outer.project(element, i); - bucket_number = outer.calcBucketNumber(i, val); - if ((bucket_number >= 0) & (bucket_number <= outer.buckets[i].size() - 1)) + val = outer.project(element, static_cast(i)); + bucket_number = outer.calcBucketNumber(static_cast(i), val); + if ((bucket_number >= 0) & (bucket_number <= static_cast(outer.buckets[i].size()) - 1)) { - int s = outer.buckets[i][bucket_number].size(); + int s = static_cast(outer.buckets[i][bucket_number].size()); if (s < mins) { mins = s; bucket_min = bucket_number; - mini = i; + mini = static_cast(i); } } else { mins = 0; bucket_min = bucket_number; - mini = i; + mini = static_cast(i); break; } } @@ -185,7 +185,7 @@ template class Bico : public StreamingAlgorithm // Bucket does not exist => create one outer.allocateBucket(rnd, true); } - else if (bucket_number > outer.buckets[rnd].size() - 1) + else if (bucket_number > static_cast(outer.buckets[rnd].size()) - 1) { // Bucket does not exist => create one outer.allocateBucket(rnd, false); @@ -524,22 +524,22 @@ template