mirror of
https://github.com/rmontanana/mdlp.git
synced 2025-08-16 07:55:58 +00:00
Fix a sign mistake in valueCutPoint
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -10,7 +10,7 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceRoot}/sample/build/sample",
|
"program": "${workspaceRoot}/sample/build/sample",
|
||||||
"args": [
|
"args": [
|
||||||
"test"
|
"mfeat-factors"
|
||||||
],
|
],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceRoot}/sample/build/",
|
"cwd": "${workspaceRoot}/sample/build/",
|
||||||
|
@@ -32,10 +32,12 @@ namespace mdlp {
|
|||||||
|
|
||||||
pair<precision_t, size_t> CPPFImdlp::valueCutPoint(size_t start, size_t cut, size_t end)
|
pair<precision_t, size_t> CPPFImdlp::valueCutPoint(size_t start, size_t cut, size_t end)
|
||||||
{
|
{
|
||||||
size_t n, m, idxPrev = cut - 1 <= start ? cut - 1 : cut;
|
size_t n, m, idxPrev = cut - 1 >= start ? cut - 1 : cut;
|
||||||
size_t idxNext = cut + 1 < end ? cut + 1 : cut;
|
size_t idxNext = cut + 1 < end ? cut + 1 : cut;
|
||||||
bool backWall; // true if duplicates reach begining of the interval
|
bool backWall; // true if duplicates reach begining of the interval
|
||||||
precision_t previous, actual, next;
|
precision_t previous, actual, next;
|
||||||
|
if (cut - 1 < start || cut + 1 >= end)
|
||||||
|
throw logic_error("Invalid cutpoint index");
|
||||||
previous = X[indices[idxPrev]];
|
previous = X[indices[idxPrev]];
|
||||||
actual = X[indices[cut]];
|
actual = X[indices[cut]];
|
||||||
next = X[indices[idxNext]];
|
next = X[indices[idxNext]];
|
||||||
|
Reference in New Issue
Block a user