Skip to content

Commit c6fcf3d

Browse files
authored
Merge pull request #60 from yangzq50/fix-create-pgm-index-for-only-one-element
Support special case of creating PGM index for only one input element
2 parents f578e68 + 5d25a6b commit c6fcf3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/pgm/piecewise_linear_model.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ size_t make_segmentation(size_t n, size_t start, size_t end, size_t epsilon, Fin
303303
add_point(in(i), i);
304304
}
305305
}
306-
if (in(end - 1) != in(end - 2))
306+
if (end >= start + 2 && in(end - 1) != in(end - 2))
307307
add_point(in(end - 1), end - 1);
308308

309309
if (end == n) {

0 commit comments

Comments
 (0)