spinn_common 7.1.1
Support code for SpiNNaker applications.
Loading...
Searching...
No Matches
Macros | Functions
normal.h File Reference

Normally-distributed random numbers. More...

#include <stdint.h>
#include <stdbool.h>
#include <stdfix.h>
#include "stdfix-full-iso.h"
#include "assert.h"

Go to the source code of this file.

Macros

#define norminv_fx(f)
 This function takes a uniformly distributed PRNG value, f, and returns a normally distributed s1615 PRNG.
 

Functions

int __norminv_rbits (int x)
 This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s16.15 in int representation.
 
static int __norminv_t_bits (int x)
 This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed 16-bit PRNG in int representation.
 
static int __norminv_b_bits (int x)
 This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed 16-bit PRNG in int representation.
 
static s1615 norminv_urb (unsigned int x)
 This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s1615 PRNG.
 
static s1615 norminv_urt (unsigned int x)
 This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s1615 PRNG.
 
static s1615 norminv_ur (u016 x)
 This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s1615 PRNG.
 
s1615 norminv_ulr (u032 x)
 This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s1615 PRNG.
 

Detailed Description

Normally-distributed random numbers.

Macro Definition Documentation

◆ norminv_fx

#define norminv_fx (   f)
Value:
_Generic((f), \
default: __builtin_trap() \
)
s1615 norminv_ulr(u032 x)
This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed ...
static s1615 norminv_ur(u016 x)
This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed ...
Definition normal.h:91
unsigned fract u016
An alternative name for the unsigned fract type.
Definition stdfix-full-iso.h:193
unsigned long fract u032
An alternative name for the unsigned long fract type.
Definition stdfix-full-iso.h:196

This function takes a uniformly distributed PRNG value, f, and returns a normally distributed s1615 PRNG.

Parameters
[in]fA uniformly distributed unsigned u016 or u032.
Returns
A normally distributed s1615 PRNG.

Function Documentation

◆ __norminv_rbits()

int __norminv_rbits ( int  x)

This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s16.15 in int representation.

Given an 16-bit signed integer value, representing p - 0.5, return the cumulative normal value associated with that probability.

Parameters
[in]xA uniformly distributed 16-bit PRNG, in the bottom 16 bits of x.
Returns
A normally distributed int representation of an s16.15 PRNG.

◆ __norminv_t_bits()

static int __norminv_t_bits ( int  x)
inlinestatic

This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed 16-bit PRNG in int representation.

Parameters
[in]xA uniformly distributed 16-bit PRNG, in the top 16 bits of x.
Returns
A normally distributed int representation of an s16.15 PRNG.

◆ __norminv_b_bits()

static int __norminv_b_bits ( int  x)
inlinestatic

This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed 16-bit PRNG in int representation.

Parameters
[in]xA uniformly distributed 16-bit PRNG, in the bottom 16 bits of x.
Returns
A normally distributed int representation of an s16.15 PRNG.

◆ norminv_urb()

static s1615 norminv_urb ( unsigned int  x)
inlinestatic

This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s1615 PRNG.

Parameters
[in]xA uniformly distributed 16-bit PRNG, in the bottom 16 bits of x.
Returns
A normally distributed s1615 PRNG.

◆ norminv_urt()

static s1615 norminv_urt ( unsigned int  x)
inlinestatic

This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s1615 PRNG.

Parameters
[in]xA uniformly distributed 16-bit PRNG, in the top 16 bits of x.
Returns
A normally distributed s1615 PRNG.

◆ norminv_ur()

static s1615 norminv_ur ( u016  x)
inlinestatic

This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s1615 PRNG.

Parameters
[in]xA uniformly distributed unsigned u016.
Returns
A normally distributed s1615 PRNG.

◆ norminv_ulr()

s1615 norminv_ulr ( u032  x)

This function takes a uniformly distributed 16-bit PRNG value, x, and returns a normally distributed s1615 PRNG.

Parameters
[in]xA uniformly distributed unsigned u032.
Returns
A normally distributed s1615 PRNG.