bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::maths Namespace Reference

Namespaces

namespace  optimization
namespace  stats

Functions

template<typename T>
int_t sign (const T &expr)
template<typename T>
int_t sign (const T &expr1, const T &expr2)
template<typename T>
T sum_sqr (const DynVec< T > &vec)
 Compute the sum of squares of the elements of the given vector.
template<typename T>
T sqr (const T &v)
real_t wrap_angle (real_t angle)
 The angle [rad] wrapped to \((-\pi, \pi]\), so that angles that differ by whole turns compare equal.
template<typename VectorType>
uint_t arg_max (const VectorType &vec)
 Returns the index of the element that has the maximum value in the array. Implementation taken from http://www.jclay.host/dev-journal/simple_cpp_argmax_argmin.html.
template<typename VectorType>
uint_t arg_min (const VectorType &vec)
 Returns the index of the element that has the minimum value in the array. Implementation taken from http://www.jclay.host/dev-journal/simple_cpp_argmax_argmin.html.
template<typename VectorType>
VectorType::value_type max (const VectorType &vec)
 Returns the max element in the vector.
template<typename VectorType>
VectorType::value_type min (const VectorType &vec)
 Returns the minimum element in the vector.
template<typename T>
std::vector< T > lin_space (T start, T stop, uint_t n)
 Generate n evenly linearly spaced numbers between [start, stop]. Analogous to NumPy linspace.

Function Documentation

◆ arg_max()

template<typename VectorType>
uint_t bitsim::maths::arg_max ( const VectorType & vec)

Returns the index of the element that has the maximum value in the array. Implementation taken from http://www.jclay.host/dev-journal/simple_cpp_argmax_argmin.html.

◆ arg_min()

template<typename VectorType>
uint_t bitsim::maths::arg_min ( const VectorType & vec)

Returns the index of the element that has the minimum value in the array. Implementation taken from http://www.jclay.host/dev-journal/simple_cpp_argmax_argmin.html.

◆ lin_space()

template<typename T>
std::vector< T > bitsim::maths::lin_space ( T start,
T stop,
uint_t n )

Generate n evenly linearly spaced numbers between [start, stop]. Analogous to NumPy linspace.

◆ max()

template<typename VectorType>
VectorType::value_type bitsim::maths::max ( const VectorType & vec)

Returns the max element in the vector.

◆ min()

template<typename VectorType>
VectorType::value_type bitsim::maths::min ( const VectorType & vec)

Returns the minimum element in the vector.

◆ sign() [1/2]

template<typename T>
int_t bitsim::maths::sign ( const T & expr)

◆ sign() [2/2]

template<typename T>
int_t bitsim::maths::sign ( const T & expr1,
const T & expr2 )

◆ sqr()

template<typename T>
T bitsim::maths::sqr ( const T & v)

◆ sum_sqr()

template<typename T>
T bitsim::maths::sum_sqr ( const DynVec< T > & vec)

Compute the sum of squares of the elements of the given vector.

Parameters
vecThe vector
Returns
sum of squares

◆ wrap_angle()

real_t bitsim::maths::wrap_angle ( real_t angle)
inline

The angle [rad] wrapped to \((-\pi, \pi]\), so that angles that differ by whole turns compare equal.