-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath_74.diff
31 lines (31 loc) · 2.24 KB
/
math_74.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java b/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
index 6f3e88358..a0e651e48 100644
--- a/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
+++ b/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
@@ -246,8 +246,26 @@ public abstract class EmbeddedRungeKuttaIntegrator
if (vecAbsoluteTolerance == null) {
scale = new double[y0.length];
java.util.Arrays.fill(scale, scalAbsoluteTolerance);
+
+ if (Boolean.parseBoolean(System.getProperty("defects4j.instrumentation.enabled"))) { // defects4j.instrumentation
+ for (int i=0; i<scale.length; i++) { // defects4j.instrumentation
+ double yi = Math.max(Math.abs(y0[i]), Math.abs(y0[i])); // defects4j.instrumentation
+ if (scale[i] != scalAbsoluteTolerance + scalRelativeTolerance * yi) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
} else {
scale = vecAbsoluteTolerance;
+
+ if (Boolean.parseBoolean(System.getProperty("defects4j.instrumentation.enabled"))) { // defects4j.instrumentation
+ for (int i=0; i<scale.length; i++) { // defects4j.instrumentation
+ double yi = Math.max(Math.abs(y0[i]), Math.abs(y0[i])); // defects4j.instrumentation
+ if (scale[i] != vecAbsoluteTolerance[i] + vecAbsoluteTolerance[i] * yi) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
}
hNew = initializeStep(equations, forward, getOrder(), scale,
stepStart, y, yDotK[0], yTmp, yDotK[1]);