MRPT  2.0.4
math/include/mrpt/math/bits_math.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 namespace mrpt::math
12 {
13 // This inline function is used everywhere, so just move it here even it's not a
14 // forward declaration!
15 /*! Returns the size of the matrix in the i'th dimension: 1=rows, 2=columns
16  * (MATLAB-compatible function)
17  * \note Template argument MATRIXLIKE can be: mrpt::math::CMatrixDynamic,
18  * mrpt::math::CMatrixDynamic, mrpt::math::CMatrixFixed
19  */
20 template <class MATRIXLIKE>
21 inline size_t size(const MATRIXLIKE& m, const int dim)
22 {
23  if (dim == 1)
24  return m.rows();
25  else if (dim == 2)
26  return m.cols();
27  else
29  "size: Queried matrix dimension must be 1 or 2. Called with i=%i",
30  dim);
31 }
32 } // namespace mrpt::math
size_t size(const MATRIXLIKE &m, const int dim)
This base provides a set of functions for maths stuff.
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
Definition: exceptions.h:69



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020