Package: opensurgsim / 0.7.0-11

fix-matrix-tests.patch Patch series | download
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
Description: Fixes strict epsilons in MatrixTests
 This tweaks an epsilon values in the unit tests that were too strict and
 caused failures on powerpc.
Author: Paul Novotny <paul@paulnovo.us>
Bug-Debian: https://bugs.debian.org/838272
Last-Update: 2016-10-14

--- a/SurgSim/Math/UnitTests/MatrixTests.cpp
+++ b/SurgSim/Math/UnitTests/MatrixTests.cpp
@@ -467,11 +467,11 @@
 	const int SIZE = Matrix::RowsAtCompileTime;
 
 	Matrix a = Matrix::Constant(6.0f);
-	EXPECT_NEAR(6.0f * SIZE * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(6.0f * SIZE * SIZE, a.sum(), 5e-6);
 	const Matrix b = Matrix::Constant(7.0f);
-	EXPECT_NEAR(7.0f * SIZE * SIZE, b.sum(), 1e-6);
+	EXPECT_NEAR(7.0f * SIZE * SIZE, b.sum(), 5e-6);
 	a = b;
-	EXPECT_NEAR(7.0f * SIZE * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(7.0f * SIZE * SIZE, a.sum(), 5e-6);
 }
 
 // ==================== ACCESS ====================
@@ -495,9 +495,9 @@
 	for (int i = 0;  i < SIZE;  ++i)
 	{
 		Vector rowVector = a.row(i);
-		EXPECT_NEAR((i + 1.f) * SIZE, rowVector.sum(), 1e-6);
+		EXPECT_NEAR((i + 1.f) * SIZE, rowVector.sum(), 5e-6);
 		Vector columnVector = a.col(i);
-		EXPECT_NEAR(SIZE * (SIZE+1) / 2., columnVector.sum(), 1e-6);
+		EXPECT_NEAR(SIZE * (SIZE+1) / 2., columnVector.sum(), 5e-6);
 	}
 
 	for (int i = 0;  i < SIZE;  ++i)
@@ -509,9 +509,9 @@
 	for (int i = 0;  i < SIZE;  ++i)
 	{
 		Vector columnVector = a.col(i);
-		EXPECT_NEAR((i + 1.f) * SIZE, columnVector.sum(), 1e-6);
+		EXPECT_NEAR((i + 1.f) * SIZE, columnVector.sum(), 5e-6);
 		Vector rowVector = a.row(i);
-		EXPECT_NEAR(SIZE * (SIZE+1) / 2., rowVector.sum(), 1e-6);
+		EXPECT_NEAR(SIZE * (SIZE+1) / 2., rowVector.sum(), 5e-6);
 	}
 }
 
@@ -529,11 +529,11 @@
 		Vector diagonalVector = Vector::Constant(2.f);
 		a.diagonal() = diagonalVector;
 	}
-	EXPECT_NEAR(2.f * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(2.f * SIZE, a.sum(), 5e-6);
 
 	Matrix b = Matrix::Identity();
 	{
-		EXPECT_NEAR(1.f * SIZE, b.diagonal().sum(), 1e-6);
+		EXPECT_NEAR(1.f * SIZE, b.diagonal().sum(), 5e-6);
 	}
 }
 
@@ -636,9 +636,9 @@
 	const int SIZE = Matrix::RowsAtCompileTime;
 
 	Matrix a = Matrix::Constant(0.1f);
-	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 5e-6);
 	Matrix b = -a;
-	EXPECT_NEAR(-0.1 * SIZE * SIZE, b.sum(), 1e-6);
+	EXPECT_NEAR(-0.1 * SIZE * SIZE, b.sum(), 5e-6);
 }
 
 /// Addition.
@@ -648,9 +648,9 @@
 	const int SIZE = Matrix::RowsAtCompileTime;
 
 	Matrix a = Matrix::Constant(0.1f);
-	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 5e-6);
 	Matrix b = a + Matrix::Ones() + a;
-	EXPECT_NEAR(1.2 * SIZE * SIZE, b.sum(), 1e-6);
+	EXPECT_NEAR(1.2 * SIZE * SIZE, b.sum(), 5e-6);
 }
 
 /// Subtraction.
@@ -660,9 +660,9 @@
 	const int SIZE = Matrix::RowsAtCompileTime;
 
 	Matrix a = Matrix::Constant(0.1f);
-	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 5e-6);
 	Matrix b = Matrix::Ones() - a;
-	EXPECT_NEAR(0.9 * SIZE * SIZE, b.sum(), 1e-6);
+	EXPECT_NEAR(0.9 * SIZE * SIZE, b.sum(), 5e-6);
 }
 
 /// Incrementing by a value.
@@ -672,9 +672,9 @@
 	const int SIZE = Matrix::RowsAtCompileTime;
 
 	Matrix a = Matrix::Constant(0.1f);
