29 const std::vector<M>& normals,
32 const auto n = state.
gradient.size();
35 correction.size() < 1 || !correction.allFinite() ||
38 throw std::invalid_argument(
39 "Matching finite arc-tail derivatives, links and constraint blocks "
41 const auto d = state.
gradient.front().size(), k = correction.size();
43 V gradient(n * d), cross(n * d);
44 for (std::size_t j = 0; j < n; ++j) {
47 normals[j].rows() != d || normals[j].cols() != k ||
50 !normals[j].allFinite())
51 throw std::invalid_argument(
52 "Arc-tail Newton metric or derivative dimensions differ");
53 normal.middleRows(j * d, d) = normals[j];
54 gradient.segment(j * d, d) = state.
gradient[j];
57 if ((normal.transpose() * normal - M::Identity(k, k)).norm() > 1e-10)
58 throw std::invalid_argument(
59 "Arc-tail constraint normals must be jointly orthonormal");
60 const V particular = normal * correction;
64 sources.col(1) = cross;
67 const V first = solved.values.col(0), response = solved.values.col(1);
68 const double contraction = cross.dot(response);
70 const double tolerance =
71 128 * std::numeric_limits<double>::epsilon() *
73 if (!std::isfinite(schur) || std::abs(schur) <= tolerance)
74 throw std::runtime_error(
75 "Arc-tail duration equation has an unresolved Schur complement");
83 solved.multipliers.col(0) -
88 const double temporal =
92 std::hypot(spatial.norm(), temporal) /
98 throw std::runtime_error(
99 "Arc-tail Newton step fails its joint coordinate and energy "
101 for (std::size_t j = 0; j < n; ++j)