Skip to content
Snippets Groups Projects
Commit 3d670fe2 authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

KLMixture: Use ctor with num of elements

parent 907fd5cf
No related branches found
No related tags found
No related merge requests found
...@@ -196,14 +196,12 @@ findMerges(Component1D* componentsIn, ...@@ -196,14 +196,12 @@ findMerges(Component1D* componentsIn,
const int32_t n = inputSize; const int32_t n = inputSize;
const int32_t nn = n * (n - 1) / 2; const int32_t nn = n * (n - 1) / 2;
// Create a trianular mapping for the pairwise distances // Create a trianular mapping for the pairwise distances
std::vector<triangularToIJ> convert; // We now that the size is nn
convert.reserve(nn); std::vector<triangularToIJ> convert(nn);
for (int32_t i = 1; i < n; ++i) { for (int32_t i = 1; i < n; ++i) {
const int indexConst = (i - 1) * i / 2; const int indexConst = (i - 1) * i / 2;
for (int32_t j = 0; j < i; ++j) { for (int32_t j = 0; j < i; ++j) {
int32_t index = indexConst + j; convert[indexConst + j] = { i, j };
convert[index] = { i, j };
} }
} }
// We need to work with multiple of 8, in principle this is a requirement // We need to work with multiple of 8, in principle this is a requirement
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment