@@ -168,15 +168,16 @@ bool compare_gradient(
168
168
169
169
bool same = true ;
170
170
for (long i = 0 ; i < x.rows (); i++) {
171
- double scale = std::max (std::max (abs (x[i]), abs (y[i])), double (1.0 ));
172
- double abs_diff = abs (x[i] - y[i]);
171
+ double scale =
172
+ std::max (std::max (std::abs (x[i]), std::abs (y[i])), double (1.0 ));
173
+ double abs_diff = std::abs (x[i] - y[i]);
173
174
174
175
if (abs_diff > test_eps * scale) {
175
176
spdlog::debug (
176
177
" {} eps={:.3e} r={} x={:.3e} y={:.3e} |x-y|={:.3e} "
177
178
" |x-y|/|x|={:.3e} |x-y|/|y|={:3e}" ,
178
179
msg, test_eps, i, x (i), y (i), abs_diff, abs_diff / abs (x (i)),
179
- abs_diff / abs (y (i)));
180
+ abs_diff / std:: abs (y (i)));
180
181
same = false ;
181
182
}
182
183
}
@@ -196,17 +197,17 @@ bool compare_jacobian(
196
197
bool same = true ;
197
198
for (long i = 0 ; i < x.rows (); i++) {
198
199
for (long j = 0 ; j < x.cols (); j++) {
199
- double scale =
200
- std::max (std::max ( abs (x (i, j)), abs (y (i, j))), double (1.0 ));
200
+ double scale = std::max (
201
+ std::max (std::abs (x (i, j)), std:: abs (y (i, j))), double (1.0 ));
201
202
202
- double abs_diff = abs (x (i, j) - y (i, j));
203
+ double abs_diff = std:: abs (x (i, j) - y (i, j));
203
204
204
205
if (abs_diff > test_eps * scale) {
205
206
spdlog::debug (
206
207
" {} eps={:.3e} r={} c={} x={:.3e} y={:.3e} "
207
208
" |x-y|={:.3e} |x-y|/|x|={:.3e} |x-y|/|y|={:3e}" ,
208
209
msg, test_eps, i, j, x (i, j), y (i, j), abs_diff,
209
- abs_diff / abs (x (i, j)), abs_diff / abs (y (i, j)));
210
+ abs_diff / std:: abs (x (i, j)), abs_diff / std:: abs (y (i, j)));
210
211
same = false ;
211
212
}
212
213
}
0 commit comments