Some helper functions for Key.hpp.
More...
#include <vector>
#include <math.h>
#include <string>
#include <algorithm>
#include <sstream>
#include <complex>
|
| namespace | numbers |
| | Short handle for pi.
|
| |
|
| int | facut (int i) |
| | Recrusive definition of the faculty. Up to 12, this is just a look-up.
|
| |
| template<class R , class I > |
| R | binomialCoeff (I n, I k) |
| | Returns the binomial coefficient n over k. Shouldn't be used for large numbers and is only used for n<=12.
|
| |
|
|
const int | FACUT12 [13] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600} |
| | Pre-computed faculties up to 12! as this is the maximal number of photons in the circuit.
|
| |
|
const double | numbers::pi = 3.14159265358979323846 |
| |
Some helper functions for Key.hpp.
- Author
- Fabian Wiesner (fabia.nosp@m.n.wi.nosp@m.esner.nosp@m.97@g.nosp@m.mail..nosp@m.com)
- Version
- 0.1
- Date
- 2024-06-06
- Copyright
- None, this file only contains trivial common knowledge code.
◆ binomialCoeff()
template<class R , class I >
| R binomialCoeff |
( |
I | n, |
|
|
I | k ) |
Returns the binomial coefficient n over k. Shouldn't be used for large numbers and is only used for n<=12.
- Template Parameters
-
| R | Real-type for the output. |
| I | Integer number type used for input. |
- Parameters
-
| n | Upper number of the binomial coefficient, 0<=n<=12. |
| k | Lower number of the binomial coefficient, 0<=k<=n. |
- Returns
- R n over k.
◆ facut()
Recrusive definition of the faculty. Up to 12, this is just a look-up.
- Parameters
-
| i | Input to compute the faculty of. |
- Returns
- int The fuculty of i, i.e. i!.