diff --git a/src/rapids_singlecell/preprocessing/_kernels/_bbknn.py b/src/rapids_singlecell/preprocessing/_kernels/_bbknn.py index 408547e2..28fd2e29 100644 --- a/src/rapids_singlecell/preprocessing/_kernels/_bbknn.py +++ b/src/rapids_singlecell/preprocessing/_kernels/_bbknn.py @@ -44,7 +44,7 @@ top_k[min_index] = data[idx]; // Find the new smallest value in top_k and set min_index - for (int i = 1; i < trim; ++i) { + for (int i = 0; i < trim; ++i) { if (top_k[i] < top_k[min_index]) { min_index = i; } @@ -52,13 +52,7 @@ } // After processing, find the smallest value in top_k, which is the kth largest - float kth_largest = top_k[0]; - for (int i = 1; i < trim; ++i) { - if (top_k[i] < kth_largest) { - kth_largest = top_k[i]; - } - } - + float kth_largest = top_k[min_index]; vals[row] = kth_largest; } """