-	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 5e-6);
 	a += Matrix::Ones();
-	EXPECT_NEAR(1.1 * SIZE * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(1.1 * SIZE * SIZE, a.sum(), 5e-6);
 }
 
 /// Decrementing by a value.
@@ -684,9 +684,9 @@
 	const int SIZE = Matrix::RowsAtCompileTime;
 
 	Matrix a = Matrix::Constant(1.1f);
-	EXPECT_NEAR(1.1 * SIZE * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(1.1 * SIZE * SIZE, a.sum(), 5e-6);
 	a -= Matrix::Ones();
-	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 1e-6);
+	EXPECT_NEAR(0.1 * SIZE * SIZE, a.sum(), 5e-6);
 }
 
 /// Matrix-scalar multiplication.
@@ -696,7 +696,7 @@
 
 	Matrix a = Matrix::Random();
 	Matrix b = a * 1.23f;
-	EXPECT_NEAR(1.23 * a.sum(), b.sum(), 1e-6);
+	EXPECT_NEAR(1.23 * a.sum(), b.sum(), 5e-6);
 }
 
 /// Scalar-matrix multiplication.
@@ -706,7 +706,7 @@
 
 	Matrix a = Matrix::Random();
 	Matrix b = 1.23f * a;
-	EXPECT_NEAR(1.23 * a.sum(), b.sum(), 1e-6);
+	EXPECT_NEAR(1.23 * a.sum(), b.sum(), 5e-6);
 }
 
 /// Division by scalar.
@@ -716,7 +716,7 @@
 
 	Matrix a = Matrix::Random();
 	Matrix b = a / 1.23f;
-	EXPECT_NEAR(a.sum() / 1.23, b.sum(), 1e-6);
+	EXPECT_NEAR(a.sum() / 1.23, b.sum(), 5e-6);
 }
 
 /// Matrix-vector multiplication.
@@ -732,7 +732,7 @@
 	Vector v = Vector::Zero();
 	v[0] = 1.f;
 	Vector w = a * v;
-	EXPECT_NEAR(a.col(0).sum(), w.sum(), 1e-6);
+	EXPECT_NEAR(a.col(0).sum(), w.sum(), 5e-6);
 }
 
 /// Matrix-matrix multiplication.
@@ -797,8 +797,8 @@
 	Matrix a = Matrix::Random();
 	Matrix b = Matrix::Identity();
 	Matrix c = a.cwiseProduct(b);
-	EXPECT_NEAR(0, c.sum() - c.diagonal().sum(), 1e-6);
-	EXPECT_NEAR(0, (a - c).diagonal().sum(), 1e-6);
+	EXPECT_NEAR(0, c.sum() - c.diagonal().sum(), 5e-6);
+	EXPECT_NEAR(0, (a - c).diagonal().sum(), 5e-6);
 }
 
 /// Component-wise division.
@@ -809,7 +809,7 @@
 	Matrix a = Matrix::Random();
 	Matrix b = Matrix::Constant(0.5f);
 	Matrix c = a.cwiseQuotient(b);
-	EXPECT_NEAR(a.sum() * 2, c.sum(), 1e-6);
+	EXPECT_NEAR(a.sum() * 2, c.sum(), 5e-6);
 }
 
 /// Frobenius norm and its square.
@@ -893,7 +893,7 @@
 
 	Matrix a = Matrix::Random();
 	T expectedTrace = a.diagonal().sum();
-	EXPECT_NEAR(expectedTrace, a.trace(), 1e-6);
+	EXPECT_NEAR(expectedTrace, a.trace(), 5e-6);
 }
 
 /// Determinant.
@@ -914,7 +914,7 @@
 
 	Matrix22 m = Matrix22::Random();
 	T expectedDeterminant = m(0, 0) * m(1, 1) - m(0, 1) * m(1, 0);
-	EXPECT_NEAR(expectedDeterminant, m.determinant(), 1e-6);
+	EXPECT_NEAR(expectedDeterminant, m.determinant(), 5e-6);
 }
 
 /// Determinant (explicit 3x3 result).
@@ -925,7 +925,7 @@
 
 	Matrix33 m = Matrix33::Random();
 	T expectedDeterminant = m.row(0).cross(m.row(1)).dot(m.row(2));
-	EXPECT_NEAR(expectedDeterminant, m.determinant(), 1e-6);
+	EXPECT_NEAR(expectedDeterminant, m.determinant(), 5e-6);
 }
 
 // ==================== SUBMATRICES (EXTENDING/SHRINKING) ====================
@@ -949,7 +949,7 @@
 	// class; you don't need to do this in a non-template context.
 	matrix3.template block<2, 2>(0, 0) = matrix2;
 
