TVM  0.9.4
Space.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include <tvm/api.h>
6 #include <tvm/defs.h>
7 
8 #include <Eigen/Core>
9 
10 #include <memory>
11 #include <string>
12 #include <vector>
13 
14 namespace tvm
15 {
33 {
34 public:
36  enum class Type
37  {
38  Euclidean,
39  SO3,
40  SE3,
41  Unspecified
42  };
43 
48  Space(int size);
54  Space(int size, int representationSize);
61  Space(int size, int representationSize, int tangentRepresentationSize);
62 
68  Space(Type type, int size = -1);
69 
71  std::unique_ptr<Variable> createVariable(std::string_view name) const;
72 
74  int size() const;
76  int rSize() const;
78  int tSize() const;
80  Type type() const;
82  bool isEuclidean() const;
84  std::string sizeAsString() const;
85 
86  bool operator==(const Space & other) const
87  {
88  return this->mSize_ == other.mSize_ && this->rSize_ == other.rSize_ && this->tSize_ == other.tSize_
89  && this->type_ == other.type_;
90  }
91 
92  bool operator!=(const Space & other) const { return !operator==(other); }
93 
94  bool operator<=(const Space & other) const
95  { return this->mSize_ <= other.mSize_ && this->rSize_ <= other.rSize_ && this->tSize_ <= other.tSize_; }
96 
97  friend Space operator*(const Space & s1, const Space & s2)
98  {
99  Space prod{s1.mSize_ + s2.mSize_, s1.rSize_ + s2.rSize_, s1.tSize_ + s2.tSize_};
100  if(s1.type_ == Space::Type::Euclidean && s2.type_ == Space::Type::Euclidean)
101  prod.type_ = Space::Type::Euclidean;
102  else
103  prod.type_ = Space::Type::Unspecified;
104  return prod;
105  }
106 
107 private:
108  int mSize_; // size of this space (as a manifold)
109  int rSize_; // size of a vector representing a point in this space
110  int tSize_; // size of a vector representing a velocity in this space
111  Type type_; // the space type
112 };
113 
114 } // namespace tvm
#define TVM_DLLAPI
Definition: api.h:35
Definition: Space.h:33
bool operator<=(const Space &other) const
Definition: Space.h:94
int size() const
std::unique_ptr< Variable > createVariable(std::string_view name) const
Space(int size, int representationSize, int tangentRepresentationSize)
Space(int size, int representationSize)
Type type() const
Space(int size)
int rSize() const
bool operator!=(const Space &other) const
Definition: Space.h:92
std::string sizeAsString() const
int tSize() const
bool operator==(const Space &other) const
Definition: Space.h:86
bool isEuclidean() const
Space(Type type, int size=-1)
friend Space operator*(const Space &s1, const Space &s2)
Definition: Space.h:97
Type
Definition: Space.h:37
Type
Definition: enums.h:15
Definition: Clock.h:12
bool operator==(const Variable &u, const Variable &v)
Definition: Variable.h:327