Drake
functional_form.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "drake/drakeCore_export.h"
4 
5 #include <cstddef>
6 #include <initializer_list>
7 #include <iosfwd>
8 #include <memory>
9 #include <string>
10 #include <type_traits>
11 #include <vector>
12 
13 #include <Eigen/Core>
14 
15 namespace drake {
16 
104 class DRAKECORE_EXPORT FunctionalForm {
105  public:
106  class Variable;
107  class Variables;
108 
110  FunctionalForm();
111 
114  explicit FunctionalForm(double d);
115 
117  static FunctionalForm Zero();
118 
120  static FunctionalForm Constant();
121 
123  static FunctionalForm Linear(Variables v);
124 
126  static FunctionalForm Affine(Variables v);
127 
130 
132  static FunctionalForm Differentiable(Variables v);
133 
135  static FunctionalForm Arbitrary(Variables v);
136 
138  static FunctionalForm Undefined(Variables v);
139 
141  bool IsZero() const;
142 
144  bool IsConstant() const;
145 
147  bool IsLinear() const;
148 
150  bool IsAffine() const;
151 
153  bool IsPolynomial() const;
154 
156  bool IsDifferentiable() const;
157 
159  bool IsArbitrary() const;
160 
162  bool IsUndefined() const;
163 
166  bool Is(FunctionalForm const& f) const;
167 
169  Variables GetVariables() const;
170 
187  friend DRAKECORE_EXPORT std::ostream& operator<<(std::ostream& os,
188  FunctionalForm const& f);
189 
191  friend DRAKECORE_EXPORT FunctionalForm operator+(FunctionalForm const& lhs,
192  FunctionalForm const& rhs);
193 
196  friend DRAKECORE_EXPORT FunctionalForm operator+(FunctionalForm const& lhs,
197  double rhs);
198 
201  friend DRAKECORE_EXPORT FunctionalForm operator+(double lhs,
202  FunctionalForm const& rhs);
203 
205  friend DRAKECORE_EXPORT FunctionalForm& operator+=(FunctionalForm& lhs,
206  FunctionalForm const& rhs);
207 
209  friend DRAKECORE_EXPORT FunctionalForm& operator+=(FunctionalForm& lhs,
210  double rhs);
211 
213  friend DRAKECORE_EXPORT FunctionalForm operator-(FunctionalForm const& lhs,
214  FunctionalForm const& rhs);
215 
218  friend DRAKECORE_EXPORT FunctionalForm operator-(FunctionalForm const& lhs,
219  double rhs);
220 
223  friend DRAKECORE_EXPORT FunctionalForm operator-(double lhs,
224  FunctionalForm const& rhs);
225 
227  friend DRAKECORE_EXPORT FunctionalForm& operator-=(FunctionalForm& lhs,
228  FunctionalForm const& rhs);
229 
231  friend DRAKECORE_EXPORT FunctionalForm& operator-=(FunctionalForm& lhs,
232  double rhs);
233 
235  friend DRAKECORE_EXPORT FunctionalForm operator*(FunctionalForm const& lhs,
236  FunctionalForm const& rhs);
237 
240  friend DRAKECORE_EXPORT FunctionalForm operator*(FunctionalForm const& lhs,
241  double rhs);
242 
245  friend DRAKECORE_EXPORT FunctionalForm operator*(double lhs,
246  FunctionalForm const& rhs);
247 
249  friend DRAKECORE_EXPORT FunctionalForm& operator*=(FunctionalForm& lhs,
250  FunctionalForm const& rhs);
251 
254  friend DRAKECORE_EXPORT FunctionalForm& operator*=(FunctionalForm& lhs,
255  double rhs);
256 
258  friend DRAKECORE_EXPORT FunctionalForm operator/(FunctionalForm const& lhs,
259  FunctionalForm const& rhs);
260 
263  friend DRAKECORE_EXPORT FunctionalForm operator/(FunctionalForm const& lhs,
264  double rhs);
265 
268  friend DRAKECORE_EXPORT FunctionalForm operator/(double lhs,
269  FunctionalForm const& rhs);
270 
272  friend DRAKECORE_EXPORT FunctionalForm& operator/=(FunctionalForm& lhs,
273  FunctionalForm const& rhs);
274 
276  friend DRAKECORE_EXPORT FunctionalForm& operator/=(FunctionalForm& lhs,
277  double rhs);
278 
281  friend DRAKECORE_EXPORT FunctionalForm abs(FunctionalForm const& x);
282 
285  friend DRAKECORE_EXPORT FunctionalForm cos(FunctionalForm const& x);
286 
289  friend DRAKECORE_EXPORT FunctionalForm exp(FunctionalForm const& x);
290 
293  friend DRAKECORE_EXPORT FunctionalForm log(FunctionalForm const& x);
294 
297  friend DRAKECORE_EXPORT FunctionalForm sin(FunctionalForm const& x);
298 
301  friend DRAKECORE_EXPORT FunctionalForm sqrt(FunctionalForm const& x);
302 
309  class DRAKECORE_EXPORT Variables {
310  public:
312  Variables() = default;
313 
315  Variables(std::initializer_list<Variable> init);
316 
318  Variables(Variables&&) = default;
319 
321  Variables(Variables const&) = default;
322 
324  Variables& operator=(Variables&&) = default;
325 
327  Variables& operator=(Variables const&) = default;
328 
330  static Variables Union(Variables const& l, Variables const& r);
331 
332 #if defined(DRAKE_DOXYGEN_CXX)
333 
336  typedef unspecified_bidirectional_const_iterator<Variable> const_iterator;
337 #else
338  typedef std::vector<Variable>::const_iterator const_iterator;
339 #endif
340 
342  const_iterator begin() const;
343 
345  const_iterator end() const;
346 
348  bool empty() const;
349 
351  std::size_t size() const;
352 
354  friend DRAKECORE_EXPORT bool operator==(Variables const& lhs,
355  Variables const& rhs);
356 
358  friend DRAKECORE_EXPORT bool operator!=(Variables const& lhs,
359  Variables const& rhs);
360 
361  private:
362  explicit Variables(std::vector<Variable>&& vars);
363  std::shared_ptr<std::vector<Variable> const> vars_;
364  };
365 
366  private:
367  enum class Form;
368  FunctionalForm(Form f, Variables&& v);
369 
370  Variables vars_;
371  Form form_;
372 
373 #if !defined(DRAKE_DOXYGEN_CXX)
374  // Internal class for friendship-access in implementation file.
375  class Internal;
376  friend class Internal;
377 #endif // !defined(DRAKE_DOXYGEN_CXX)
378 };
379 
380 #if !defined(DRAKE_DOXYGEN_CXX)
381 // Delete comparison operators because any function containing a conditional
382 // cannot be evaluated directly with FunctionalForm as its scalar type.
383 // Such functions will require a manual overload with FunctionalForm to
384 // specify their form.
385 bool operator==(FunctionalForm const&, FunctionalForm const&) = delete;
386 bool operator!=(FunctionalForm const&, FunctionalForm const&) = delete;
387 bool operator<(FunctionalForm const&, FunctionalForm const&) = delete;
388 bool operator<=(FunctionalForm const&, FunctionalForm const&) = delete;
389 bool operator>(FunctionalForm const&, FunctionalForm const&) = delete;
390 bool operator>=(FunctionalForm const&, FunctionalForm const&) = delete;
391 #endif // !defined(DRAKE_DOXYGEN_CXX)
392 
412 class
413 #if !defined(DRAKE_DOXYGEN_CXX)
414  DRAKECORE_EXPORT
415 #endif // !defined(DRAKE_DOXYGEN_CXX)
417  public:
419  Variable();
420 
422  Variable(std::size_t index);
423 
425  Variable(std::string name);
426 
429  template <int N>
430  Variable(char const (&name)[N]) : Variable(std::string(name)) {}
431 
433  Variable(Variable const& v);
434 
436  Variable(Variable&& v) noexcept; // NOLINT(whitespace/operators) // false-pos
437 
439  ~Variable();
440 
442  Variable& operator=(Variable const& v);
443 
445  Variable& operator=(Variable&& v) noexcept;
446 
448  bool is_nil() const;
449 
451  bool is_index() const;
452 
454  bool is_named() const;
455 
458  std::size_t index() const;
459 
462  std::string const& name() const;
463 
465  friend DRAKECORE_EXPORT std::ostream& operator<<(std::ostream& os,
466  Variable const& v);
467 
469  friend DRAKECORE_EXPORT bool operator==(Variable const& lhs,
470  Variable const& rhs);
471 
473  friend DRAKECORE_EXPORT bool operator!=(Variable const& lhs,
474  Variable const& rhs);
475 
478  friend DRAKECORE_EXPORT bool operator<(Variable const& lhs,
479  Variable const& rhs);
480 
483  friend DRAKECORE_EXPORT bool operator<=(Variable const& lhs,
484  Variable const& rhs);
485 
488  friend DRAKECORE_EXPORT bool operator>(Variable const& lhs,
489  Variable const& rhs);
490 
493  friend DRAKECORE_EXPORT bool operator>=(Variable const& lhs,
494  Variable const& rhs);
495 
496  private:
497  void Destruct() noexcept;
498 
499 // Hide this from doxygen because it incorrectly documents these
500 // members as public. They are not user-facing anyway.
501 #if !defined(DRAKE_DOXYGEN_CXX)
502  union {
503  std::size_t index_;
504  std::string name_;
505  };
506 #endif // !defined(DRAKE_DOXYGEN_CXX)
507 
508  enum class Tag;
509  Tag tag_;
510 };
511 
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
523 operator+(MatrixL const& lhs, MatrixR const& rhs) {
524  return lhs + rhs.template cast<FunctionalForm>();
525 }
526 
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
538 operator+(MatrixL const& lhs, MatrixR const& rhs) {
539  return lhs.template cast<FunctionalForm>() + rhs;
540 }
541 
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,
552  MatrixL&>::type
553 operator+=(MatrixL& lhs, MatrixR const& rhs) {
554  return lhs += rhs.template cast<FunctionalForm>();
555 }
556 
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
568 operator-(MatrixL const& lhs, MatrixR const& rhs) {
569  return lhs - rhs.template cast<FunctionalForm>();
570 }
571 
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
583 operator-(MatrixL const& lhs, MatrixR const& rhs) {
584  return lhs.template cast<FunctionalForm>() - rhs;
585 }
586 
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,
597  MatrixL&>::type
598 operator-=(MatrixL& lhs, MatrixR const& rhs) {
599  return lhs -= rhs.template cast<FunctionalForm>();
600 }
601 
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,
612  Eigen::Matrix<FunctionalForm, MatrixL::RowsAtCompileTime,
613  MatrixR::ColsAtCompileTime> >::type
614 operator*(MatrixL const& lhs, MatrixR const& rhs) {
615  return lhs * rhs.template cast<FunctionalForm>();
616 }
617 
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
630 operator*(MatrixL const& lhs, MatrixR const& rhs) {
631  return lhs.template cast<FunctionalForm>() * rhs;
632 }
633 
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
643 operator*(MatrixL const& lhs, double rhs) {
644  return lhs * FunctionalForm(rhs);
645 }
646 
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
656 operator*(double lhs, MatrixR const& rhs) {
657  return FunctionalForm(lhs) * rhs;
658 }
659 
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,
668  MatrixL&>::type
669 operator*=(MatrixL& lhs, double rhs) {
670  return lhs *= FunctionalForm(rhs);
671 }
672 
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
682 operator/(MatrixL const& lhs, double rhs) {
683  return lhs / FunctionalForm(rhs);
684 }
685 
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,
694  MatrixL&>::type
695 operator/=(MatrixL& lhs, double rhs) {
696  return lhs /= FunctionalForm(rhs);
697 }
698 
699 } // namespace drake
700 
701 #if !defined(DRAKE_DOXYGEN_CXX)
702 // Define Eigen traits needed for Matrix<FunctionalForm>.
703 namespace Eigen {
704 
705 // Eigen scalar type traits for Matrix<FunctionalForm>.
706 template <>
707 struct NumTraits<drake::FunctionalForm> {
708  enum {
709  // Our set of allowed values is discrete, and no epsilon is allowed during
710  // equality comparison, so treat this as an unsigned integer type.
711  IsInteger = 1,
712  IsSigned = 0,
713  IsComplex = 0,
714  RequireInitialization = 1,
715  ReadCost = 1,
716  AddCost = 1,
717  MulCost = 1
718  };
719 
720  typedef drake::FunctionalForm Real;
721  typedef drake::FunctionalForm Nested;
722 
723  static inline Real dummy_precision() { return drake::FunctionalForm(); }
724 };
725 
726 namespace internal {
727 
728 // Eigen component-wise Matrix<FunctionalForm>::isConstant(FunctionalForm).
729 template <>
730 struct scalar_fuzzy_impl<drake::FunctionalForm> {
731  static inline bool isApprox(drake::FunctionalForm x, drake::FunctionalForm y,
733  return x.Is(y);
734  }
735 };
736 
737 } // namespace internal
738 } // namespace Eigen
739 #endif // !defined(DRAKE_DOXYGEN_CXX)
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_base_of< Eigen::MatrixBase< MatrixR >, MatrixR >::value &&std::is_same< typename MatrixL::Scalar, FunctionalForm >::value &&std::is_same< typename MatrixR::Scalar, double >::value, MatrixL & >::type operator-=(MatrixL &lhs, MatrixR const &rhs)
Definition: functional_form.h:598
Represent an abstract form of a function of zero or more variables.
Definition: functional_form.h:104
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
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_base_of< Eigen::MatrixBase< MatrixR >, MatrixR >::value &&std::is_same< typename MatrixL::Scalar, FunctionalForm >::value &&std::is_same< typename MatrixR::Scalar, double >::value, typename MatrixL::PlainObject >::type operator-(MatrixL const &lhs, MatrixR const &rhs)
Definition: functional_form.h:568
FunctionalForm operator*(FunctionalForm const &l, FunctionalForm const &r)
Definition: functional_form.cc:163
Definition: constants.h:3
Represent a variable in a FunctionalForm.
Definition: functional_form.h:412
bool Is(FunctionalForm const &f) const
Return true if the given form combines the same variables in the same way as we do.
Definition: functional_form.cc:137
FunctionalForm log(FunctionalForm const &x)
Definition: functional_form.cc:198
STL namespace.
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
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixR >, MatrixR >::value &&std::is_same< typename MatrixR::Scalar, FunctionalForm >::value, typename MatrixR::PlainObject >::type operator*(double lhs, MatrixR const &rhs)
Definition: functional_form.h:656
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_base_of< Eigen::MatrixBase< MatrixR >, MatrixR >::value &&std::is_same< typename MatrixL::Scalar, FunctionalForm >::value &&std::is_same< typename MatrixR::Scalar, double >::value, typename MatrixL::PlainObject >::type operator+(MatrixL const &lhs, MatrixR const &rhs)
Definition: functional_form.h:523
Represent a set of Variable instances.
Definition: functional_form.h:309
FunctionalForm sqrt(FunctionalForm const &x)
Definition: functional_form.cc:208
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_base_of< Eigen::MatrixBase< MatrixR >, MatrixR >::value &&std::is_same< typename MatrixL::Scalar, double >::value &&std::is_same< typename MatrixR::Scalar, FunctionalForm >::value, Eigen::Matrix< FunctionalForm, MatrixL::RowsAtCompileTime, MatrixR::ColsAtCompileTime > >::type operator*(MatrixL const &lhs, MatrixR const &rhs)
Definition: functional_form.h:630
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_base_of< Eigen::MatrixBase< MatrixR >, MatrixR >::value &&std::is_same< typename MatrixL::Scalar, double >::value &&std::is_same< typename MatrixR::Scalar, FunctionalForm >::value, typename MatrixR::PlainObject >::type operator-(MatrixL const &lhs, MatrixR const &rhs)
Definition: functional_form.h:583
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_same< typename MatrixL::Scalar, FunctionalForm >::value, typename MatrixL::PlainObject >::type operator/(MatrixL const &lhs, double rhs)
Definition: functional_form.h:682
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_same< typename MatrixL::Scalar, FunctionalForm >::value, MatrixL & >::type operator*=(MatrixL &lhs, double rhs)
Definition: functional_form.h:669
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
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_base_of< Eigen::MatrixBase< MatrixR >, MatrixR >::value &&std::is_same< typename MatrixL::Scalar, double >::value &&std::is_same< typename MatrixR::Scalar, FunctionalForm >::value, typename MatrixR::PlainObject >::type operator+(MatrixL const &lhs, MatrixR const &rhs)
Definition: functional_form.h:538
unspecified_bidirectional_const_iterator< Variable > const_iterator
Type used to iterate through the set.
Definition: functional_form.h:336
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
Variable(char const (&name)[N])
Construct a variable identified by a non-empty string name (string literal).
Definition: functional_form.h:430
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::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_same< typename MatrixL::Scalar, FunctionalForm >::value, typename MatrixL::PlainObject >::type operator*(MatrixL const &lhs, double rhs)
Definition: functional_form.h:643
std::ostream & operator<<(std::ostream &os, FunctionalForm const &f)
Definition: functional_form.cc:282
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_base_of< Eigen::MatrixBase< MatrixR >, MatrixR >::value &&std::is_same< typename MatrixL::Scalar, FunctionalForm >::value &&std::is_same< typename MatrixR::Scalar, double >::value, MatrixL & >::type operator+=(MatrixL &lhs, MatrixR const &rhs)
Definition: functional_form.h:553
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
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_same< typename MatrixL::Scalar, FunctionalForm >::value, MatrixL & >::type operator/=(MatrixL &lhs, double rhs)
Definition: functional_form.h:695
std::enable_if< std::is_base_of< Eigen::MatrixBase< MatrixL >, MatrixL >::value &&std::is_base_of< Eigen::MatrixBase< MatrixR >, MatrixR >::value &&std::is_same< typename MatrixL::Scalar, FunctionalForm >::value &&std::is_same< typename MatrixR::Scalar, double >::value, Eigen::Matrix< FunctionalForm, MatrixL::RowsAtCompileTime, MatrixR::ColsAtCompileTime > >::type operator*(MatrixL const &lhs, MatrixR const &rhs)
Definition: functional_form.h:614
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