Skip to content

Commit 9325d21

Browse files
committed
handle non finite
1 parent 50d963c commit 9325d21

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/problem.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,19 @@ impl Problem {
332332
let variable_jac = jac.view((0, variable_local_idx), (jac.shape().0, var_size));
333333
for row_idx in 0..jac.shape().0 {
334334
for col_idx in 0..var_size {
335-
local_jacobian_list.push(variable_jac[(row_idx, col_idx)]);
335+
let j_value = variable_jac[(row_idx, col_idx)];
336+
if j_value.is_finite() {
337+
local_jacobian_list.push(j_value);
338+
} else {
339+
log::warn!(
340+
"Non-finite Jacobian value detected at residual block {}, variable {}, row {}, col {}. Setting to 0.0",
341+
residual_block.residual_block_id,
342+
var_key,
343+
row_idx,
344+
col_idx
345+
);
346+
local_jacobian_list.push(0.0);
347+
}
336348
}
337349
}
338350
} else {

0 commit comments

Comments
 (0)