Main MRPT website > C++ reference for MRPT 1.9.9
math_frwds.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef mrpt_math_forwddecls_H
10 #define mrpt_math_forwddecls_H
11 
12 #include <mrpt/config.h>
13 #include <string>
14 #include <type_traits>
15 
16 /*! \file math_frwds.h
17  * Forward declarations of all mrpt::math classes related to vectors, arrays
18  * and matrices.
19  * Many of the function implementations are in ops_matrices.h, others in
20  * ops_containers.h
21  */
22 
23 namespace mrpt
24 {
25 namespace system
26 {
28 }
29 namespace math
30 {
31 struct TPoseOrPoint;
32 class CMatrix; // mrpt-binary-serializable matrix
33 class CMatrixD; // mrpt-binary-serializable matrix
34 
35 namespace detail
36 {
37 /** Internal resize which compiles to nothing on fixed-size matrices. */
38 template <typename MAT, int TypeSizeAtCompileTime>
40 {
41  static inline void internal_resize(MAT&, size_t, size_t) {}
42  static inline void internal_resize(MAT&, size_t) {}
43 };
44 template <typename MAT>
45 struct TAuxResizer<MAT, -1>
46 {
47  static inline void internal_resize(MAT& obj, size_t row, size_t col)
48  {
49  obj.derived().conservativeResize(row, col);
50  }
51  static inline void internal_resize(MAT& obj, size_t nsize)
52  {
53  obj.derived().conservativeResize(nsize);
54  }
55 };
56 }
57 
58 /*! Selection of the number format in CMatrixTemplate::saveToTextFile
59  */
61 {
62  /** engineering format '%e' */
64  /** fixed floating point '%f' */
66  /** intergers '%i' */
68 };
69 
70 /** For usage in one of the constructors of CMatrixFixedNumeric or
71  CMatrixTemplate (and derived classes), if it's not required
72  to fill it with zeros at the constructor to save time. */
74 {
76 };
77 
78 // ---------------- Forward declarations: Classes ----------------
79 template <class T>
80 class CMatrixTemplate;
81 template <class T>
82 class CMatrixTemplateObjects;
83 template <class T>
84 class CQuaternion;
85 
86 /** ContainerType<T>::element_t exposes the value of any STL or Eigen container.
87  * Default specialization works for STL and MRPT containers, there is another
88  * one for Eigen in <mrpt/math/eigen_frwds.h> */
89 template <typename CONTAINER>
90 struct ContainerType
91 {
92  using element_t = typename CONTAINER::value_type;
93 };
94 
95 #define MRPT_MATRIX_CONSTRUCTORS_FROM_POSES(_CLASS_) \
96  template <class TPOSE, typename = std::enable_if_t<std::is_base_of< \
97  mrpt::math::TPoseOrPoint, TPOSE>::value>> \
98  explicit inline _CLASS_(const TPOSE& p) \
99  { \
100  mrpt::math::containerFromPoseOrPoint(*this, p); \
101  } \
102  template <class CPOSE, int = CPOSE::is_3D_val> \
103  explicit inline _CLASS_(const CPOSE& p) \
104  { \
105  mrpt::math::containerFromPoseOrPoint(*this, p); \
106  }
107 
108 template <class CONTAINER1, class CONTAINER2>
109 void cumsum(const CONTAINER1& in_data, CONTAINER2& out_cumsum);
110 
111 template <class CONTAINER>
112 inline typename CONTAINER::Scalar norm(const CONTAINER& v);
113 template <class CONTAINER>
114 inline typename CONTAINER::Scalar norm_inf(const CONTAINER& v);
115 
116 template <class MAT_A, class SKEW_3VECTOR, class MAT_OUT>
117 void multiply_A_skew3(const MAT_A& A, const SKEW_3VECTOR& v, MAT_OUT& out);
118 template <class SKEW_3VECTOR, class MAT_A, class MAT_OUT>
119 void multiply_skew3_A(const SKEW_3VECTOR& v, const MAT_A& A, MAT_OUT& out);
120 
121 namespace detail
122 {
123 template <class MATORG, class MATDEST>
124 void extractMatrix(
125  const MATORG& M, const size_t first_row, const size_t first_col,
126  MATDEST& outMat);
127 }
128 
129 /** Conversion of poses (TPose2D,TPoint2D,...,
130  * mrpt::poses::CPoint2D,CPose3D,...) to MRPT containers (vector/matrix) */
131 template <class CONTAINER, class POINT_OR_POSE>
132 CONTAINER& containerFromPoseOrPoint(CONTAINER& C, const POINT_OR_POSE& p);
133 
134 // Vicinity classes ----------------------------------------------------
135 namespace detail
136 {
137 /**
138  * The purpose of this class is to model traits for containers, so that they
139  * can be used as return values for the function CMatrixTemplate::getVicinity.
140  * This class is NOT defined for any base container, because correctness would
141  * not be guaranteed. Instead, each class must define its own specialization
142  * of the template, containing two functions:
143  * - static void initialize(container<T>,size_t N): must reserve space to allow
144  * at least the insertion of N*N elements, in a square fashion when appliable.
145  * - static void insertInContainer(container<T>,size_t r,size_t c,const T &):
146  * must insert the given element in the container. Whenever it's possible, it
147  * must insert it in the (r,c) coordinates.
148  * For linear containers, the vicinity functions are guaranteed to insert
149  * elements in order, i.e., starting from the top and reading from left to
150  * right.
151  */
152 template <typename T>
154 
155 /**
156  * This huge template encapsulates a function to get the vicinity of an
157  * element, with maximum genericity. Although it's not meant to be called
158  * directly,
159  * every type defining the ASSERT_ENOUGHROOM assert and the get_unsafe method
160  * will work. The assert checks if the boundaries (r-N,r+N,c-N,c+N) fit in
161  * the matrix.
162  * The template parameters are the following:
163  * - MatrixType: the matrix or container base type, from which the vicinity is
164  * required.
165  * - T: the base type of the matrix or container.
166  * - ReturnType: the returning container type. The class
167  * VicinityTraits<ReturnType> must be completely defined.
168  * - D: the dimension of the vicinity. Current implementations are 4, 5, 8, 9,
169  * 12, 13, 20, 21, 24 and 25, although it's easy to implement new variants.
170  */
171 template <typename MatrixType, typename T, typename ReturnType, size_t D>
172 struct getVicinity;
173 }
174 
175 // Other forward decls:
176 template <class T>
177 T wrapTo2Pi(T a);
178 
179 } // End of namespace
180 } // End of namespace
181 
182 #endif
mrpt::math::detail::getVicinity
This huge template encapsulates a function to get the vicinity of an element, with maximum genericity...
Definition: math_frwds.h:172
mrpt::math::MATRIX_FORMAT_INT
@ MATRIX_FORMAT_INT
intergers 'i'
Definition: math_frwds.h:67
mrpt::math::norm_inf
CONTAINER::Scalar norm_inf(const CONTAINER &v)
Definition: ops_containers.h:129
mrpt::math::TMatrixTextFileFormat
TMatrixTextFileFormat
Definition: math_frwds.h:60
mrpt::math::cumsum
void cumsum(const CONTAINER1 &in_data, CONTAINER2 &out_cumsum)
Definition: ops_containers.h:111
mrpt::math::MATRIX_FORMAT_FIXED
@ MATRIX_FORMAT_FIXED
fixed floating point 'f'
Definition: math_frwds.h:65
mrpt::math::detail::TAuxResizer::internal_resize
static void internal_resize(MAT &, size_t)
Definition: math_frwds.h:42
obj
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::math::detail::TAuxResizer< MAT, -1 >::internal_resize
static void internal_resize(MAT &obj, size_t row, size_t col)
Definition: math_frwds.h:47
mrpt::math::wrapTo2Pi
T wrapTo2Pi(T a)
Modifies the given angle to translate it into the [0,2pi[ range.
Definition: wrap2pi.h:41
p
GLfloat GLfloat p
Definition: glext.h:6305
mrpt::math::detail::TAuxResizer< MAT, -1 >::internal_resize
static void internal_resize(MAT &obj, size_t nsize)
Definition: math_frwds.h:51
mrpt::math::MATRIX_FORMAT_ENG
@ MATRIX_FORMAT_ENG
engineering format 'e'
Definition: math_frwds.h:63
Scalar
double Scalar
Definition: KmUtils.h:44
mrpt::math::multiply_skew3_A
void multiply_skew3_A(const SKEW_3VECTOR &v, const MAT_A &A, MAT_OUT &out)
Only for vectors/arrays "v" of length3, compute out = Skew(v) * A, where Skew(v) is the skew symmetri...
Definition: ops_matrices.h:190
mrpt::math::detail::extractMatrix
void extractMatrix(const MATORG &M, const size_t first_row, const size_t first_col, MATDEST &outMat)
Extract a submatrix - The output matrix must be set to the required size before call.
Definition: ops_matrices.h:215
v
const GLdouble * v
Definition: glext.h:3678
mrpt::math::norm
CONTAINER::Scalar norm(const CONTAINER &v)
Definition: ops_containers.h:134
mrpt::math::ContainerType::element_t
typename CONTAINER::value_type element_t
Definition: math_frwds.h:92
mrpt::math::detail::VicinityTraits
The purpose of this class is to model traits for containers, so that they can be used as return value...
Definition: math_frwds.h:153
mrpt::math::TConstructorFlags_Matrices
TConstructorFlags_Matrices
For usage in one of the constructors of CMatrixFixedNumeric or CMatrixTemplate (and derived classes),...
Definition: math_frwds.h:73
mrpt::math::detail::TAuxResizer::internal_resize
static void internal_resize(MAT &, size_t, size_t)
Definition: math_frwds.h:41
mrpt::math::UNINITIALIZED_MATRIX
@ UNINITIALIZED_MATRIX
Definition: math_frwds.h:75
mrpt::math::detail::TAuxResizer
Internal resize which compiles to nothing on fixed-size matrices.
Definition: math_frwds.h:39
mrpt::math::multiply_A_skew3
void multiply_A_skew3(const MAT_A &A, const SKEW_3VECTOR &v, MAT_OUT &out)
Only for vectors/arrays "v" of length3, compute out = A * Skew(v), where Skew(v) is the skew symmetri...
Definition: ops_matrices.h:166
row
GLenum GLenum GLvoid * row
Definition: glext.h:3576
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::math::containerFromPoseOrPoint
CONTAINER & containerFromPoseOrPoint(CONTAINER &C, const POINT_OR_POSE &p)
Conversion of poses (TPose2D,TPoint2D,..., mrpt::poses::CPoint2D,CPose3D,...) to MRPT containers (vec...
Definition: point_poses2vectors.h:23
mrpt::system::MRPT_getVersion
std::string MRPT_getVersion()
Returns a string describing the MRPT version.
Definition: os.cpp:185
a
GLubyte GLubyte GLubyte a
Definition: glext.h:6279



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST