Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
fully_differentiable_skeleton_error_function.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
9
11
12namespace momentum {
13
14template <typename T>
16 const std::string& name) const {
17 Eigen::VectorX<T> result = Eigen::VectorX<T>::Zero(getInputSize(name));
18 getInput(name, result);
19 return result;
20}
21
22template <typename T>
24 const std::string& name,
25 Eigen::Ref<Eigen::VectorX<T>> value) const {
26 const auto expectedSize = getInputSize(name);
28 value.size() != expectedSize,
29 "In {}::getInput({}): expected size {} but got {}",
30 this->name(),
31 name,
32 expectedSize,
33 value.size());
34
35 getInputImp(name, value);
36}
37
38template <typename T>
40 const std::string& name,
41 Eigen::Ref<const Eigen::VectorX<T>> value) {
42 const auto expectedSize = getInputSize(name);
44 value.size() != expectedSize,
45 "In {}::setInput({}): expected size {} but got {}",
46 this->name(),
47 name,
48 expectedSize,
49 value.size());
50
51 setInputImp(name, value);
52}
53
56
57} // namespace momentum
virtual Eigen::Index getInputSize(const std::string &name) const =0
void setInput(const std::string &name, Eigen::Ref< const Eigen::VectorX< T > > value)
virtual void setInputImp(const std::string &name, Eigen::Ref< const Eigen::VectorX< T > > value)=0
virtual void getInputImp(const std::string &name, Eigen::Ref< Eigen::VectorX< T > > value) const =0
#define MT_THROW_IF(Condition,...)
Conditionally throws a std::runtime_error with a formatted message if the condition is true.
Definition exception.h:55