3 #include "drake/drakeCore_export.h" 6 #include <initializer_list> 10 #include <type_traits> 144 bool IsConstant()
const;
147 bool IsLinear()
const;
150 bool IsAffine()
const;
153 bool IsPolynomial()
const;
156 bool IsDifferentiable()
const;
159 bool IsArbitrary()
const;
162 bool IsUndefined()
const;
187 friend DRAKECORE_EXPORT std::ostream&
operator<<(std::ostream& os,
315 Variables(std::initializer_list<Variable> init);
332 #if defined(DRAKE_DOXYGEN_CXX) 338 typedef std::vector<Variable>::const_iterator const_iterator;
342 const_iterator begin()
const;
345 const_iterator end()
const;
351 std::size_t
size()
const;
362 explicit Variables(std::vector<Variable>&& vars);
363 std::shared_ptr<std::vector<Variable>
const> vars_;
373 #if !defined(DRAKE_DOXYGEN_CXX) 376 friend class Internal;
377 #endif // !defined(DRAKE_DOXYGEN_CXX) 380 #if !defined(DRAKE_DOXYGEN_CXX) 391 #endif // !defined(DRAKE_DOXYGEN_CXX) 413 #if !defined(DRAKE_DOXYGEN_CXX) 415 #endif // !defined(DRAKE_DOXYGEN_CXX) 451 bool is_index()
const;
454 bool is_named()
const;
458 std::size_t index()
const;
462 std::string
const& name()
const;
465 friend DRAKECORE_EXPORT std::ostream&
operator<<(std::ostream& os,
497 void Destruct() noexcept;
501 #if !defined(DRAKE_DOXYGEN_CXX) 506 #endif // !defined(DRAKE_DOXYGEN_CXX) 516 template <
typename MatrixL,
typename MatrixR>
517 typename std::enable_if<
518 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
519 std::is_base_of<Eigen::MatrixBase<MatrixR>, MatrixR>::value &&
520 std::is_same<typename MatrixL::Scalar, FunctionalForm>::value &&
521 std::is_same<typename MatrixR::Scalar, double>::value,
522 typename MatrixL::PlainObject>::type
524 return lhs + rhs.template cast<FunctionalForm>();
531 template <
typename MatrixL,
typename MatrixR>
532 typename std::enable_if<
533 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
534 std::is_base_of<Eigen::MatrixBase<MatrixR>, MatrixR>::value &&
535 std::is_same<typename MatrixL::Scalar, double>::value &&
536 std::is_same<typename MatrixR::Scalar, FunctionalForm>::value,
537 typename MatrixR::PlainObject>::type
539 return lhs.template cast<FunctionalForm>() + rhs;
546 template <
typename MatrixL,
typename MatrixR>
547 typename std::enable_if<
548 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
549 std::is_base_of<Eigen::MatrixBase<MatrixR>, MatrixR>::value &&
550 std::is_same<typename MatrixL::Scalar, FunctionalForm>::value &&
551 std::is_same<typename MatrixR::Scalar, double>::value,
554 return lhs += rhs.template cast<FunctionalForm>();
561 template <
typename MatrixL,
typename MatrixR>
562 typename std::enable_if<
563 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
564 std::is_base_of<Eigen::MatrixBase<MatrixR>, MatrixR>::value &&
565 std::is_same<typename MatrixL::Scalar, FunctionalForm>::value &&
566 std::is_same<typename MatrixR::Scalar, double>::value,
567 typename MatrixL::PlainObject>::type
569 return lhs - rhs.template cast<FunctionalForm>();
576 template <
typename MatrixL,
typename MatrixR>
577 typename std::enable_if<
578 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
579 std::is_base_of<Eigen::MatrixBase<MatrixR>, MatrixR>::value &&
580 std::is_same<typename MatrixL::Scalar, double>::value &&
581 std::is_same<typename MatrixR::Scalar, FunctionalForm>::value,
582 typename MatrixR::PlainObject>::type
584 return lhs.template cast<FunctionalForm>() - rhs;
591 template <
typename MatrixL,
typename MatrixR>
592 typename std::enable_if<
593 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
594 std::is_base_of<Eigen::MatrixBase<MatrixR>, MatrixR>::value &&
595 std::is_same<typename MatrixL::Scalar, FunctionalForm>::value &&
596 std::is_same<typename MatrixR::Scalar, double>::value,
599 return lhs -= rhs.template cast<FunctionalForm>();
606 template <
typename MatrixL,
typename MatrixR>
607 typename std::enable_if<
608 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
609 std::is_base_of<Eigen::MatrixBase<MatrixR>, MatrixR>::value &&
610 std::is_same<typename MatrixL::Scalar, FunctionalForm>::value &&
611 std::is_same<typename MatrixR::Scalar, double>::value,
613 MatrixR::ColsAtCompileTime> >::type
615 return lhs * rhs.template cast<FunctionalForm>();
622 template <
typename MatrixL,
typename MatrixR>
623 typename std::enable_if<
624 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
625 std::is_base_of<Eigen::MatrixBase<MatrixR>, MatrixR>::value &&
626 std::is_same<typename MatrixL::Scalar, double>::value &&
627 std::is_same<typename MatrixR::Scalar, FunctionalForm>::value,
628 Eigen::Matrix<FunctionalForm, MatrixL::RowsAtCompileTime,
629 MatrixR::ColsAtCompileTime> >::type
631 return lhs.template cast<FunctionalForm>() * rhs;
638 template <
typename MatrixL>
639 typename std::enable_if<
640 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
641 std::is_same<typename MatrixL::Scalar, FunctionalForm>::value,
642 typename MatrixL::PlainObject>::type
644 return lhs * FunctionalForm(rhs);
651 template <
typename MatrixR>
652 typename std::enable_if<
653 std::is_base_of<Eigen::MatrixBase<MatrixR>, MatrixR>::value &&
654 std::is_same<typename MatrixR::Scalar, FunctionalForm>::value,
655 typename MatrixR::PlainObject>::type
657 return FunctionalForm(lhs) * rhs;
664 template <
typename MatrixL>
665 typename std::enable_if<
666 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
667 std::is_same<typename MatrixL::Scalar, FunctionalForm>::value,
670 return lhs *= FunctionalForm(rhs);
677 template <
typename MatrixL>
678 typename std::enable_if<
679 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
680 std::is_same<typename MatrixL::Scalar, FunctionalForm>::value,
681 typename MatrixL::PlainObject>::type
683 return lhs / FunctionalForm(rhs);
690 template <
typename MatrixL>
691 typename std::enable_if<
692 std::is_base_of<Eigen::MatrixBase<MatrixL>, MatrixL>::value &&
693 std::is_same<typename MatrixL::Scalar, FunctionalForm>::value,
696 return lhs /= FunctionalForm(rhs);
701 #if !defined(DRAKE_DOXYGEN_CXX) 714 RequireInitialization = 1,
739 #endif // !defined(DRAKE_DOXYGEN_CXX)
bool operator>=(FunctionalForm::Variable const &l, FunctionalForm::Variable const &r)
Definition: functional_form.cc:459
FunctionalForm & operator*=(FunctionalForm &l, FunctionalForm const &r)
Definition: functional_form.cc:223
std::vector< Number > x
Definition: IpoptSolver.cpp:169
FunctionalForm operator*(FunctionalForm const &l, FunctionalForm const &r)
Definition: functional_form.cc:163
Definition: constants.h:3
FunctionalForm log(FunctionalForm const &x)
Definition: functional_form.cc:198
FunctionalForm abs(FunctionalForm const &x)
Definition: functional_form.cc:183
FunctionalForm cos(FunctionalForm const &x)
Definition: functional_form.cc:188
A scalar multi-variate polynomial, modeled after the msspoly in spotless.
Definition: Polynomial.h:42
FunctionalForm sqrt(FunctionalForm const &x)
Definition: functional_form.cc:208
FunctionalForm operator-(FunctionalForm const &l, FunctionalForm const &r)
Definition: functional_form.cc:153
FunctionalForm & operator/=(FunctionalForm &l, FunctionalForm const &r)
Definition: functional_form.cc:228
FunctionalForm operator+(FunctionalForm const &l, FunctionalForm const &r)
Definition: functional_form.cc:143
FunctionalForm & operator+=(FunctionalForm &l, FunctionalForm const &r)
Definition: functional_form.cc:213
bool operator<(FunctionalForm::Variable const &l, FunctionalForm::Variable const &r)
Definition: functional_form.cc:433
FunctionalForm exp(FunctionalForm const &x)
Definition: functional_form.cc:193
bool operator<=(FunctionalForm::Variable const &l, FunctionalForm::Variable const &r)
Definition: functional_form.cc:449
FunctionalForm operator/(FunctionalForm const &l, FunctionalForm const &r)
Definition: functional_form.cc:173
bool operator!=(FunctionalForm::Variable const &l, FunctionalForm::Variable const &r)
Definition: functional_form.cc:428
std::ostream & operator<<(std::ostream &os, FunctionalForm const &f)
Definition: functional_form.cc:282
std::size_t size(const VecType &vec)
size()
Definition: Vector.h:113
FunctionalForm & operator-=(FunctionalForm &l, FunctionalForm const &r)
Definition: functional_form.cc:218
bool operator>(FunctionalForm::Variable const &l, FunctionalForm::Variable const &r)
Definition: functional_form.cc:454
FunctionalForm sin(FunctionalForm const &x)
Definition: functional_form.cc:203
bool operator==(FunctionalForm::Variable const &l, FunctionalForm::Variable const &r)
Definition: functional_form.cc:412