CPP Linear Algebra ToolBox  0.1.0
utils.h File Reference
#include <cstdint>
#include <math.h>
#include <cassert>
#include <iostream>
#include <stdlib.h>
#include <random>
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

uint32_t triangular (uint16_t n)
 Compute \(n\)-th triangular number \(T_n\) defined by. More...
 
double uniform_distribution (double, double)
 Generate a random number using the uniform distribution. More...
 
double normal_distribution (double, double)
 Generate a random umber using the Gaussian distribution. More...
 

Detailed Description

Author
T. Schmoderer (iathe.nosp@m.na@m.nosp@m.ailo..nosp@m.com)
Version
0.1.0
Date
2022-10-13

Function Documentation

◆ normal_distribution()

double normal_distribution ( double  m = 0.,
double  s = 1. 
)

Generate a random umber using the Gaussian distribution.

Parameters
mMean value of the distribution, default \(m=0\).
sStandart deviation of the distribution, default \(s=1\).
Returns
double A random number picked following the Gaussian distribution \(\mathcal{N}(m,s)\).

◆ triangular()

uint32_t triangular ( uint16_t  n)
inline

Compute \(n\)-th triangular number \(T_n\) defined by.

\[ T_n = \frac{n(n+1)}{2}. \]

Parameters
nA nonnegative integer
Returns
uint32_t \(T_n\), \(n\)-th triangular number.

◆ uniform_distribution()

double uniform_distribution ( double  a = 0.,
double  b = 1. 
)

Generate a random number using the uniform distribution.

Parameters
aLower bound of the interval, default \(a=0\)
bUpper bound of the interval ( \(b > a\)), default \(b=1\).
Returns
double A random number picked uniformaly between \([a,b)\),