-	EXPECT_NEAR(6.0, matrix3.sum(), 1e-6) << "extending was incorrect: " << matrix3;
+	EXPECT_NEAR(6.0, matrix3.sum(), 5e-6) << "extending was incorrect: " << matrix3;
 }
 
 /// Extending matrices using the block(i,j,r,c) syntax.
@@ -968,7 +968,7 @@
 	Matrix33 matrix3 = Matrix33::Identity();
 	matrix3.block(0, 0, 2, 2) = matrix2;
 
-	EXPECT_NEAR(6.0, matrix3.sum(), 1e-6) << "extending was incorrect: " << matrix3;
+	EXPECT_NEAR(6.0, matrix3.sum(), 5e-6) << "extending was incorrect: " << matrix3;
 }
 
 /// Shrinking matrices using the block<r,c>() syntax.
@@ -991,7 +991,7 @@
 	// class; you don't need to do this in a non-template context.
 	matrix2 = matrix3.template block<2, 2>(0, 0);
 
-	EXPECT_NEAR(5.2, matrix2.sum(), 1e-6) << "shrinking was incorrect: " << matrix2;
+	EXPECT_NEAR(5.2, matrix2.sum(), 5e-6) << "shrinking was incorrect: " << matrix2;
 }
 
 /// Extending matrices using the block<r,c>() syntax.
@@ -1013,7 +1013,7 @@
 	// class; you don't need to do this in a non-template context.
 	matrix3.template block<2, 2>(0, 0) = matrix2;
 
-	EXPECT_NEAR(6.0, matrix3.sum(), 1e-6) << "extending was incorrect: " << matrix3;
+	EXPECT_NEAR(6.0, matrix3.sum(), 5e-6) << "extending was incorrect: " << matrix3;
 }
 
 /// Shrinking matrices using the block<r,c>() syntax.
@@ -1036,7 +1036,7 @@
 	// class; you don't need to do this in a non-template context.
 	matrix2 = matrix3.template block<2, 2>(0, 0);
 
-	EXPECT_NEAR(5.2, matrix2.sum(), 1e-6) << "shrinking was incorrect: " << matrix2;
+	EXPECT_NEAR(5.2, matrix2.sum(), 5e-6) << "shrinking was incorrect: " << matrix2;
 }
 
 /// Extending matrices using the block<r,c>() syntax.
@@ -1059,7 +1059,7 @@
 	// class; you don't need to do this in a non-template context.
 	matrix4.template block<3, 3>(0, 0) = matrix3;
 
-	EXPECT_NEAR(14.5, matrix4.sum(), 1e-6) << "extending was incorrect: " << matrix4;
+	EXPECT_NEAR(14.5, matrix4.sum(), 5e-6) << "extending was incorrect: " << matrix4;
 }
 
 /// Shrinking matrices using the block<r,c>() syntax.
@@ -1083,7 +1083,7 @@
 	// class; you don't need to do this in a non-template context.
 	matrix3 = matrix4.template block<3, 3>(0, 0);
 
-	EXPECT_NEAR(14.4, matrix3.sum(), 1e-6) << "shrinking was incorrect: " << matrix3;
+	EXPECT_NEAR(14.4, matrix3.sum(), 5e-6) << "shrinking was incorrect: " << matrix3;
 }
 
 /// Extending matrices using the block<r,c>() syntax.
@@ -1106,7 +1106,7 @@
 	// class; you don't need to do this in a non-template context.
 	matrix4.template block<3, 3>(0, 0) = matrix3;
 
-	EXPECT_NEAR(14.5, matrix4.sum(), 1e-6) << "extending was incorrect: " << matrix4;
+	EXPECT_NEAR(14.5, matrix4.sum(), 5e-6) << "extending was incorrect: " << matrix4;
 }
 
 /// Shrinking matrices using the block<r,c>() syntax.
@@ -1130,7 +1130,7 @@
 	// class; you don't need to do this in a non-template context.
 	matrix3 = matrix4.template block<3, 3>(0, 0);
 
-	EXPECT_NEAR(14.4, matrix3.sum(), 1e-6) << "shrinking was incorrect: " << matrix3;
+	EXPECT_NEAR(14.4, matrix3.sum(), 5e-6) << "shrinking was incorrect: " << matrix3;
 }
 
 // ==================== TYPE CONVERSION ====================
@@ -1151,9 +1151,9 @@
 	// triggered because the test is a part of a template class; you don't
 	// need to do this in a non-template context.
 	Matrixd d = a.template cast<double>();
-	EXPECT_NEAR(expectedSum, d.sum(), 1e-6);
+	EXPECT_NEAR(expectedSum, d.sum(), 5e-6);
 	Matrixf f = a.template cast<float>();
-	EXPECT_NEAR(expectedSum, f.sum(), 1e-6);
+	EXPECT_NEAR(expectedSum, f.sum(), 5e-6);
 }
 
 // ==================== MISCELLANEOUS ====================