bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim_types.h
Go to the documentation of this file.
1#ifndef BITSIM_TYPES_H
2#define BITSIM_TYPES_H
3
9
10#include "Eigen/Core"
11
12#include <cstddef>
13
14namespace bitsim
15{
16
20using real_t = double;
21
25using float_t = float;
26
30using int_t = int;
31
35using lint_t = long int;
36
40using uint_t = std::size_t;
41
45using index_t = Eigen::Index;
46
51template <typename T> using DynMat = Eigen::MatrixX<T>;
52
57
61template <typename T, uint_t N> using SquareMat = Eigen::Matrix<T, N, N>;
62
66template <typename T, uint_t N, uint_t M> using Mat = Eigen::Matrix<T, N, M>;
67
73template <typename T, uint_t N, uint_t M>
75 Eigen::Matrix<T, N, M,
76 Eigen::DontAlign | (N == 1 && M != 1 ? Eigen::RowMajor : Eigen::ColMajor)>;
77
81using RealMat2d = Eigen::Matrix2<real_t>;
82
86using RealMat3d = Eigen::Matrix3<real_t>;
87
91using RealMat4d = Eigen::Matrix4<real_t>;
92
96using FloatMat3d = Eigen::Matrix3<float_t>;
97
101template <typename T> using DynVec = Eigen::RowVectorX<T>;
102
107
112
117template <typename T> using ColVec = Eigen::VectorX<T>;
118
123
128
132using RealColVec2d = Eigen::Vector2d;
133
137using RealColVec3d = Eigen::Vector3d;
138
142using RealColVec4d = Eigen::Vector4d;
143
147using FloatColVec3d = Eigen::Vector3f;
148
154template <uint_t s, uint_t e> struct IntegralRange
155{
157 static constexpr uint_t S = s;
158 static constexpr uint_t E = e;
159 static constexpr uint_t size = e - s;
160};
161
166template <real_t s, real_t e> struct RealRange
167{
169 static constexpr real_t S = s;
170 static constexpr real_t E = e;
171 static constexpr real_t size = e - s;
172};
173
178struct Null
179{
180};
181
185enum class DeviceType
186{
188 CPU = 1,
189 GPU = 2
190};
191
192} // namespace bitsim
193
194#endif // BITSIM_TYPES_H
Definition dc_motor_backend_base.h:9
Eigen::Matrix2< real_t > RealMat2d
2×2 matrix of type double.
Definition bitsim_types.h:81
Eigen::Vector4d RealColVec4d
4D column vector
Definition bitsim_types.h:142
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
Eigen::Matrix< T, N, M, Eigen::DontAlign|(N==1 &&M !=1 ? Eigen::RowMajor :Eigen::ColMajor)> UnalignedMat
General fixed size matrix that Eigen does not align. Use it for a fixed size member of a class that i...
Definition bitsim_types.h:74
Eigen::Index index_t
The type Eigen indexes and sizes matrices and vectors with.
Definition bitsim_types.h:45
Eigen::MatrixX< T > DynMat
Dynamically sized matrix to use around the library.
Definition bitsim_types.h:51
DynVec< real_t > RealVec
double precision floating point vector
Definition bitsim_types.h:111
DynVec< float_t > FloatVec
single precision floating point vector
Definition bitsim_types.h:106
float float_t
float
Definition bitsim_types.h:25
ColVec< real_t > RealColVec
Dynamically sized column vector.
Definition bitsim_types.h:122
Eigen::Matrix< T, N, N > SquareMat
Square matrix with elements of type T.
Definition bitsim_types.h:61
Eigen::Matrix3< real_t > RealMat3d
3×3 matrix of type double.
Definition bitsim_types.h:86
double real_t
real_t
Definition bitsim_types.h:20
Eigen::Matrix4< real_t > RealMat4d
4×4 matrix of type double.
Definition bitsim_types.h:91
Eigen::Vector3d RealColVec3d
3D column vector
Definition bitsim_types.h:137
DeviceType
Enumeration of various device types.
Definition bitsim_types.h:186
@ INVALID_TYPE
Definition bitsim_types.h:187
@ CPU
Definition bitsim_types.h:188
@ GPU
Definition bitsim_types.h:189
Eigen::Vector2d RealColVec2d
2D column vector
Definition bitsim_types.h:132
int int_t
integer type
Definition bitsim_types.h:30
Eigen::RowVectorX< T > DynVec
Dynamically sized row vector.
Definition bitsim_types.h:101
Eigen::VectorX< T > ColVec
Column vector. Some maths operations are easier using column vectors rather than DynVec.
Definition bitsim_types.h:117
Eigen::Matrix3< float_t > FloatMat3d
3×3 matrix of type float.
Definition bitsim_types.h:96
Eigen::Vector3f FloatColVec3d
3D column vector
Definition bitsim_types.h:147
long int lint_t
long int type
Definition bitsim_types.h:35
DynMat< real_t > RealMat
Dynamically sized matrix of type double.
Definition bitsim_types.h:56
ColVec< float_t > FoatColVec
Dynamically sized column vector.
Definition bitsim_types.h:127
Eigen::Matrix< T, N, M > Mat
General fixed size matrix.
Definition bitsim_types.h:66
A range of integer values in [s, e].
Definition bitsim_types.h:155
static constexpr uint_t E
Definition bitsim_types.h:158
static constexpr uint_t S
Definition bitsim_types.h:157
uint_t value_type
Definition bitsim_types.h:156
static constexpr uint_t size
Definition bitsim_types.h:159
Null placeholder.
Definition bitsim_types.h:179
A range of double precision floating point values.
Definition bitsim_types.h:167
real_t value_type
Definition bitsim_types.h:168
static constexpr real_t S
Definition bitsim_types.h:169
static constexpr real_t size
Definition bitsim_types.h:171
static constexpr real_t E
Definition bitsim_types.h:170