Helios++
Helios software for LiDAR simulations
Scalar.hpp
1 #ifndef _SURFACEINSPECTOR_MATHS_SCALAR_HPP_
2 #define _SURFACEINSPECTOR_MATHS_SCALAR_HPP_
3 
4 #include <surfaceinspector/util/Object.hpp>
5 
7 
8 namespace SurfaceInspector { namespace maths {
9 
17 template <typename T>
18 class Scalar : public Object{
19 public:
20  // *** GENERAL PURPOSE *** //
21  // ************************* //
27  static T factorial(T const n);
32  static T binom(T const n, T const k);
33 
34  // *** COMBINATORY *** //
35  // ********************* //
44  static T inline combinationsNoRepetition(T const n, T const k)
45  {return binom(n, k);}
54  static T inline combinationsRepetition(T const n, T const k)
55  {return binom(n+k-1, k);}
64  static T variationsNoRepetition(T const n, T const k);
73  static T inline variationsRepetition(T const n, T const k);
101  static T inline pow2(T const k)
102  {return ((T)1) << k;}
103 };
104 }}
105 
106 #include <surfaceinspector/maths/Scalar.tpp>
107 
108 #endif
Class providing common operations to work with scalars.
Definition: Scalar.hpp:18
static T binom(T const n, T const k)
Compute Newton binomial .
static T combinationsNoRepetition(T const n, T const k)
Compute combinations (order does not matter) of $fn @_fakenlk.
Definition: Scalar.hpp:44
static T factorial(T const n)
Compute the factorial of ( )
static T combinationsRepetition(T const n, T const k)
Compute combinations (order does not matter) of elements considering allowing repetitions.
Definition: Scalar.hpp:54
static T variationsNoRepetition(T const n, T const k)
Compute variations (order does matter) of elements considering with no repetitions.
static T pow2(T const k)
Compute the base power in a fast way. Notice this method only works with exponents and integer num...
Definition: Scalar.hpp:101
static T variationsRepetition(T const n, T const k)
Compute variations (order does matter) of elements considering with repetitions.
Class representing an object. All surface inspector classes must extend Object.
Definition: Object.hpp:12