9 std::vector<double> weights;
17 weights[0] =
dt_ / 2.;
18 weights[weights.size() - 1] =
dt_ / 2.;
22 weights[0] =
dt_ / 3.;
23 weights[weights.size() - 1] =
dt_ / 3.;
24 for (
int i = 1; i < weights.size() - 1; i++)
27 weights[i] =
dt_ * 4. / 3.;
29 weights[i] =
dt_ * 2. / 4.;
40 for (
const int step :
steps_)
42 assert(step > 0 && step < weights.size());
43 weights[step] += 1. /
steps_.size();
61 const double tmp =
obj_->value_unweighted_step(i,
x);
62 value += (weights[i] *
obj_->weight()) * tmp;
69 Eigen::MatrixXd terms;
77 terms.col(i) = weights[i] *
obj_->compute_adjoint_rhs_step(i,
x, state);
78 if (
obj_->depends_on_step_prev() && i > 0)
79 terms.col(i - 1) = weights[i] *
obj_->compute_adjoint_rhs_step_prev(i,
x, state);
86 gradv.setZero(
x.size());
94 obj_->compute_partial_gradient_step(i,
x, tmp);
95 gradv += weights[i] * tmp;
108 return obj_->is_step_valid(x0, x1);
113 return obj_->max_step_size(x0, x1);
118 obj_->line_search_begin(x0, x1);
123 obj_->line_search_end();
128 obj_->post_step(data);
140 obj_->solution_changed_step(i, new_x);
145 return obj_->is_step_collision_free(x0, x1);
154 vals(j++) =
obj_->value_unweighted_step(i,
x);
162 Eigen::MatrixXd terms;
168 vals(j) =
obj_->value_unweighted_step(i,
x);
169 terms.col(j++) =
obj_->compute_adjoint_rhs_step(i,
x, state);
178 out.col(i) = terms.col(j) * (g(j) *
weight());
187 Eigen::MatrixXd terms;
188 terms.setZero(
x.size(),
steps_.size());
194 vals(j) =
obj_->value_unweighted_step(i,
x);
195 obj_->compute_partial_gradient_step(i,
x, tmp);
196 terms.col(j++) = tmp;
204 return 1. /
y.array().inverse().sum();
209 return y.array().pow(-2.0) * pow(
eval(
y), 2);
ElementAssemblyValues vals
main class that contains the polyfem solver and all its state