Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.1.41 #39

Merged
merged 14 commits into from
Dec 20, 2024
Prev Previous commit
Next Next commit
fmt.
  • Loading branch information
mattatz committed Dec 20, 2024
commit afa8e5adf5d1cabf8543e015d47512f71cc0c7f4
13 changes: 3 additions & 10 deletions src/intersects/curve_curve/curve_intersection_bfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,23 +161,16 @@ where
}

if let Some(g) = state.get_gradient() {
if g.x.is_nan() || g.y.is_nan() || g.x.is_infinite() || g.y.is_infinite() {
if g.iter().any(|v| v.is_nan() || v.is_infinite()) {
return TerminationStatus::Terminated(TerminationReason::SolverExit(
"gradient is NaN or infinite".into(),
));
}
}

if let Some(h) = state.get_hessian() {
if h[(0, 0)].is_nan()
|| h[(0, 1)].is_nan()
|| h[(1, 0)].is_nan()
|| h[(1, 1)].is_nan()
|| h[(0, 0)].is_infinite()
|| h[(0, 1)].is_infinite()
|| h[(1, 0)].is_infinite()
|| h[(1, 1)].is_infinite()
{
let has_nan = h.iter().any(|&v| v.is_nan() || v.is_infinite());
if has_nan {
return TerminationStatus::Terminated(TerminationReason::SolverExit(
"hessian is NaN or infinite".into(),
));
Expand Down
13 changes: 3 additions & 10 deletions src/intersects/surface_curve/surface_curve_intersection_bfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,16 @@ where
}

if let Some(g) = state.get_gradient() {
if g.x.is_nan() || g.y.is_nan() || g.x.is_infinite() || g.y.is_infinite() {
if g.iter().any(|v| v.is_nan() || v.is_infinite()) {
return TerminationStatus::Terminated(TerminationReason::SolverExit(
"gradient is NaN or infinite".into(),
));
}
}

if let Some(h) = state.get_hessian() {
if h[(0, 0)].is_nan()
|| h[(0, 1)].is_nan()
|| h[(1, 0)].is_nan()
|| h[(1, 1)].is_nan()
|| h[(0, 0)].is_infinite()
|| h[(0, 1)].is_infinite()
|| h[(1, 0)].is_infinite()
|| h[(1, 1)].is_infinite()
{
let has_nan = h.iter().any(|&v| v.is_nan() || v.is_infinite());
if has_nan {
return TerminationStatus::Terminated(TerminationReason::SolverExit(
"hessian is NaN or infinite".into(),
));
Expand Down