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

compute energy only if valid #62

Merged
merged 5 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/polysolve/linear/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,15 @@ namespace polysolve::linear
#ifdef POLYSOLVE_WITH_PARDISO
return "Pardiso";
#else
#ifdef POLYSOLVE_WITH_ACCELERATE
return "Eigen::AccelerateLDLT";
#else
#ifdef POLYSOLVE_WITH_HYPRE
return "Hypre";
#else
return "Eigen::BiCGSTAB";
#endif
#endif
#endif
}

Expand Down
6 changes: 1 addition & 5 deletions src/polysolve/nonlinear/line_search/LineSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,7 @@ namespace polysolve::nonlinear::line_search
// Find step that does not result in nan or infinite energy
while (step_size > current_min_step_size() && cur_iter < current_max_step_size_iter())
{
// Compute the new energy value without contacts
const double energy = objFunc(new_x);
const bool is_step_valid = objFunc.is_step_valid(x, new_x);

if (!std::isfinite(energy) || !is_step_valid)
if (!objFunc.is_step_valid(x, new_x) || !std::isfinite(objFunc(new_x)))
{
step_size *= rate;
new_x = x + step_size * delta_x;
Expand Down
Loading