58 template <
typename T,
bool Cond>
146 gamma.to_const_map(),
185 Scalar prec = std::numeric_limits<Scalar>::epsilon())
const;
218 assert(check_allocators());
247 stages[i].addParameterization(nth);
261 !
g0.isApprox(other.
g0))
271 Scalar
evaluate(
const VectorOfVectors &xs,
const VectorOfVectors &us,
272 const std::optional<ConstVectorRef> &theta_)
const;
278 bool m_is_invalid{
true};
280 [[nodiscard]]
bool check_allocators()
const {
286template <
typename Scalar>
289 return (lhs.
nx == rhs.
nx) && (lhs.
nu == rhs.
nu) && (lhs.
nc == rhs.
nc) &&
293template <
typename Scalar>
297 oss << fmt::format(
"\n nx: {:d}", self.nx)
298 << fmt::format(
"\n nu: {:d}", self.nu)
299 << fmt::format(
"\n nc: {:d}", self.nc);
301 oss << fmt::format(
"\n nth: {:d}", self.nth);
329#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
330extern template struct LqrKnotTpl<context::Scalar>;
331extern template struct LqrProblemTpl<context::Scalar>;
Thin wrapper around Eigen::Map representing a matrix object with memory managed by a C++17 polymorphi...
allocator_type get_allocator() const noexcept
Accessor to retrieve the allocator used for this matrix.
A convenience subclass of std::pmr::polymorphic_allocator for bytes.
std::ostream & operator<<(std::ostream &oss, const LqrKnotTpl< Scalar > &self_)
bool lqrKnotsSameDim(const LqrKnotTpl< Scalar > &lhs, const LqrKnotTpl< Scalar > &rhs)
auto eigenPrintWithPreamble(const Eigen::EigenBase< D > &mat, const std::string &text, Eigen::IOFormat ft=EIGEN_DEFAULT_IO_FORMAT)
Eigen::Map< add_const_if_t< MatrixXs, IsConst >, Alignment > mat_t
Eigen::Map< add_const_if_t< VectorXs, IsConst >, Alignment > vec_t
Struct describing a stage of a constrained LQ problem.
ManagedMatrix< Scalar, Eigen::Dynamic, 1 > MVec
allocator_type get_allocator() const
void assign(const LqrKnotTpl< Scalar > &other)
Assign matrices (and dimensions) from another LqrKnotTpl.
static constexpr int Alignment
ManagedMatrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > MMat
LqrKnotTpl(uint nx, uint nu, uint nc, uint nx2, uint nth, allocator_type alloc={})
friend bool operator==(const LqrKnotTpl &lhs, const LqrKnotTpl &rhs)
LqrKnotTpl(LqrKnotTpl &&other)
Move constructor. Allocator will be moved from other. Other will be have m_empty_after_move set to tr...
LqrKnotTpl(uint nx, uint nu, uint nc, allocator_type alloc={})
Delegating constructor, assumes nx2 = nx, and nth = 0.
__view_base< true > const_view_t
bool isApprox(const LqrKnotTpl &other, Scalar prec=std::numeric_limits< Scalar >::epsilon()) const
LqrKnotTpl & operator=(LqrKnotTpl &&)
Move assignment. Other allocator will be stolen.
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
std::conditional_t< Cond, std::add_const_t< T >, T > add_const_if_t
LqrKnotTpl & addParameterization(uint nth)
LqrKnotTpl(const LqrKnotTpl &other, allocator_type alloc={})
Copy constructor. Allocator must be given.
polymorphic_allocator allocator_type
const_view_t to_const_view() const
Convert knot to an aggregate of Eigen::Map to const.
const_view_t to_view() const
LqrKnotTpl & operator=(const LqrKnotTpl &other)
Copy assignment. Current allocator will be reused if required.
__view_base< false > view_t
view_t to_view()
Convert knot to an aggregate of Eigen::Map.
LqrKnotTpl(uint nx, uint nu, uint nc, uint nx2, allocator_type alloc={})
Delegating constructor, assumes nth = 0.
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
LqrProblemTpl(const LqrProblemTpl &other, allocator_type alloc={})
Copy constructor. Will copy the allocator from other.
std::pmr::vector< KnotType > KnotVector
void addParameterization(uint nth)
allocator_type get_allocator() const
LqrProblemTpl(allocator_type alloc={})
ManagedMatrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > MMat
LqrKnotTpl< Scalar > KnotType
bool isInitialized() const
Scalar evaluate(const VectorOfVectors &xs, const VectorOfVectors &us, const std::optional< ConstVectorRef > &theta_) const
Evaluate the quadratic objective.
bool isParameterized() const
polymorphic_allocator allocator_type
LqrProblemTpl(const KnotVector &knots, long nc0, allocator_type alloc={})
This constructor will take the knots as-is.
LqrProblemTpl(LqrProblemTpl &&other)
Move constructor - we steal the allocator from the source object.
static constexpr int Alignment
int horizon() const noexcept
uint nc0() const noexcept
Dimension of the initial condition constraint.
ManagedMatrix< Scalar, Eigen::Dynamic, 1 > MVec
bool isApprox(const LqrProblemTpl &other)
LqrProblemTpl(KnotVector &&knots, long nc0)
This constructor will take the knots as-is, copying their specified allocator.
Tag type for e.g. non-allocating constructors.