Skip to content

Commit 9c49bcd

Browse files
committed
Use 1. as initial mass matrix if grad is zero
1 parent 129b94c commit 9c49bcd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/adapt_strategy.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ impl<F: CpuLogpFunc> AdaptStrategy for ExpWindowDiagAdapt<F> {
352352
state
353353
.grad
354354
.iter()
355-
.map(|&grad| Some((grad).abs().recip().clamp(LOWER_LIMIT, UPPER_LIMIT))),
355+
.map(|&grad| grad.abs().recip().clamp(LOWER_LIMIT, UPPER_LIMIT))
356+
.map(|var| if var.is_finite() { Some(var) } else { Some(1.) })
356357
);
357358
}
358359

0 commit comments

Comments
 (0)