Skip to content

Commit a28d957

Browse files
committed
Improved performance of merge_add and fixed output SEDs with duplicates
1 parent 3893d4c commit a28d957

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/egg-utils.hpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void merge_add(const vec<1,TX1>& x1, const vec<1,TX2>& x2,
3939
}
4040

4141
++i1;
42-
} else {
42+
} else if (x1.safe[i1] > x2.safe[i2]) {
4343
x.push_back(x2.safe[i2]);
4444

4545
if (i1 == 0) {
@@ -50,6 +50,12 @@ void merge_add(const vec<1,TX1>& x1, const vec<1,TX2>& x2,
5050
));
5151
}
5252

53+
++i2;
54+
} else {
55+
x.push_back(x1.safe[i1]);
56+
y.push_back(y1.safe[i1] + y2.safe[i2]);
57+
58+
++i1;
5359
++i2;
5460
}
5561
}

0 commit comments

Comments
 (0)