MRPT
2.0.4
mrpt
math
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
28
THROW_EXCEPTION_FMT
(
29
"size: Queried matrix dimension must be 1 or 2. Called with i=%i"
,
30
dim);
31
}
32
}
// namespace mrpt::math
THROW_EXCEPTION_FMT
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
Definition:
exceptions.h:69
mrpt::math::size
size_t size(const MATRIXLIKE &m, const int dim)
Definition:
math/include/mrpt/math/bits_math.h:21
mrpt::math
This base provides a set of functions for maths stuff.
Definition:
math/include/mrpt/math/bits_math.h:11
Page generated by
Doxygen 1.8.17
for MRPT 2.0.4 at Sat Jun 27 14:00:59 UTC 2020