{"diffoscope-json-version": 1, "source1": "/srv/reproducible-results/rbuild-debian/r-b-build.Yl3iAYDF/b1/libbrahe_1.3.2-9_i386.changes", "source2": "/srv/reproducible-results/rbuild-debian/r-b-build.Yl3iAYDF/b2/libbrahe_1.3.2-9_i386.changes", "unified_diff": null, "details": [{"source1": "Files", "source2": "Files", "unified_diff": "@@ -1,4 +1,4 @@\n \n a5e3cd34298e4c79f9e6338d10f11b1d 18768 debug optional libbrahe-1.3-3-dbgsym_1.3.2-9_i386.deb\n 68585a0e3b7a5ad47d9f9f7d8b7fc8f3 14200 libs optional libbrahe-1.3-3_1.3.2-9_i386.deb\n- 12a0183cb88648711dd68f1f76754270 73316 libdevel optional libbrahe-dev_1.3.2-9_i386.deb\n+ 785923de78846bc38783965da2158cfe 73348 libdevel optional libbrahe-dev_1.3.2-9_i386.deb\n"}, {"source1": "libbrahe-dev_1.3.2-9_i386.deb", "source2": "libbrahe-dev_1.3.2-9_i386.deb", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -1,3 +1,3 @@\n -rw-r--r-- 0 0 0 4 2021-09-27 23:29:23.000000 debian-binary\n--rw-r--r-- 0 0 0 2748 2021-09-27 23:29:23.000000 control.tar.xz\n--rw-r--r-- 0 0 0 70376 2021-09-27 23:29:23.000000 data.tar.xz\n+-rw-r--r-- 0 0 0 2752 2021-09-27 23:29:23.000000 control.tar.xz\n+-rw-r--r-- 0 0 0 70404 2021-09-27 23:29:23.000000 data.tar.xz\n"}, {"source1": "control.tar.xz", "source2": "control.tar.xz", "unified_diff": null, "details": [{"source1": "control.tar", "source2": "control.tar", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "comments": ["Files differ"], "unified_diff": null}]}]}]}, {"source1": "data.tar.xz", "source2": "data.tar.xz", "unified_diff": null, "details": [{"source1": "data.tar", "source2": "data.tar", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -14,18 +14,18 @@\n -rw-r--r-- 0 root (0) root (0) 3545 2011-06-27 20:44:14.000000 ./usr/share/doc/libbrahe-dev/LicenseClosedSource.txt\n -rw-r--r-- 0 root (0) root (0) 1506 2011-06-27 20:43:04.000000 ./usr/share/doc/libbrahe-dev/LicenseOpenSource.txt\n -rw-r--r-- 0 root (0) root (0) 291 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/README.Debian\n -rw-r--r-- 0 root (0) root (0) 690 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/changelog.Debian.gz\n -rw-r--r-- 0 root (0) root (0) 943 2011-07-06 11:52:08.000000 ./usr/share/doc/libbrahe-dev/changelog.gz\n -rw-r--r-- 0 root (0) root (0) 2582 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/copyright\n drwxr-xr-x 0 root (0) root (0) 0 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/\n--rw-r--r-- 0 root (0) root (0) 24309 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00002.html\n--rw-r--r-- 0 root (0) root (0) 31810 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00002_source.html\n--rw-r--r-- 0 root (0) root (0) 67500 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00005.html\n--rw-r--r-- 0 root (0) root (0) 54861 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00005_source.html\n+-rw-r--r-- 0 root (0) root (0) 67500 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00002.html\n+-rw-r--r-- 0 root (0) root (0) 54861 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00002_source.html\n+-rw-r--r-- 0 root (0) root (0) 24309 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00005.html\n+-rw-r--r-- 0 root (0) root (0) 31810 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00005_source.html\n -rw-r--r-- 0 root (0) root (0) 6603 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00011.html\n -rw-r--r-- 0 root (0) root (0) 3842 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00015.html\n -rw-r--r-- 0 root (0) root (0) 8529 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/a00019.html\n -rw-r--r-- 0 root (0) root (0) 2125 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/annotated.html\n -rw-r--r-- 0 root (0) root (0) 676 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/bc_s.png\n -rw-r--r-- 0 root (0) root (0) 635 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/bc_sd.png\n -rw-r--r-- 0 root (0) root (0) 1438 2021-09-27 23:29:23.000000 ./usr/share/doc/libbrahe-dev/html/classes.html\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/a00002.html", "source2": "./usr/share/doc/libbrahe-dev/html/a00002.html", "unified_diff": "@@ -19,399 +19,1139 @@\n \n \n \n
\n
\n Data Structures |\n+Macros |\n+Typedefs |\n Enumerations |\n-Functions |\n-Variables
\n-
prng.h File Reference
\n+Functions
\n+
mathtools.h File Reference
\n \n
\n-
#include "mathtools.h"
\n+
#include <stddef.h>
\n+#include <math.h>
\n+#include <limits.h>
\n+#include <float.h>
\n+#include <stdbool.h>
\n+#include <stdint.h>
\n
\n

Go to the source code of this file.

\n \n \n-\n-\n+\n+\n \n+\n+\n+\n+

\n Data Structures

struct  brahe_prng_state_t
 Contains state variables for a PRNG. More...
struct  brahe_statistics_t
 Structure containing statistical values calculate from a double array. More...
 
struct  brahe_wave_factor_t
 Sine wave definition. More...
 
\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

\n+Macros

#define BRAHE_E   2.71828182845904523536028747135
 e (natural logarithm base
 
#define BRAHE_LOG2_E   1.44269504088896340735992468100
 log_2 (e)
 
#define BRAHE_LOG10_E   0.43429448190325182765112891892
 log_10 (e)
 
#define BRAHE_SQRT_2   1.41421356237309504880168872421
 sqrt(2)
 
#define BRAHE_SQRT_HALF   0.70710678118654752440084436210
 sqrt(1/2)
 
#define BRAHE_SQRT_3   1.73205080756887729352744634151
 sqrt(3)
 
#define BRAHE_PI   3.14159265358979323846264338328
 pi (180 deg)
 
#define BRAHE_TAU   6.28318530717958647692528676656
 tau (2 * pi)
 
#define BRAHE_PI_DIV_2   1.57079632679489661923132169164
 pi/2 (90 deg)
 
#define BRAHE_PI_DIV_3   1.04719755119659774615421446109
 pi/3 (60 deg)
 
#define BRAHE_PI_DIV_4   0.78539816339744830961566084582
 pi/4 (45 deg)
 
#define BRAHE_PI_DIV_6   0.52359877559829887307710723055
 pi/6 (30 deg)
 
#define BRAHE_PI_DIV_9   0.34906585039886591538473815370
 pi/9 (20 deg)
 
#define BRAHE_PI_DIV_12   0.26179938779914943653855361527
 pi / 12 (15 deg)
 
#define BRAHE_PI_DIV_18   0.17453292519943295769236907685
 pi / 18 (10 deg)
 
#define BRAHE_PI_DIV_36   0.08726646259971647884618453842
 pi / 36 (5 deg)
 
#define BRAHE_DEG_PER_RAD   57.2957795130823208767981548141
 degrees per radian
 
#define BRAHE_RAD_PER_DEG   0.01745329251994329576923690768
 radians per degree
 
#define BRAHE_SQRT_PI   1.77245385090551602729816748334
 sqrt(pi)
 
#define BRAHE_TWO_DIV_SQRT_PI   1.12837916709551257389615890312
 2/sqrt(pi)
 
#define BRAHE_ONE_DIV_PI   0.31830988618379067153776752675
 1/pi
 
#define BRAHE_TWO_DIV_PI   0.63661977236758134307553505349
 2/pi
 
#define BRAHE_LN_10   2.30258509299404568401799145468
 ln(10)
 
#define BRAHE_LN_2   0.69314718055994530941723212146
 ln(2)
 
#define BRAHE_LOG_2   0.30102999566398119521373889472
 log(2)
 
#define BRAHE_LN_PI   1.14472988584940017414342735135
 ln(pi)
 
#define BRAHE_EULER   0.57721566490153286060651209008
 Euler constant.
 
\n+\n+\n+\n+\n+\n+\n+\n

\n+Typedefs

typedef enum brahe_pretty_format_t brahe_pretty_format
 Formats for pretty-printing integers.
 
typedef struct brahe_statistics_t brahe_statistics
 Structure containing statistical values calculate from a double array.
 
\n \n-\n-\n-\n+\n+\n

\n Enumerations

enum  brahe_prng_type_t {
\n-  BRAHE_PRNG_MARSENNE_TWISTER = 0\n-, BRAHE_PRNG_KISS\n-, BRAHE_PRNG_CMWC4096\n-, BRAHE_PRNG_MWC1038\n-,
\n-  BRAHE_PRNG_ISAAC\n-
\n+
enum  brahe_pretty_format_t { BRAHE_PRETTY_TEXT\n+, BRAHE_PRETTY_COMMA\n }
 Defines types of prngs. More...
 
 Formats for pretty-printing integers. More...
 
\n \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

\n Functions

bool brahe_prng_init (brahe_prng_state_t *prng_state, const brahe_prng_type_t type, const uint32_t seed)
 Initialize a psuedo-random number generator (PRNG)
 
void brahe_prng_free (brahe_prng_state_t *prng_state)
 Free resources used by PRNG.
 
uint32_t brahe_prng_next (brahe_prng_state_t *prng_state)
 Get the next integer.
 
uint32_t brahe_prng_range (brahe_prng_state_t *prng_state, const uint32_t lo, const uint32_t hi)
 Get the next integer in the range [lo,hi].
 
size_t brahe_prng_index (brahe_prng_state_t *prng_state, const size_t length)
 Get the next random value as a size_t index.
 
double brahe_prng_real1 (brahe_prng_state_t *prng_state)
 Get the next number in the range [0,1].
 
double brahe_prng_real2 (brahe_prng_state_t *prng_state)
 Get the next number in the range [0,1)
 
double brahe_prng_real3 (brahe_prng_state_t *prng_state)
 Get the next number in the range (0,1)
 
double brahe_prng_real53 (brahe_prng_state_t *prng_state)
 Get the next number in the range [0,1)
 
\n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n

\n-Variables

static uint32_t BRAHE_UNKNOWN_SEED = 0
 
double brahe_round_nearest (const double x)
 Round to nearest value.
 
double brahe_sigdig (const double x, const uint16_t n)
 Set number of significant digits in a floating-point value.
 
uint64_t brahe_lcm (const uint64_t x, const uint64_t y)
 Lowest common multiple.
 
uint64_t brahe_gcf (uint64_t x, uint64_t y)
 Greatest common factor (denominator)
 
double brahe_log2base (const double x, const double base)
 Logarithm to a specified base.
 
int brahe_sizepow2 (const int n)
 Smallest power of 2 that includes a given value.
 
char * brahe_pretty_int (int64_t n, brahe_pretty_format fmt)
 Turn a 64-bit integer into a pretty string.
 
brahe_statistics brahe_get_statistics (double *data, size_t n)
 statistics for array of double
 
double * brahe_moving_average (const double *data, const int n, const int distance)
 Moving average.
 
double * brahe_simple_fft (const double *data, const int n)
 Simple real-to-real fft (arbitrary length)
 
double * brahe_simple_fft2 (const double *data, const int n)
 Simple real-to-real fft (power of 2 length)
 
double * brahe_make_sinusoid (const brahe_wave_factor_t *factors, const size_t factor_n, const size_t array_n)
 Sine wave based artificial signal generator.
 
void brahe_add_noise (double *a, const size_t n, double noise)
 Apply noise to a signal.
 
double brahe_asinh (const double x)
 Hyperbolic arcsine.
 
double brahe_acosh (const double x)
 Hyperbolic arccosine.
 
double brahe_atanh (const double x)
 Hyperbolic arctangent.
 
\n+

Macro Definition Documentation

\n+\n+

◆ BRAHE_DEG_PER_RAD

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_DEG_PER_RAD   57.2957795130823208767981548141
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_E

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_E   2.71828182845904523536028747135
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_EULER

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_EULER   0.57721566490153286060651209008
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_LN_10

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_LN_10   2.30258509299404568401799145468
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_LN_2

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_LN_2   0.69314718055994530941723212146
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_LN_PI

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_LN_PI   1.14472988584940017414342735135
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_LOG10_E

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_LOG10_E   0.43429448190325182765112891892
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_LOG2_E

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_LOG2_E   1.44269504088896340735992468100
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_LOG_2

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_LOG_2   0.30102999566398119521373889472
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_ONE_DIV_PI

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_ONE_DIV_PI   0.31830988618379067153776752675
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_PI

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_PI   3.14159265358979323846264338328
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_PI_DIV_12

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_PI_DIV_12   0.26179938779914943653855361527
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_PI_DIV_18

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_PI_DIV_18   0.17453292519943295769236907685
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_PI_DIV_2

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_PI_DIV_2   1.57079632679489661923132169164
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_PI_DIV_3

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_PI_DIV_3   1.04719755119659774615421446109
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_PI_DIV_36

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_PI_DIV_36   0.08726646259971647884618453842
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_PI_DIV_4

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_PI_DIV_4   0.78539816339744830961566084582
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_PI_DIV_6

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_PI_DIV_6   0.52359877559829887307710723055
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_PI_DIV_9

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_PI_DIV_9   0.34906585039886591538473815370
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_RAD_PER_DEG

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_RAD_PER_DEG   0.01745329251994329576923690768
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_SQRT_2

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_SQRT_2   1.41421356237309504880168872421
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_SQRT_3

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_SQRT_3   1.73205080756887729352744634151
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_SQRT_HALF

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_SQRT_HALF   0.70710678118654752440084436210
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_SQRT_PI

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_SQRT_PI   1.77245385090551602729816748334
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_TAU

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_TAU   6.28318530717958647692528676656
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_TWO_DIV_PI

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_TWO_DIV_PI   0.63661977236758134307553505349
\n+
\n+\n+
\n+
\n+\n+

◆ BRAHE_TWO_DIV_SQRT_PI

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
#define BRAHE_TWO_DIV_SQRT_PI   1.12837916709551257389615890312
\n+
\n+\n+
\n+
\n+

Typedef Documentation

\n+\n+

◆ brahe_pretty_format

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
typedef enum brahe_pretty_format_t brahe_pretty_format
\n+
\n+\n+
\n+
\n+\n+

◆ brahe_statistics

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+
typedef struct brahe_statistics_t brahe_statistics
\n+
\n+\n+
\n+
\n

Enumeration Type Documentation

\n-\n-

◆ brahe_prng_type_t

\n+\n+

◆ brahe_pretty_format_t

\n \n
\n
\n \n \n- \n+ \n \n
enum brahe_prng_type_tenum brahe_pretty_format_t
\n
\n \n-\n-\n-\n-\n-\n
Enumerator
BRAHE_PRNG_MARSENNE_TWISTER 

Marsenne Twister (Matsumoto & Nishimura)

\n-
BRAHE_PRNG_KISS 

Keep is Simple, Stupid (Marsaglia)

\n-
BRAHE_PRNG_CMWC4096 

CMWC4096 (Marsaglia)

\n-
BRAHE_PRNG_MWC1038 

MWC1038 (Marsaglia)

\n+
Enumerator
BRAHE_PRETTY_TEXT 

english text (nine thousand, two hundred eleven)

\n
BRAHE_PRNG_ISAAC 

Indirect, Shift, Accumulate, Add, and Count (Jenkins)

\n+
BRAHE_PRETTY_COMMA 

comma delimited, (1,234,567,890)

\n
\n \n
\n
\n

Function Documentation

\n-\n-

◆ brahe_prng_free()

\n+\n+

◆ brahe_acosh()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n \n \n
void brahe_prng_free double brahe_acosh (brahe_prng_state_tprng_state)const double x)
\n
\n-

Frees the resources used by a PRNG

Parameters
\n+

Calculates cosh-1.

Parameters
\n \n- \n+ \n
prng_stateObject containing the state of a PRNG
xa value
\n
\n
\n-
Returns
true if successful, false if failed
\n+
Returns
inverse hyperbolic cosine of x
\n \n
\n
\n-\n-

◆ brahe_prng_index()

\n+\n+

◆ brahe_add_noise()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n \n \n \n \n \n- \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n \n \n \n \n \n \n
size_t brahe_prng_index void brahe_add_noise (brahe_prng_state_tprng_state, double * a,
const size_t length n,
double noise 
)
\n
\n-

Returns the next value as a size_t \"index\" in the range [0,length).

Parameters
\n+

Adds a percentage of noise to a signal. If \"noise\" is set to 0.1 (for example) each value will be adjust to between 90% and 110% of its original value. This function changes the existing values in the array.

Parameters
\n \n- \n- \n+ \n+ \n+ \n
prng_stateObject containing the state of a PRNG
length- Maximum value of result
aarray containing signal data
nnumber of samples in signal
noisepercentage of noise
\n
\n
\n-
Returns
A pseudorandom size_t value
\n \n
\n
\n-\n-

◆ brahe_prng_init()

\n+\n+

◆ brahe_asinh()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n+ \n \n+
bool brahe_prng_init double brahe_asinh (brahe_prng_state_tprng_state, const double x)
\n+
\n+

Calculates sinh-1.

Parameters
\n+ \n+ \n+
xa value
\n+
\n+
\n+
Returns
inverse hyperbolic sine of x
\n+\n+
\n+
\n+\n+

◆ brahe_atanh()

\n+\n+
\n+
\n+ \n \n- \n+ \n+ \n+ \n+ \n \n- \n- \n+ \n+
double brahe_atanh (const double x)const brahe_prng_type_t type,
\n+
\n+

Calculates tanh-1.

Parameters
\n+ \n+ \n+
xa value
\n+
\n+
\n+
Returns
inverse hyperbolic tangent of x
\n+\n+
\n+
\n+\n+

◆ brahe_gcf()

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+ \n+ \n \n \n \n \n- \n- \n+ \n+ \n \n \n \n \n \n \n
uint64_t brahe_gcf (uint64_t x,
const uint32_t seed uint64_t y 
)
\n
\n-

Initializes a psuedo-random number generator using a specified algorithm.

Parameters
\n+

Calculates the greatest common factor for two values.

Parameters
\n \n- \n- \n- \n+ \n+ \n
prng_stateObject to be initialized for a specific algorithm
typeAlgorithm to be used for this PRNG
seedInitialization seed
xfirst value
ysecond value
\n
\n
\n-
Returns
true if successful, false if failed
\n+
Returns
The greatest common factor for x and y
\n \n
\n
\n-\n-

◆ brahe_prng_next()

\n+\n+

◆ brahe_get_statistics()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n+ \n+ \n+ \n \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n \n
uint32_t brahe_prng_next brahe_statistics brahe_get_statistics (brahe_prng_state_tprng_state)double * data,
size_t n 
)
\n
\n-

Returns the next uint32_t in sequence.

Parameters
\n+

Calculate several common statistics for an array of doubles.

Parameters
\n \n- \n+ \n+ \n
prng_stateObject containing the state of a PRNG
dataarray of double values
nnumber of elements in data
\n
\n
\n-
Returns
A pseudorandom uint32_t value
\n+
Returns
statistics for data
\n \n
\n
\n-\n-

◆ brahe_prng_range()

\n+\n+

◆ brahe_lcm()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n \n \n \n \n- \n- \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
uint32_t brahe_prng_range uint64_t brahe_lcm (brahe_prng_state_tprng_state, const uint64_t x,
const uint32_t lo, const uint64_t y 
)
\n+
\n+

Calculates the lowest common multiple for two values.

Parameters
\n+ \n+ \n+ \n+
xfirst value
ysecond value
\n+
\n+
\n+
Returns
The lowest common multiple for x and y
\n+\n+
\n+
\n+\n+

◆ brahe_log2base()

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+ \n+ \n \n \n \n \n- \n- \n+ \n+ \n \n \n \n \n \n \n
double brahe_log2base (const double x,
const uint32_t hi const double base 
)
\n
\n-

Returns the next int_value between lo and hi, inclusive.

Parameters
\n+

Calculates the base-n logarithm for a given value. If a range error occurs, the return value equals NaN.

Parameters
\n \n- \n- \n- \n+ \n+ \n
prng_stateObject containing the state of a PRNG
lo- Minimum value of result
hi- Maximum value of result
xvalue for which logarithm is required
baselagarithm base
\n
\n
\n-
Returns
A pseudorandom uint32_t value
\n+
Returns
logarithm of x to base base; NAN on range error
\n \n
\n
\n-\n-

◆ brahe_prng_real1()

\n+\n+

◆ brahe_make_sinusoid()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n \n+ \n+ \n \n
double brahe_prng_real1 double * brahe_make_sinusoid (brahe_prng_state_tprng_state)const brahe_wave_factor_tfactors,
const size_t factor_n,
const size_t array_n 
)
\n
\n-

Returns the next real number in the range [0,1], i.e., a number greater than or equal to 0 and less than or equal to 1. Provides 32-bit precision.

Parameters
\n+

Generates an array of doubles by combining sine waves. The primary purpose is to produce an artificial signal with known properties, for testing signal analysis applications. The caller is responsible for freeing the memory used by the array returned by this function.

Parameters
\n \n- \n+ \n+ \n+ \n
prng_stateObject containing the state of a PRNG
factorsdefines properties of the sine waves to be combined
factor_nnumber of elements in factors
array_nnumber of elements in the output array
\n
\n
\n-
Returns
A pseudorandom double value
\n+
Returns
an allocated array containg values generated from the given factors
\n \n
\n
\n-\n-

◆ brahe_prng_real2()

\n+\n+

◆ brahe_moving_average()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n \n+ \n+ \n \n
double brahe_prng_real2 double * brahe_moving_average (brahe_prng_state_tprng_state)const double * data,
const int n,
const int distance 
)
\n
\n-

Returns the next real number in the range [0,1), i.e., a number greater than or equal to 0 and less than 1. Provides 32-bit precision.

Parameters
\n+

Computes the moving average for an array. The returned buffer must be freed by the calling code.

Parameters
\n \n- \n+ \n+ \n+ \n
prng_stateObject containing the state of a PRNG
dataarray of double values to be averaged
nnumber of elements in data
distancenumber elements to average before and after an element in data
\n
\n
\n-
Returns
A pseudorandom double value
\n+
Returns
an allocated n-length array containing the moving average of corresponding elements in data
\n \n
\n
\n-\n-

◆ brahe_prng_real3()

\n+\n+

◆ brahe_pretty_int()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n \n+ \n+ \n \n
double brahe_prng_real3 char * brahe_pretty_int (brahe_prng_state_tprng_state)int64_t n,
brahe_pretty_format fmt 
)
\n
\n-

Returns the next real number in the range (0,1), i.e., a number greater than 0 and less than 1. Provides 32-bit precision.

Parameters
\n+

Returns a nicely formatted strong for a given 64-bit integer.

Parameters
\n \n- \n+ \n+ \n
prng_stateObject containing the state of a PRNG
nnumber to be formatted
fmtspecifies format, as text or comma-delimited
\n
\n
\n-
Returns
A pseudorandom double value
\n+
Returns
an allocated string containing the generated text
\n \n
\n
\n-\n-

◆ brahe_prng_real53()

\n+\n+

◆ brahe_round_nearest()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n \n \n
double brahe_prng_real53 double brahe_round_nearest (brahe_prng_state_tprng_state)const double x)
\n
\n-

Returns the next real number in the range [0,1), i.e., a number greater than or equal to 0 and less than 1. Provides 53-bit precision.

Parameters
\n+

Rounds a value to nearest integer, rounding to even for exact fractions of 0.5.

\n+\n+
\n+
\n+\n+

◆ brahe_sigdig()

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
double brahe_sigdig (const double x,
const uint16_t n 
)
\n+
\n+

Returns the given value rounded for the number of specified decimal digits of precision.

Parameters
\n \n- \n+ \n+ \n
prng_stateObject containing the state of a PRNG
x- Original value to be rounded
n- Number of significant digits
\n
\n
\n-
Returns
A pseudorandom double value
\n+
Returns
The value x rounded to n digits of precision
\n \n
\n
\n-

Variable Documentation

\n-\n-

◆ BRAHE_UNKNOWN_SEED

\n+\n+

◆ brahe_simple_fft()

\n \n
\n
\n-\n- \n- \n- \n- \n-
\n \n \n- \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n \n
uint32_t BRAHE_UNKNOWN_SEED = 0double * brahe_simple_fft (const double * data,
const int n 
)
\n-
\n-static
\n
\n+

A simple real-to-real FFT for arbitrary-length data. This is not intended to replace dedicated libraries such as FFTW. The caller is responsible for freeing the memory used by the array returned by this function. /param data input array /param n length of data /return an allocated array containing the real FFT of data

\n+\n+
\n+
\n+\n+

◆ brahe_simple_fft2()

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
double * brahe_simple_fft2 (const double * data,
const int n 
)
\n+
\n+

A simple real-to-real FFT for power of 2-length data. This is not intended to replace dedicated libraries such as FFTW. The caller is responsible for freeing the memory used by the array returned by this function. /param data input array /param n length of data /return an allocated array containing the real FFT of data

\n+\n+
\n+
\n+\n+

◆ brahe_sizepow2()

\n+\n+
\n+
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+
int brahe_sizepow2 (const int n)
\n+
\n+

Returns the smallest power of 2 that includes n in its range

Parameters
\n+ \n+ \n+
nnumber that must be less than the result
\n+
\n+
\n+
Returns
the lowest power of 2 that is greater than n, or
\n \n
\n
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,153 +1,390 @@\n ****** Brahe - a heterogenous collection of mathematical tools ******\n ***** Main_Index\n Home_Page *****\n Created by Scott_Robert_Ladd\n ===============================================================================\n * src\n-Data_Structures | Enumerations | Functions | Variables\n-prng.h File Reference\n-#include \"mathtools.h\"\n+Data_Structures | Macros | Typedefs | Enumerations | Functions\n+mathtools.h File Reference\n+#include \n+#include \n+#include \n+#include \n+#include \n+#include \n Go_to_the_source_code_of_this_file.\n Data Structures\n-struct \u00a0brahe_prng_state_t\n-\u00a0 Contains state variables for a PRNG. More...\n+struct \u00a0brahe_statistics_t\n+\u00a0 Structure containing statistical values calculate from a double array.\n+ More...\n \u00a0\n- Enumerations\n-enum brahe_prng_type_t {\n- \u00a0\u00a0\u00a0BRAHE_PRNG_MARSENNE_TWISTER = 0 , BRAHE_PRNG_KISS , BRAHE_PRNG_CMWC4096 ,\n- BRAHE_PRNG_MWC1038 ,\n- \u00a0\u00a0BRAHE_PRNG_ISAAC\n- }\n-\u00a0 Defines types of prngs. More...\n+struct \u00a0brahe_wave_factor_t\n+\u00a0 Sine wave definition. More...\n \u00a0\n- Functions\n- bool\u00a0brahe_prng_init (brahe_prng_state_t *prng_state, const\n- brahe_prng_type_t type, const uint32_t seed)\n-\u00a0 Initialize a psuedo-random number generator (PRNG)\n+ Macros\n+#define\u00a0BRAHE_E\u00a0\u00a0\u00a02.71828182845904523536028747135\n+\u00a0 e (natural logarithm base\n+\u00a0\n+#define\u00a0BRAHE_LOG2_E\u00a0\u00a0\u00a01.44269504088896340735992468100\n+\u00a0 log_2 (e)\n+\u00a0\n+#define\u00a0BRAHE_LOG10_E\u00a0\u00a0\u00a00.43429448190325182765112891892\n+\u00a0 log_10 (e)\n+\u00a0\n+#define\u00a0BRAHE_SQRT_2\u00a0\u00a0\u00a01.41421356237309504880168872421\n+\u00a0 sqrt(2)\n+\u00a0\n+#define\u00a0BRAHE_SQRT_HALF\u00a0\u00a0\u00a00.70710678118654752440084436210\n+\u00a0 sqrt(1/2)\n+\u00a0\n+#define\u00a0BRAHE_SQRT_3\u00a0\u00a0\u00a01.73205080756887729352744634151\n+\u00a0 sqrt(3)\n+\u00a0\n+#define\u00a0BRAHE_PI\u00a0\u00a0\u00a03.14159265358979323846264338328\n+\u00a0 pi (180 deg)\n+\u00a0\n+#define\u00a0BRAHE_TAU\u00a0\u00a0\u00a06.28318530717958647692528676656\n+\u00a0 tau (2 * pi)\n+\u00a0\n+#define\u00a0BRAHE_PI_DIV_2\u00a0\u00a0\u00a01.57079632679489661923132169164\n+\u00a0 pi/2 (90 deg)\n+\u00a0\n+#define\u00a0BRAHE_PI_DIV_3\u00a0\u00a0\u00a01.04719755119659774615421446109\n+\u00a0 pi/3 (60 deg)\n+\u00a0\n+#define\u00a0BRAHE_PI_DIV_4\u00a0\u00a0\u00a00.78539816339744830961566084582\n+\u00a0 pi/4 (45 deg)\n+\u00a0\n+#define\u00a0BRAHE_PI_DIV_6\u00a0\u00a0\u00a00.52359877559829887307710723055\n+\u00a0 pi/6 (30 deg)\n+\u00a0\n+#define\u00a0BRAHE_PI_DIV_9\u00a0\u00a0\u00a00.34906585039886591538473815370\n+\u00a0 pi/9 (20 deg)\n+\u00a0\n+#define\u00a0BRAHE_PI_DIV_12\u00a0\u00a0\u00a00.26179938779914943653855361527\n+\u00a0 pi / 12 (15 deg)\n+\u00a0\n+#define\u00a0BRAHE_PI_DIV_18\u00a0\u00a0\u00a00.17453292519943295769236907685\n+\u00a0 pi / 18 (10 deg)\n+\u00a0\n+#define\u00a0BRAHE_PI_DIV_36\u00a0\u00a0\u00a00.08726646259971647884618453842\n+\u00a0 pi / 36 (5 deg)\n+\u00a0\n+#define\u00a0BRAHE_DEG_PER_RAD\u00a0\u00a0\u00a057.2957795130823208767981548141\n+\u00a0 degrees per radian\n+\u00a0\n+#define\u00a0BRAHE_RAD_PER_DEG\u00a0\u00a0\u00a00.01745329251994329576923690768\n+\u00a0 radians per degree\n+\u00a0\n+#define\u00a0BRAHE_SQRT_PI\u00a0\u00a0\u00a01.77245385090551602729816748334\n+\u00a0 sqrt(pi)\n+\u00a0\n+#define\u00a0BRAHE_TWO_DIV_SQRT_PI\u00a0\u00a0\u00a01.12837916709551257389615890312\n+\u00a0 2/sqrt(pi)\n+\u00a0\n+#define\u00a0BRAHE_ONE_DIV_PI\u00a0\u00a0\u00a00.31830988618379067153776752675\n+\u00a0 1/pi\n+\u00a0\n+#define\u00a0BRAHE_TWO_DIV_PI\u00a0\u00a0\u00a00.63661977236758134307553505349\n+\u00a0 2/pi\n+\u00a0\n+#define\u00a0BRAHE_LN_10\u00a0\u00a0\u00a02.30258509299404568401799145468\n+\u00a0 ln(10)\n+\u00a0\n+#define\u00a0BRAHE_LN_2\u00a0\u00a0\u00a00.69314718055994530941723212146\n+\u00a0 ln(2)\n \u00a0\n- void\u00a0brahe_prng_free (brahe_prng_state_t *prng_state)\n-\u00a0 Free resources used by PRNG.\n+#define\u00a0BRAHE_LOG_2\u00a0\u00a0\u00a00.30102999566398119521373889472\n+\u00a0 log(2)\n \u00a0\n-uint32_t\u00a0brahe_prng_next (brahe_prng_state_t *prng_state)\n-\u00a0 Get the next integer.\n+#define\u00a0BRAHE_LN_PI\u00a0\u00a0\u00a01.14472988584940017414342735135\n+\u00a0 ln(pi)\n \u00a0\n-uint32_t\u00a0brahe_prng_range (brahe_prng_state_t *prng_state, const uint32_t lo,\n- const uint32_t hi)\n-\u00a0 Get the next integer in the range [lo,hi].\n+#define\u00a0BRAHE_EULER\u00a0\u00a0\u00a00.57721566490153286060651209008\n+\u00a0 Euler constant.\n \u00a0\n- size_t\u00a0brahe_prng_index (brahe_prng_state_t *prng_state, const size_t\n- length)\n-\u00a0 Get the next random value as a size_t index.\n+ Typedefs\n+typedef enum brahe_pretty_format_t\u00a0brahe_pretty_format\n+\u00a0 Formats for pretty-printing integers.\n \u00a0\n- double\u00a0brahe_prng_real1 (brahe_prng_state_t *prng_state)\n-\u00a0 Get the next number in the range [0,1].\n+ typedef struct brahe_statistics_t\u00a0brahe_statistics\n+\u00a0 Structure containing statistical values\n+ calculate from a double array.\n \u00a0\n- double\u00a0brahe_prng_real2 (brahe_prng_state_t *prng_state)\n-\u00a0 Get the next number in the range [0,1)\n+ Enumerations\n+enum \u00a0brahe_pretty_format_t { BRAHE_PRETTY_TEXT , BRAHE_PRETTY_COMMA }\n+\u00a0 Formats for pretty-printing integers. More...\n \u00a0\n- double\u00a0brahe_prng_real3 (brahe_prng_state_t *prng_state)\n-\u00a0 Get the next number in the range (0,1)\n+ Functions\n+ double\u00a0brahe_round_nearest (const double x)\n+\u00a0 Round to nearest value.\n \u00a0\n- double\u00a0brahe_prng_real53 (brahe_prng_state_t *prng_state)\n-\u00a0 Get the next number in the range [0,1)\n+ double\u00a0brahe_sigdig (const double x, const uint16_t n)\n+\u00a0 Set number of significant digits in a floating-point value.\n \u00a0\n- Variables\n-static uint32_t\u00a0BRAHE_UNKNOWN_SEED = 0\n+ uint64_t\u00a0brahe_lcm (const uint64_t x, const uint64_t y)\n+\u00a0 Lowest common multiple.\n \u00a0\n+ uint64_t\u00a0brahe_gcf (uint64_t x, uint64_t y)\n+\u00a0 Greatest common factor (denominator)\n+\u00a0\n+ double\u00a0brahe_log2base (const double x, const double base)\n+\u00a0 Logarithm to a specified base.\n+\u00a0\n+ int\u00a0brahe_sizepow2 (const int n)\n+\u00a0 Smallest power of 2 that includes a given value.\n+\u00a0\n+ char *\u00a0brahe_pretty_int (int64_t n, brahe_pretty_format fmt)\n+\u00a0 Turn a 64-bit integer into a pretty string.\n+\u00a0\n+brahe_statistics\u00a0brahe_get_statistics (double *data, size_t n)\n+\u00a0 statistics for array of double\n+\u00a0\n+ double *\u00a0brahe_moving_average (const double *data, const int n, const\n+ int distance)\n+\u00a0 Moving average.\n+\u00a0\n+ double *\u00a0brahe_simple_fft (const double *data, const int n)\n+\u00a0 Simple real-to-real fft (arbitrary length)\n+\u00a0\n+ double *\u00a0brahe_simple_fft2 (const double *data, const int n)\n+\u00a0 Simple real-to-real fft (power of 2 length)\n+\u00a0\n+ double *\u00a0brahe_make_sinusoid (const brahe_wave_factor_t *factors,\n+ const size_t factor_n, const size_t array_n)\n+\u00a0 Sine wave based artificial signal generator.\n+\u00a0\n+ void\u00a0brahe_add_noise (double *a, const size_t n, double noise)\n+\u00a0 Apply noise to a signal.\n+\u00a0\n+ double\u00a0brahe_asinh (const double x)\n+\u00a0 Hyperbolic arcsine.\n+\u00a0\n+ double\u00a0brahe_acosh (const double x)\n+\u00a0 Hyperbolic arccosine.\n+\u00a0\n+ double\u00a0brahe_atanh (const double x)\n+\u00a0 Hyperbolic arctangent.\n+\u00a0\n+***** Macro Definition Documentation *****\n+***** \u25c6\u00a0BRAHE_DEG_PER_RAD *****\n+#define BRAHE_DEG_PER_RAD\u00a0\u00a0\u00a057.2957795130823208767981548141\n+***** \u25c6\u00a0BRAHE_E *****\n+#define BRAHE_E\u00a0\u00a0\u00a02.71828182845904523536028747135\n+***** \u25c6\u00a0BRAHE_EULER *****\n+#define BRAHE_EULER\u00a0\u00a0\u00a00.57721566490153286060651209008\n+***** \u25c6\u00a0BRAHE_LN_10 *****\n+#define BRAHE_LN_10\u00a0\u00a0\u00a02.30258509299404568401799145468\n+***** \u25c6\u00a0BRAHE_LN_2 *****\n+#define BRAHE_LN_2\u00a0\u00a0\u00a00.69314718055994530941723212146\n+***** \u25c6\u00a0BRAHE_LN_PI *****\n+#define BRAHE_LN_PI\u00a0\u00a0\u00a01.14472988584940017414342735135\n+***** \u25c6\u00a0BRAHE_LOG10_E *****\n+#define BRAHE_LOG10_E\u00a0\u00a0\u00a00.43429448190325182765112891892\n+***** \u25c6\u00a0BRAHE_LOG2_E *****\n+#define BRAHE_LOG2_E\u00a0\u00a0\u00a01.44269504088896340735992468100\n+***** \u25c6\u00a0BRAHE_LOG_2 *****\n+#define BRAHE_LOG_2\u00a0\u00a0\u00a00.30102999566398119521373889472\n+***** \u25c6\u00a0BRAHE_ONE_DIV_PI *****\n+#define BRAHE_ONE_DIV_PI\u00a0\u00a0\u00a00.31830988618379067153776752675\n+***** \u25c6\u00a0BRAHE_PI *****\n+#define BRAHE_PI\u00a0\u00a0\u00a03.14159265358979323846264338328\n+***** \u25c6\u00a0BRAHE_PI_DIV_12 *****\n+#define BRAHE_PI_DIV_12\u00a0\u00a0\u00a00.26179938779914943653855361527\n+***** \u25c6\u00a0BRAHE_PI_DIV_18 *****\n+#define BRAHE_PI_DIV_18\u00a0\u00a0\u00a00.17453292519943295769236907685\n+***** \u25c6\u00a0BRAHE_PI_DIV_2 *****\n+#define BRAHE_PI_DIV_2\u00a0\u00a0\u00a01.57079632679489661923132169164\n+***** \u25c6\u00a0BRAHE_PI_DIV_3 *****\n+#define BRAHE_PI_DIV_3\u00a0\u00a0\u00a01.04719755119659774615421446109\n+***** \u25c6\u00a0BRAHE_PI_DIV_36 *****\n+#define BRAHE_PI_DIV_36\u00a0\u00a0\u00a00.08726646259971647884618453842\n+***** \u25c6\u00a0BRAHE_PI_DIV_4 *****\n+#define BRAHE_PI_DIV_4\u00a0\u00a0\u00a00.78539816339744830961566084582\n+***** \u25c6\u00a0BRAHE_PI_DIV_6 *****\n+#define BRAHE_PI_DIV_6\u00a0\u00a0\u00a00.52359877559829887307710723055\n+***** \u25c6\u00a0BRAHE_PI_DIV_9 *****\n+#define BRAHE_PI_DIV_9\u00a0\u00a0\u00a00.34906585039886591538473815370\n+***** \u25c6\u00a0BRAHE_RAD_PER_DEG *****\n+#define BRAHE_RAD_PER_DEG\u00a0\u00a0\u00a00.01745329251994329576923690768\n+***** \u25c6\u00a0BRAHE_SQRT_2 *****\n+#define BRAHE_SQRT_2\u00a0\u00a0\u00a01.41421356237309504880168872421\n+***** \u25c6\u00a0BRAHE_SQRT_3 *****\n+#define BRAHE_SQRT_3\u00a0\u00a0\u00a01.73205080756887729352744634151\n+***** \u25c6\u00a0BRAHE_SQRT_HALF *****\n+#define BRAHE_SQRT_HALF\u00a0\u00a0\u00a00.70710678118654752440084436210\n+***** \u25c6\u00a0BRAHE_SQRT_PI *****\n+#define BRAHE_SQRT_PI\u00a0\u00a0\u00a01.77245385090551602729816748334\n+***** \u25c6\u00a0BRAHE_TAU *****\n+#define BRAHE_TAU\u00a0\u00a0\u00a06.28318530717958647692528676656\n+***** \u25c6\u00a0BRAHE_TWO_DIV_PI *****\n+#define BRAHE_TWO_DIV_PI\u00a0\u00a0\u00a00.63661977236758134307553505349\n+***** \u25c6\u00a0BRAHE_TWO_DIV_SQRT_PI *****\n+#define BRAHE_TWO_DIV_SQRT_PI\u00a0\u00a0\u00a01.12837916709551257389615890312\n+***** Typedef Documentation *****\n+***** \u25c6\u00a0brahe_pretty_format *****\n+typedef enum brahe_pretty_format_t brahe_pretty_format\n+***** \u25c6\u00a0brahe_statistics *****\n+typedef struct brahe_statistics_t brahe_statistics\n ***** Enumeration Type Documentation *****\n-***** \u25c6\u00a0brahe_prng_type_t *****\n-enum brahe_prng_type_t\n+***** \u25c6\u00a0brahe_pretty_format_t *****\n+enum brahe_pretty_format_t\n Enumerator\n-BRAHE_PRNG_MARSENNE_TWISTER\u00a0Marsenne Twister (Matsumoto & Nishimura)\n-BRAHE_PRNG_KISS\u00a0 Keep is Simple, Stupid (Marsaglia)\n-BRAHE_PRNG_CMWC4096\u00a0 CMWC4096 (Marsaglia)\n-BRAHE_PRNG_MWC1038\u00a0 MWC1038 (Marsaglia)\n-BRAHE_PRNG_ISAAC\u00a0 Indirect, Shift, Accumulate, Add, and Count\n- (Jenkins)\n+BRAHE_PRETTY_TEXT\u00a0 english text (nine thousand, two hundred eleven)\n+BRAHE_PRETTY_COMMA\u00a0comma delimited, (1,234,567,890)\n ***** Function Documentation *****\n-***** \u25c6\u00a0brahe_prng_free() *****\n-void brahe_prng_free ( brahe_prng_state_t *\u00a0prng_state )\n-Frees the resources used by a PRNG\n- Parameters\n- prng_state Object containing the state of a PRNG\n- Returns\n- true if successful, false if failed\n-***** \u25c6\u00a0brahe_prng_index() *****\n-size_t brahe_prng_index ( brahe_prng_state_t *\u00a0prng_state,\n- const size_t\u00a0 length\u00a0\n- )\n-Returns the next value as a size_t \"index\" in the range [0,length).\n+***** \u25c6\u00a0brahe_acosh() *****\n+double brahe_acosh ( const double\u00a0x )\n+Calculates cosh-1.\n Parameters\n- prng_state Object containing the state of a PRNG\n- length - Maximum value of result\n+ x a value\n Returns\n- A pseudorandom size_t value\n-***** \u25c6\u00a0brahe_prng_init() *****\n-bool brahe_prng_init ( brahe_prng_state_t *\u00a0 prng_state,\n- const brahe_prng_type_t\u00a0type,\n- const uint32_t\u00a0 seed\u00a0\n+ inverse hyperbolic cosine of x\n+***** \u25c6\u00a0brahe_add_noise() *****\n+void brahe_add_noise ( double *\u00a0 a,\n+ const size_t\u00a0n,\n+ double\u00a0 noise\u00a0\n )\n-Initializes a psuedo-random number generator using a specified algorithm.\n+Adds a percentage of noise to a signal. If \"noise\" is set to 0.1 (for example)\n+each value will be adjust to between 90% and 110% of its original value. This\n+function changes the existing values in the array.\n+ Parameters\n+ a array containing signal data\n+ n number of samples in signal\n+ noise percentage of noise\n+***** \u25c6\u00a0brahe_asinh() *****\n+double brahe_asinh ( const double\u00a0x )\n+Calculates sinh-1.\n Parameters\n- prng_state Object to be initialized for a specific algorithm\n- type Algorithm to be used for this PRNG\n- seed Initialization seed\n- Returns\n- true if successful, false if failed\n-***** \u25c6\u00a0brahe_prng_next() *****\n-uint32_t brahe_prng_next ( brahe_prng_state_t *\u00a0prng_state )\n-Returns the next uint32_t in sequence.\n- Parameters\n- prng_state Object containing the state of a PRNG\n- Returns\n- A pseudorandom uint32_t value\n-***** \u25c6\u00a0brahe_prng_range() *****\n-uint32_t brahe_prng_range ( brahe_prng_state_t *\u00a0prng_state,\n- const uint32_t\u00a0 lo,\n- const uint32_t\u00a0 hi\u00a0\n+ x a value\n+ Returns\n+ inverse hyperbolic sine of x\n+***** \u25c6\u00a0brahe_atanh() *****\n+double brahe_atanh ( const double\u00a0x )\n+Calculates tanh-1.\n+ Parameters\n+ x a value\n+ Returns\n+ inverse hyperbolic tangent of x\n+***** \u25c6\u00a0brahe_gcf() *****\n+uint64_t brahe_gcf ( uint64_t\u00a0x,\n+ uint64_t\u00a0y\u00a0\n+ )\n+Calculates the greatest common factor for two values.\n+ Parameters\n+ x first value\n+ y second value\n+ Returns\n+ The greatest common factor for x and y\n+***** \u25c6\u00a0brahe_get_statistics() *****\n+brahe_statistics brahe_get_statistics ( double *\u00a0data,\n+ size_t\u00a0 n\u00a0\n+ )\n+Calculate several common statistics for an array of doubles.\n+ Parameters\n+ data array of double values\n+ n number of elements in data\n+ Returns\n+ statistics for data\n+***** \u25c6\u00a0brahe_lcm() *****\n+uint64_t brahe_lcm ( const uint64_t\u00a0x,\n+ const uint64_t\u00a0y\u00a0\n+ )\n+Calculates the lowest common multiple for two values.\n+ Parameters\n+ x first value\n+ y second value\n+ Returns\n+ The lowest common multiple for x and y\n+***** \u25c6\u00a0brahe_log2base() *****\n+double brahe_log2base ( const double\u00a0x,\n+ const double\u00a0base\u00a0\n+ )\n+Calculates the base-n logarithm for a given value. If a range error occurs, the\n+return value equals NaN.\n+ Parameters\n+ x value for which logarithm is required\n+ base lagarithm base\n+ Returns\n+ logarithm of x to base base; NAN on range error\n+***** \u25c6\u00a0brahe_make_sinusoid() *****\n+double * brahe_make_sinusoid ( const brahe_wave_factor_t *\u00a0factors,\n+ const size_t\u00a0 factor_n,\n+ const size_t\u00a0 array_n\u00a0\n+ )\n+Generates an array of doubles by combining sine waves. The primary purpose is\n+to produce an artificial signal with known properties, for testing signal\n+analysis applications. The caller is responsible for freeing the memory used by\n+the array returned by this function.\n+ Parameters\n+ factors defines properties of the sine waves to be combined\n+ factor_n number of elements in factors\n+ array_n number of elements in the output array\n+ Returns\n+ an allocated array containg values generated from the given factors\n+***** \u25c6\u00a0brahe_moving_average() *****\n+double * brahe_moving_average ( const double *\u00a0data,\n+ const int\u00a0 n,\n+ const int\u00a0 distance\u00a0\n+ )\n+Computes the moving average for an array. The returned buffer must be freed by\n+the calling code.\n+ Parameters\n+ data array of double values to be averaged\n+ n number of elements in data\n+ distance number elements to average before and after an element in data\n+ Returns\n+ an allocated n-length array containing the moving average of\n+ corresponding elements in data\n+***** \u25c6\u00a0brahe_pretty_int() *****\n+char * brahe_pretty_int ( int64_t\u00a0 n,\n+ brahe_pretty_format\u00a0fmt\u00a0\n+ )\n+Returns a nicely formatted strong for a given 64-bit integer.\n+ Parameters\n+ n number to be formatted\n+ fmt specifies format, as text or comma-delimited\n+ Returns\n+ an allocated string containing the generated text\n+***** \u25c6\u00a0brahe_round_nearest() *****\n+double brahe_round_nearest ( const double\u00a0x )\n+Rounds a value to nearest integer, rounding to even for exact fractions of 0.5.\n+***** \u25c6\u00a0brahe_sigdig() *****\n+double brahe_sigdig ( const double\u00a0 x,\n+ const uint16_t\u00a0n\u00a0\n+ )\n+Returns the given value rounded for the number of specified decimal digits of\n+precision.\n+ Parameters\n+ x - Original value to be rounded\n+ n - Number of significant digits\n+ Returns\n+ The value x rounded to n digits of precision\n+***** \u25c6\u00a0brahe_simple_fft() *****\n+double * brahe_simple_fft ( const double *\u00a0data,\n+ const int\u00a0 n\u00a0\n )\n-Returns the next int_value between lo and hi, inclusive.\n+A simple real-to-real FFT for arbitrary-length data. This is not intended to\n+replace dedicated libraries such as FFTW. The caller is responsible for freeing\n+the memory used by the array returned by this function. /param data input array\n+/param n length of data /return an allocated array containing the real FFT of\n+data\n+***** \u25c6\u00a0brahe_simple_fft2() *****\n+double * brahe_simple_fft2 ( const double *\u00a0data,\n+ const int\u00a0 n\u00a0\n+ )\n+A simple real-to-real FFT for power of 2-length data. This is not intended to\n+replace dedicated libraries such as FFTW. The caller is responsible for freeing\n+the memory used by the array returned by this function. /param data input array\n+/param n length of data /return an allocated array containing the real FFT of\n+data\n+***** \u25c6\u00a0brahe_sizepow2() *****\n+int brahe_sizepow2 ( const int\u00a0n )\n+Returns the smallest power of 2 that includes n in its range\n Parameters\n- prng_state Object containing the state of a PRNG\n- lo - Minimum value of result\n- hi - Maximum value of result\n- Returns\n- A pseudorandom uint32_t value\n-***** \u25c6\u00a0brahe_prng_real1() *****\n-double brahe_prng_real1 ( brahe_prng_state_t *\u00a0prng_state )\n-Returns the next real number in the range [0,1], i.e., a number greater than or\n-equal to 0 and less than or equal to 1. Provides 32-bit precision.\n- Parameters\n- prng_state Object containing the state of a PRNG\n- Returns\n- A pseudorandom double value\n-***** \u25c6\u00a0brahe_prng_real2() *****\n-double brahe_prng_real2 ( brahe_prng_state_t *\u00a0prng_state )\n-Returns the next real number in the range [0,1), i.e., a number greater than or\n-equal to 0 and less than 1. Provides 32-bit precision.\n- Parameters\n- prng_state Object containing the state of a PRNG\n- Returns\n- A pseudorandom double value\n-***** \u25c6\u00a0brahe_prng_real3() *****\n-double brahe_prng_real3 ( brahe_prng_state_t *\u00a0prng_state )\n-Returns the next real number in the range (0,1), i.e., a number greater than 0\n-and less than 1. Provides 32-bit precision.\n- Parameters\n- prng_state Object containing the state of a PRNG\n- Returns\n- A pseudorandom double value\n-***** \u25c6\u00a0brahe_prng_real53() *****\n-double brahe_prng_real53 ( brahe_prng_state_t *\u00a0prng_state )\n-Returns the next real number in the range [0,1), i.e., a number greater than or\n-equal to 0 and less than 1. Provides 53-bit precision.\n- Parameters\n- prng_state Object containing the state of a PRNG\n- Returns\n- A pseudorandom double value\n-***** Variable Documentation *****\n-***** \u25c6\u00a0BRAHE_UNKNOWN_SEED *****\n-uint32_t BRAHE_UNKNOWN_SEED = 0 static\n+ n number that must be less than the result\n+ Returns\n+ the lowest power of 2 that is greater than n, or\n ===============================================================================\n \u00a9 2011 Scott Robert Ladd. All rights reserved.\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n"}]}, {"source1": "./usr/share/doc/libbrahe-dev/html/a00002_source.html", "source2": "./usr/share/doc/libbrahe-dev/html/a00002_source.html", "unified_diff": "@@ -17,15 +17,15 @@\n \n

\n \n
\n
\n
\n-
prng.h
\n+
mathtools.h
\n
\n
\n Go to the documentation of this file.
1/*
\n
2 Brahe is a heterogenous collection of mathematical tools, written in Standard C.
\n
3
\n
4 Copyright 2011 Scott Robert Ladd. All rights reserved.
\n
5
\n@@ -72,108 +72,246 @@\n
46 The author can be contacted at:
\n
47
\n
48 scott.ladd@coyotegulch.com
\n
49 scott.ladd@gmail.com
\n
50 http:www.coyotegulch.com
\n
51*/
\n
52
\n-
53#if !defined(LIBBRAHE_PRNG_H)
\n-
54#define LIBBRAHE_PRNG_H
\n+
53#if !defined(LIBBRAHE_MATHTOOLS_H)
\n+
54#define LIBBRAHE_MATHTOOLS_H
\n
55
\n-
56#include "mathtools.h"
\n-
57
\n-
58#if defined(__cplusplus)
\n-
59extern "C" {
\n-
60#endif
\n-
61
\n-\n-
76
\n-
\n-
78typedef struct
\n-
79{
\n-
80 brahe_prng_type_t m_type; // the algorithm we're using
\n-
81 uint32_t m_seed; // "seed" that defines the sequence
\n-
82 void * m_data1; // array or table
\n-
83 void * m_data2; // additional array or table
\n-
84 size_t m_i; // only used by some algorithms
\n-
85 size_t m_a; // only used by some algorithms
\n-
86 size_t m_b; // only used by some algorithms
\n-
87 size_t m_c; // only used by some algorithms
\n-\n-
\n+
56#include <stddef.h>
\n+
57#include <math.h>
\n+
58#include <limits.h>
\n+
59#include <float.h>
\n+
60
\n+
61#if defined(__cplusplus)
\n+
62extern "C" {
\n+
63#endif
\n+
64
\n+
65#if defined(_MSC_VER)
\n+
66#pragma warning (disable: 4244 4267 4996)
\n+
67#if !defined(__cplusplus)
\n+
68typedef char bool;
\n+
69static const int true = 1;
\n+
70static const int false = 0;
\n+
71#endif
\n+
72typedef unsigned __int64 uint64_t;
\n+
73typedef __int64 int64_t;
\n+
74typedef unsigned __int32 uint32_t;
\n+
75typedef __int32 int32_t;
\n+
76typedef unsigned __int16 uint16_t;
\n+
77typedef __int16 int16_t;
\n+
78typedef unsigned __int8 uint8_t;
\n+
79typedef __int8 int8_t;
\n+
80#else
\n+
81// ISO C standard compilers
\n+
82#include <stdbool.h>
\n+
83#include <stdint.h>
\n+
84#endif
\n+
85
\n+
86//-----------------------------------------------------------------------------
\n+
87// Rounding
\n+
88//-----------------------------------------------------------------------------
\n
89
\n-
90static uint32_t BRAHE_UNKNOWN_SEED = 0;
\n
91
\n-
93
\n-
100bool brahe_prng_init(brahe_prng_state_t * prng_state, const brahe_prng_type_t type, const uint32_t seed);
\n-
101
\n-
103
\n-\n+
94double brahe_round_nearest(const double x);
\n+
95
\n+
97
\n+
104double brahe_sigdig(const double x, const uint16_t n);
\n+
105
\n+
106//-----------------------------------------------------------------------------
\n+
107// Lowest Common Multple (LCM) and Lowest Common Denominator (GCD)
\n+
108//-----------------------------------------------------------------------------
\n
109
\n
111
\n-
116uint32_t brahe_prng_next(brahe_prng_state_t * prng_state);
\n-
117
\n-
119
\n-
126uint32_t brahe_prng_range(brahe_prng_state_t * prng_state, const uint32_t lo, const uint32_t hi);
\n+
117uint64_t brahe_lcm(const uint64_t x, const uint64_t y);
\n+
118
\n+
120
\n+
126uint64_t brahe_gcf(uint64_t x, uint64_t y);
\n
127
\n-
129
\n-
135size_t brahe_prng_index(brahe_prng_state_t * prng_state, const size_t length);
\n-
136
\n-
138
\n-\n-
146
\n-
148
\n-\n-
156
\n-
158
\n-\n-
166
\n-
168
\n-\n+
128//-----------------------------------------------------------------------------
\n+
129// Logarithms
\n+
130//-----------------------------------------------------------------------------
\n+
131
\n+
133
\n+
140double brahe_log2base(const double x, const double base);
\n+
141
\n+
143
\n+
148int brahe_sizepow2(const int n);
\n+
149
\n+
150//-----------------------------------------------------------------------------
\n+
151// Statistical functions
\n+
152//-----------------------------------------------------------------------------
\n+
153
\n+\n+\n+
163
\n+
165
\n+\n+
172
\n+
173//-----------------------------------------------------------------------------
\n+
174// Statistical functions
\n+
175//-----------------------------------------------------------------------------
\n
176
\n-
177#if defined(__cplusplus)
\n-
178}
\n-
179#endif
\n-
180
\n-
181#endif
\n-
size_t brahe_prng_index(brahe_prng_state_t *prng_state, const size_t length)
Get the next random value as a size_t index.
\n-
static uint32_t BRAHE_UNKNOWN_SEED
Definition prng.h:90
\n-
double brahe_prng_real2(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1)
\n-
uint32_t brahe_prng_range(brahe_prng_state_t *prng_state, const uint32_t lo, const uint32_t hi)
Get the next integer in the range [lo,hi].
\n-
bool brahe_prng_init(brahe_prng_state_t *prng_state, const brahe_prng_type_t type, const uint32_t seed)
Initialize a psuedo-random number generator (PRNG)
\n-
void brahe_prng_free(brahe_prng_state_t *prng_state)
Free resources used by PRNG.
\n-
double brahe_prng_real1(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1].
\n-
brahe_prng_type_t
Defines types of prngs.
Definition prng.h:64
\n-
@ BRAHE_PRNG_ISAAC
Indirect, Shift, Accumulate, Add, and Count (Jenkins)
Definition prng.h:74
\n-
@ BRAHE_PRNG_MARSENNE_TWISTER
Marsenne Twister (Matsumoto & Nishimura)
Definition prng.h:66
\n-
@ BRAHE_PRNG_MWC1038
MWC1038 (Marsaglia)
Definition prng.h:72
\n-
@ BRAHE_PRNG_CMWC4096
CMWC4096 (Marsaglia)
Definition prng.h:70
\n-
@ BRAHE_PRNG_KISS
Keep is Simple, Stupid (Marsaglia)
Definition prng.h:68
\n-
uint32_t brahe_prng_next(brahe_prng_state_t *prng_state)
Get the next integer.
\n-
double brahe_prng_real53(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1)
\n-
double brahe_prng_real3(brahe_prng_state_t *prng_state)
Get the next number in the range (0,1)
\n-\n-
Contains state variables for a PRNG.
Definition prng.h:79
\n-
void * m_data2
Definition prng.h:83
\n-
size_t m_b
Definition prng.h:86
\n-
void * m_data1
Definition prng.h:82
\n-
size_t m_i
Definition prng.h:84
\n-
size_t m_a
Definition prng.h:85
\n-
size_t m_c
Definition prng.h:87
\n-
brahe_prng_type_t m_type
Definition prng.h:80
\n-
uint32_t m_seed
Definition prng.h:81
\n+
\n+
178typedef struct brahe_statistics_t
\n+
179{
\n+
181 double min;
\n+
183 double max;
\n+
185 double mean;
\n+
187 double variance;
\n+
189 double sigma;
\n+
190}
\n+
\n+\n+
192
\n+
194
\n+
200brahe_statistics brahe_get_statistics(double * data, size_t n);
\n+
201
\n+
203
\n+
211double * brahe_moving_average(const double * data, const int n, const int distance);
\n+
212
\n+
213//-----------------------------------------------------------------------------
\n+
214// Digital Signal Processing
\n+
215//-----------------------------------------------------------------------------
\n+
216
\n+
218
\n+
226double * brahe_simple_fft(const double * data, const int n);
\n+
227
\n+
229
\n+
237double * brahe_simple_fft2(const double * data, const int n);
\n+
238
\n+
240
\n+
\n+
243typedef struct
\n+
244{
\n+\n+
248 double amplitude;
\n+
249}
\n+
\n+\n+
251
\n+
253
\n+
263double * brahe_make_sinusoid(const brahe_wave_factor_t * factors, const size_t factor_n, const size_t array_n);
\n+
264
\n+
266
\n+
274void brahe_add_noise(double * a, const size_t n, double noise);
\n+
275
\n+
276//-----------------------------------------------------------------------------
\n+
277// Trigonometry
\n+
278//-----------------------------------------------------------------------------
\n+
280
\n+
285double brahe_asinh(const double x);
\n+
286
\n+
288
\n+
293double brahe_acosh(const double x);
\n+
294
\n+
296
\n+
301double brahe_atanh(const double x);
\n+
302
\n+
303//-----------------------------------------------------------------------------
\n+
304// Constants
\n+
305//-----------------------------------------------------------------------------
\n+
306
\n+
308#define BRAHE_E 2.71828182845904523536028747135
\n+
309
\n+
311#define BRAHE_LOG2_E 1.44269504088896340735992468100
\n+
312
\n+
314#define BRAHE_LOG10_E 0.43429448190325182765112891892
\n+
315
\n+
317#define BRAHE_SQRT_2 1.41421356237309504880168872421
\n+
318
\n+
320#define BRAHE_SQRT_HALF 0.70710678118654752440084436210
\n+
321
\n+
323#define BRAHE_SQRT_3 1.73205080756887729352744634151
\n+
324
\n+
326#define BRAHE_PI 3.14159265358979323846264338328
\n+
327
\n+
329#define BRAHE_TAU 6.28318530717958647692528676656
\n+
330
\n+
332#define BRAHE_PI_DIV_2 1.57079632679489661923132169164
\n+
333
\n+
335#define BRAHE_PI_DIV_3 1.04719755119659774615421446109
\n+
336
\n+
338#define BRAHE_PI_DIV_4 0.78539816339744830961566084582
\n+
339
\n+
341#define BRAHE_PI_DIV_6 0.52359877559829887307710723055
\n+
342
\n+
344#define BRAHE_PI_DIV_9 0.34906585039886591538473815370
\n+
345
\n+
347#define BRAHE_PI_DIV_12 0.26179938779914943653855361527
\n+
348
\n+
350#define BRAHE_PI_DIV_18 0.17453292519943295769236907685
\n+
351
\n+
353#define BRAHE_PI_DIV_36 0.08726646259971647884618453842
\n+
354
\n+
356#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141
\n+
357
\n+
359#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768
\n+
360
\n+
362#define BRAHE_SQRT_PI 1.77245385090551602729816748334
\n+
363
\n+
365#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312
\n+
366
\n+
368#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675
\n+
369
\n+
371#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349
\n+
372
\n+
374#define BRAHE_LN_10 2.30258509299404568401799145468
\n+
375
\n+
377#define BRAHE_LN_2 0.69314718055994530941723212146
\n+
378
\n+
380#define BRAHE_LOG_2 0.30102999566398119521373889472
\n+
381
\n+
383#define BRAHE_LN_PI 1.14472988584940017414342735135
\n+
384
\n+
386#define BRAHE_EULER 0.57721566490153286060651209008
\n+
387
\n+
388#if defined(__cplusplus)
\n+
389}
\n+
390#endif
\n+
391
\n+
392#endif
\n+
double brahe_log2base(const double x, const double base)
Logarithm to a specified base.
\n+
double brahe_round_nearest(const double x)
Round to nearest value.
\n+
brahe_pretty_format_t
Formats for pretty-printing integers.
Definition mathtools.h:156
\n+
@ BRAHE_PRETTY_COMMA
comma delimited, (1,234,567,890)
Definition mathtools.h:160
\n+
@ BRAHE_PRETTY_TEXT
english text (nine thousand, two hundred eleven)
Definition mathtools.h:158
\n+
char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt)
Turn a 64-bit integer into a pretty string.
\n+
double * brahe_moving_average(const double *data, const int n, const int distance)
Moving average.
\n+
int brahe_sizepow2(const int n)
Smallest power of 2 that includes a given value.
\n+
uint64_t brahe_lcm(const uint64_t x, const uint64_t y)
Lowest common multiple.
\n+
double * brahe_simple_fft2(const double *data, const int n)
Simple real-to-real fft (power of 2 length)
\n+
double brahe_sigdig(const double x, const uint16_t n)
Set number of significant digits in a floating-point value.
\n+
double brahe_asinh(const double x)
Hyperbolic arcsine.
\n+
double brahe_acosh(const double x)
Hyperbolic arccosine.
\n+
struct brahe_statistics_t brahe_statistics
Structure containing statistical values calculate from a double array.
\n+
double brahe_atanh(const double x)
Hyperbolic arctangent.
\n+
double * brahe_simple_fft(const double *data, const int n)
Simple real-to-real fft (arbitrary length)
\n+
brahe_statistics brahe_get_statistics(double *data, size_t n)
statistics for array of double
\n+
enum brahe_pretty_format_t brahe_pretty_format
Formats for pretty-printing integers.
\n+
double * brahe_make_sinusoid(const brahe_wave_factor_t *factors, const size_t factor_n, const size_t array_n)
Sine wave based artificial signal generator.
\n+
uint64_t brahe_gcf(uint64_t x, uint64_t y)
Greatest common factor (denominator)
\n+
void brahe_add_noise(double *a, const size_t n, double noise)
Apply noise to a signal.
\n+
Structure containing statistical values calculate from a double array.
Definition mathtools.h:179
\n+
double min
minimum value from array
Definition mathtools.h:181
\n+
double mean
mean (average)
Definition mathtools.h:185
\n+
double variance
variance
Definition mathtools.h:187
\n+
double max
maximum value
Definition mathtools.h:183
\n+
double sigma
standard deviation
Definition mathtools.h:189
\n+
Sine wave definition.
Definition mathtools.h:244
\n+
double amplitude
arbitrary wave amplitude
Definition mathtools.h:248
\n+
double wavelength
wavelength
Definition mathtools.h:246
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n

\n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,14 +1,14 @@\n ****** Brahe - a heterogenous collection of mathematical tools ******\n ***** Main_Index\n Home_Page *****\n Created by Scott_Robert_Ladd\n ===============================================================================\n * src\n-prng.h\n+mathtools.h\n Go_to_the_documentation_of_this_file.\n 1/*\n 2 Brahe is a heterogenous collection of mathematical tools, written in\n Standard C.\n 3\n 4 Copyright 2011 Scott Robert Ladd. All rights reserved.\n 5\n@@ -73,161 +73,326 @@\n 46 The author can be contacted at:\n 47\n 48 scott.ladd@coyotegulch.com\n 49 scott.ladd@gmail.com\n 50 http:www.coyotegulch.com\n 51*/\n 52\n- 53#if !defined(LIBBRAHE_PRNG_H)\n- 54#define LIBBRAHE_PRNG_H\n+ 53#if !defined(LIBBRAHE_MATHTOOLS_H)\n+ 54#define LIBBRAHE_MATHTOOLS_H\n 55\n- 56#include \"mathtools.h\"\n- 57\n- 58#if defined(__cplusplus)\n- 59extern \"C\" {\n- 60#endif\n- 61\n-63typedef enum\n- 64{\n-66 BRAHE_PRNG_MARSENNE_TWISTER = 0,\n-68 BRAHE_PRNG_KISS,\n-70 BRAHE_PRNG_CMWC4096,\n-72 BRAHE_PRNG_MWC1038,\n- 74 BRAHE_PRNG_ISAAC\n-75} brahe_prng_type_t;\n- 76\n-78typedef struct\n- 79{\n-80 brahe_prng_type_t m_type; // the algorithm we're using\n-81 uint32_t m_seed; // \"seed\" that defines the sequence\n-82 void * m_data1; // array or table\n-83 void * m_data2; // additional array or table\n-84 size_t m_i; // only used by some algorithms\n-85 size_t m_a; // only used by some algorithms\n-86 size_t m_b; // only used by some algorithms\n-87 size_t m_c; // only used by some algorithms\n- 88} brahe_prng_state_t;\n+ 56#include \n+ 57#include \n+ 58#include \n+ 59#include \n+ 60\n+ 61#if defined(__cplusplus)\n+ 62extern \"C\" {\n+ 63#endif\n+ 64\n+ 65#if defined(_MSC_VER)\n+ 66#pragma warning (disable: 4244 4267 4996)\n+ 67#if !defined(__cplusplus)\n+ 68typedef char bool;\n+ 69static const int true = 1;\n+ 70static const int false = 0;\n+ 71#endif\n+ 72typedef unsigned __int64 uint64_t;\n+ 73typedef __int64 int64_t;\n+ 74typedef unsigned __int32 uint32_t;\n+ 75typedef __int32 int32_t;\n+ 76typedef unsigned __int16 uint16_t;\n+ 77typedef __int16 int16_t;\n+ 78typedef unsigned __int8 uint8_t;\n+ 79typedef __int8 int8_t;\n+ 80#else\n+ 81// ISO C standard compilers\n+ 82#include \n+ 83#include \n+ 84#endif\n+ 85\n+ 86//--------------------------------------------------------------------------\n+---\n+ 87// Rounding\n+ 88//--------------------------------------------------------------------------\n+---\n 89\n-90static uint32_t BRAHE_UNKNOWN_SEED = 0;\n 91\n- 93\n-100bool brahe_prng_init(brahe_prng_state_t * prng_state, const\n-brahe_prng_type_t type, const uint32_t seed);\n- 101\n- 103\n-108void brahe_prng_free(brahe_prng_state_t * prng_state);\n+94double brahe_round_nearest(const double x);\n+ 95\n+ 97\n+104double brahe_sigdig(const double x, const uint16_t n);\n+ 105\n+ 106//-------------------------------------------------------------------------\n+----\n+ 107// Lowest Common Multple (LCM) and Lowest Common Denominator (GCD)\n+ 108//-------------------------------------------------------------------------\n+----\n 109\n 111\n-116uint32_t brahe_prng_next(brahe_prng_state_t * prng_state);\n- 117\n- 119\n-126uint32_t brahe_prng_range(brahe_prng_state_t * prng_state, const uint32_t\n-lo, const uint32_t hi);\n+117uint64_t brahe_lcm(const uint64_t x, const uint64_t y);\n+ 118\n+ 120\n+126uint64_t brahe_gcf(uint64_t x, uint64_t y);\n 127\n- 129\n-135size_t brahe_prng_index(brahe_prng_state_t * prng_state, const size_t\n-length);\n- 136\n- 138\n-145double brahe_prng_real1(brahe_prng_state_t * prng_state);\n- 146\n- 148\n-155double brahe_prng_real2(brahe_prng_state_t * prng_state);\n- 156\n- 158\n-165double brahe_prng_real3(brahe_prng_state_t * prng_state);\n- 166\n- 168\n-175double brahe_prng_real53(brahe_prng_state_t * prng_state);\n+ 128//-------------------------------------------------------------------------\n+----\n+ 129// Logarithms\n+ 130//-------------------------------------------------------------------------\n+----\n+ 131\n+ 133\n+140double brahe_log2base(const double x, const double base);\n+ 141\n+ 143\n+148int brahe_sizepow2(const int n);\n+ 149\n+ 150//-------------------------------------------------------------------------\n+----\n+ 151// Statistical functions\n+ 152//-------------------------------------------------------------------------\n+----\n+ 153\n+155typedef enum brahe_pretty_format_t\n+ 156{\n+158 BRAHE_PRETTY_TEXT,\n+ 160 BRAHE_PRETTY_COMMA\n+161}\n+162brahe_pretty_format;\n+ 163\n+ 165\n+171char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt);\n+ 172\n+ 173//-------------------------------------------------------------------------\n+----\n+ 174// Statistical functions\n+ 175//-------------------------------------------------------------------------\n+----\n 176\n- 177#if defined(__cplusplus)\n- 178}\n- 179#endif\n- 180\n- 181#endif\n-brahe_prng_index\n-size_t brahe_prng_index(brahe_prng_state_t *prng_state, const size_t length)\n-Get the next random value as a size_t index.\n-BRAHE_UNKNOWN_SEED\n-static uint32_t BRAHE_UNKNOWN_SEED\n-Definition prng.h:90\n-brahe_prng_real2\n-double brahe_prng_real2(brahe_prng_state_t *prng_state)\n-Get the next number in the range [0,1)\n-brahe_prng_range\n-uint32_t brahe_prng_range(brahe_prng_state_t *prng_state, const uint32_t lo,\n-const uint32_t hi)\n-Get the next integer in the range [lo,hi].\n-brahe_prng_init\n-bool brahe_prng_init(brahe_prng_state_t *prng_state, const brahe_prng_type_t\n-type, const uint32_t seed)\n-Initialize a psuedo-random number generator (PRNG)\n-brahe_prng_free\n-void brahe_prng_free(brahe_prng_state_t *prng_state)\n-Free resources used by PRNG.\n-brahe_prng_real1\n-double brahe_prng_real1(brahe_prng_state_t *prng_state)\n-Get the next number in the range [0,1].\n-brahe_prng_type_t\n-brahe_prng_type_t\n-Defines types of prngs.\n-Definition prng.h:64\n-BRAHE_PRNG_ISAAC\n-@ BRAHE_PRNG_ISAAC\n-Indirect, Shift, Accumulate, Add, and Count (Jenkins)\n-Definition prng.h:74\n-BRAHE_PRNG_MARSENNE_TWISTER\n-@ BRAHE_PRNG_MARSENNE_TWISTER\n-Marsenne Twister (Matsumoto & Nishimura)\n-Definition prng.h:66\n-BRAHE_PRNG_MWC1038\n-@ BRAHE_PRNG_MWC1038\n-MWC1038 (Marsaglia)\n-Definition prng.h:72\n-BRAHE_PRNG_CMWC4096\n-@ BRAHE_PRNG_CMWC4096\n-CMWC4096 (Marsaglia)\n-Definition prng.h:70\n-BRAHE_PRNG_KISS\n-@ BRAHE_PRNG_KISS\n-Keep is Simple, Stupid (Marsaglia)\n-Definition prng.h:68\n-brahe_prng_next\n-uint32_t brahe_prng_next(brahe_prng_state_t *prng_state)\n-Get the next integer.\n-brahe_prng_real53\n-double brahe_prng_real53(brahe_prng_state_t *prng_state)\n-Get the next number in the range [0,1)\n-brahe_prng_real3\n-double brahe_prng_real3(brahe_prng_state_t *prng_state)\n-Get the next number in the range (0,1)\n-mathtools.h\n-brahe_prng_state_t\n-Contains state variables for a PRNG.\n-Definition prng.h:79\n-brahe_prng_state_t::m_data2\n-void * m_data2\n-Definition prng.h:83\n-brahe_prng_state_t::m_b\n-size_t m_b\n-Definition prng.h:86\n-brahe_prng_state_t::m_data1\n-void * m_data1\n-Definition prng.h:82\n-brahe_prng_state_t::m_i\n-size_t m_i\n-Definition prng.h:84\n-brahe_prng_state_t::m_a\n-size_t m_a\n-Definition prng.h:85\n-brahe_prng_state_t::m_c\n-size_t m_c\n-Definition prng.h:87\n-brahe_prng_state_t::m_type\n-brahe_prng_type_t m_type\n-Definition prng.h:80\n-brahe_prng_state_t::m_seed\n-uint32_t m_seed\n-Definition prng.h:81\n+178typedef struct brahe_statistics_t\n+ 179{\n+181 double min;\n+183 double max;\n+185 double mean;\n+187 double variance;\n+189 double sigma;\n+ 190}\n+191brahe_statistics;\n+ 192\n+ 194\n+200brahe_statistics brahe_get_statistics(double * data, size_t n);\n+ 201\n+ 203\n+211double * brahe_moving_average(const double * data, const int n, const int\n+distance);\n+ 212\n+ 213//-------------------------------------------------------------------------\n+----\n+ 214// Digital Signal Processing\n+ 215//-------------------------------------------------------------------------\n+----\n+ 216\n+ 218\n+226double * brahe_simple_fft(const double * data, const int n);\n+ 227\n+ 229\n+237double * brahe_simple_fft2(const double * data, const int n);\n+ 238\n+ 240\n+243typedef struct\n+ 244{\n+246 double wavelength;\n+248 double amplitude;\n+ 249}\n+ 250brahe_wave_factor_t;\n+ 251\n+ 253\n+263double * brahe_make_sinusoid(const brahe_wave_factor_t * factors, const\n+size_t factor_n, const size_t array_n);\n+ 264\n+ 266\n+274void brahe_add_noise(double * a, const size_t n, double noise);\n+ 275\n+ 276//-------------------------------------------------------------------------\n+----\n+ 277// Trigonometry\n+ 278//-------------------------------------------------------------------------\n+----\n+ 280\n+285double brahe_asinh(const double x);\n+ 286\n+ 288\n+293double brahe_acosh(const double x);\n+ 294\n+ 296\n+301double brahe_atanh(const double x);\n+ 302\n+ 303//-------------------------------------------------------------------------\n+----\n+ 304// Constants\n+ 305//-------------------------------------------------------------------------\n+----\n+ 306\n+308#define BRAHE_E 2.71828182845904523536028747135\n+ 309\n+311#define BRAHE_LOG2_E 1.44269504088896340735992468100\n+ 312\n+314#define BRAHE_LOG10_E 0.43429448190325182765112891892\n+ 315\n+317#define BRAHE_SQRT_2 1.41421356237309504880168872421\n+ 318\n+320#define BRAHE_SQRT_HALF 0.70710678118654752440084436210\n+ 321\n+323#define BRAHE_SQRT_3 1.73205080756887729352744634151\n+ 324\n+326#define BRAHE_PI 3.14159265358979323846264338328\n+ 327\n+329#define BRAHE_TAU 6.28318530717958647692528676656\n+ 330\n+332#define BRAHE_PI_DIV_2 1.57079632679489661923132169164\n+ 333\n+335#define BRAHE_PI_DIV_3 1.04719755119659774615421446109\n+ 336\n+338#define BRAHE_PI_DIV_4 0.78539816339744830961566084582\n+ 339\n+341#define BRAHE_PI_DIV_6 0.52359877559829887307710723055\n+ 342\n+344#define BRAHE_PI_DIV_9 0.34906585039886591538473815370\n+ 345\n+347#define BRAHE_PI_DIV_12 0.26179938779914943653855361527\n+ 348\n+350#define BRAHE_PI_DIV_18 0.17453292519943295769236907685\n+ 351\n+353#define BRAHE_PI_DIV_36 0.08726646259971647884618453842\n+ 354\n+356#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141\n+ 357\n+359#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768\n+ 360\n+362#define BRAHE_SQRT_PI 1.77245385090551602729816748334\n+ 363\n+365#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312\n+ 366\n+368#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675\n+ 369\n+371#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349\n+ 372\n+374#define BRAHE_LN_10 2.30258509299404568401799145468\n+ 375\n+377#define BRAHE_LN_2 0.69314718055994530941723212146\n+ 378\n+380#define BRAHE_LOG_2 0.30102999566398119521373889472\n+ 381\n+383#define BRAHE_LN_PI 1.14472988584940017414342735135\n+ 384\n+386#define BRAHE_EULER 0.57721566490153286060651209008\n+ 387\n+ 388#if defined(__cplusplus)\n+ 389}\n+ 390#endif\n+ 391\n+ 392#endif\n+brahe_log2base\n+double brahe_log2base(const double x, const double base)\n+Logarithm to a specified base.\n+brahe_round_nearest\n+double brahe_round_nearest(const double x)\n+Round to nearest value.\n+brahe_pretty_format_t\n+brahe_pretty_format_t\n+Formats for pretty-printing integers.\n+Definition mathtools.h:156\n+BRAHE_PRETTY_COMMA\n+@ BRAHE_PRETTY_COMMA\n+comma delimited, (1,234,567,890)\n+Definition mathtools.h:160\n+BRAHE_PRETTY_TEXT\n+@ BRAHE_PRETTY_TEXT\n+english text (nine thousand, two hundred eleven)\n+Definition mathtools.h:158\n+brahe_pretty_int\n+char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt)\n+Turn a 64-bit integer into a pretty string.\n+brahe_moving_average\n+double * brahe_moving_average(const double *data, const int n, const int\n+distance)\n+Moving average.\n+brahe_sizepow2\n+int brahe_sizepow2(const int n)\n+Smallest power of 2 that includes a given value.\n+brahe_lcm\n+uint64_t brahe_lcm(const uint64_t x, const uint64_t y)\n+Lowest common multiple.\n+brahe_simple_fft2\n+double * brahe_simple_fft2(const double *data, const int n)\n+Simple real-to-real fft (power of 2 length)\n+brahe_sigdig\n+double brahe_sigdig(const double x, const uint16_t n)\n+Set number of significant digits in a floating-point value.\n+brahe_asinh\n+double brahe_asinh(const double x)\n+Hyperbolic arcsine.\n+brahe_acosh\n+double brahe_acosh(const double x)\n+Hyperbolic arccosine.\n+brahe_statistics\n+struct brahe_statistics_t brahe_statistics\n+Structure containing statistical values calculate from a double array.\n+brahe_atanh\n+double brahe_atanh(const double x)\n+Hyperbolic arctangent.\n+brahe_simple_fft\n+double * brahe_simple_fft(const double *data, const int n)\n+Simple real-to-real fft (arbitrary length)\n+brahe_get_statistics\n+brahe_statistics brahe_get_statistics(double *data, size_t n)\n+statistics for array of double\n+brahe_pretty_format\n+enum brahe_pretty_format_t brahe_pretty_format\n+Formats for pretty-printing integers.\n+brahe_make_sinusoid\n+double * brahe_make_sinusoid(const brahe_wave_factor_t *factors, const size_t\n+factor_n, const size_t array_n)\n+Sine wave based artificial signal generator.\n+brahe_gcf\n+uint64_t brahe_gcf(uint64_t x, uint64_t y)\n+Greatest common factor (denominator)\n+brahe_add_noise\n+void brahe_add_noise(double *a, const size_t n, double noise)\n+Apply noise to a signal.\n+brahe_statistics_t\n+Structure containing statistical values calculate from a double array.\n+Definition mathtools.h:179\n+brahe_statistics_t::min\n+double min\n+minimum value from array\n+Definition mathtools.h:181\n+brahe_statistics_t::mean\n+double mean\n+mean (average)\n+Definition mathtools.h:185\n+brahe_statistics_t::variance\n+double variance\n+variance\n+Definition mathtools.h:187\n+brahe_statistics_t::max\n+double max\n+maximum value\n+Definition mathtools.h:183\n+brahe_statistics_t::sigma\n+double sigma\n+standard deviation\n+Definition mathtools.h:189\n+brahe_wave_factor_t\n+Sine wave definition.\n+Definition mathtools.h:244\n+brahe_wave_factor_t::amplitude\n+double amplitude\n+arbitrary wave amplitude\n+Definition mathtools.h:248\n+brahe_wave_factor_t::wavelength\n+double wavelength\n+wavelength\n+Definition mathtools.h:246\n ===============================================================================\n \u00a9 2011 Scott Robert Ladd. All rights reserved.\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n"}]}, {"source1": "./usr/share/doc/libbrahe-dev/html/a00005.html", "source2": "./usr/share/doc/libbrahe-dev/html/a00005.html", "unified_diff": "@@ -19,1139 +19,399 @@\n \n \n \n
\n \n-
mathtools.h File Reference
\n+Functions |\n+Variables
\n+
prng.h File Reference
\n \n
\n-
#include <stddef.h>
\n-#include <math.h>
\n-#include <limits.h>
\n-#include <float.h>
\n-#include <stdbool.h>
\n-#include <stdint.h>
\n+
#include "mathtools.h"
\n
\n

Go to the source code of this file.

\n \n \n-\n-\n+\n+\n \n-\n-\n-\n-

\n Data Structures

struct  brahe_statistics_t
 Structure containing statistical values calculate from a double array. More...
struct  brahe_prng_state_t
 Contains state variables for a PRNG. More...
 
struct  brahe_wave_factor_t
 Sine wave definition. More...
 
\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-

\n-Macros

#define BRAHE_E   2.71828182845904523536028747135
 e (natural logarithm base
 
#define BRAHE_LOG2_E   1.44269504088896340735992468100
 log_2 (e)
 
#define BRAHE_LOG10_E   0.43429448190325182765112891892
 log_10 (e)
 
#define BRAHE_SQRT_2   1.41421356237309504880168872421
 sqrt(2)
 
#define BRAHE_SQRT_HALF   0.70710678118654752440084436210
 sqrt(1/2)
 
#define BRAHE_SQRT_3   1.73205080756887729352744634151
 sqrt(3)
 
#define BRAHE_PI   3.14159265358979323846264338328
 pi (180 deg)
 
#define BRAHE_TAU   6.28318530717958647692528676656
 tau (2 * pi)
 
#define BRAHE_PI_DIV_2   1.57079632679489661923132169164
 pi/2 (90 deg)
 
#define BRAHE_PI_DIV_3   1.04719755119659774615421446109
 pi/3 (60 deg)
 
#define BRAHE_PI_DIV_4   0.78539816339744830961566084582
 pi/4 (45 deg)
 
#define BRAHE_PI_DIV_6   0.52359877559829887307710723055
 pi/6 (30 deg)
 
#define BRAHE_PI_DIV_9   0.34906585039886591538473815370
 pi/9 (20 deg)
 
#define BRAHE_PI_DIV_12   0.26179938779914943653855361527
 pi / 12 (15 deg)
 
#define BRAHE_PI_DIV_18   0.17453292519943295769236907685
 pi / 18 (10 deg)
 
#define BRAHE_PI_DIV_36   0.08726646259971647884618453842
 pi / 36 (5 deg)
 
#define BRAHE_DEG_PER_RAD   57.2957795130823208767981548141
 degrees per radian
 
#define BRAHE_RAD_PER_DEG   0.01745329251994329576923690768
 radians per degree
 
#define BRAHE_SQRT_PI   1.77245385090551602729816748334
 sqrt(pi)
 
#define BRAHE_TWO_DIV_SQRT_PI   1.12837916709551257389615890312
 2/sqrt(pi)
 
#define BRAHE_ONE_DIV_PI   0.31830988618379067153776752675
 1/pi
 
#define BRAHE_TWO_DIV_PI   0.63661977236758134307553505349
 2/pi
 
#define BRAHE_LN_10   2.30258509299404568401799145468
 ln(10)
 
#define BRAHE_LN_2   0.69314718055994530941723212146
 ln(2)
 
#define BRAHE_LOG_2   0.30102999566398119521373889472
 log(2)
 
#define BRAHE_LN_PI   1.14472988584940017414342735135
 ln(pi)
 
#define BRAHE_EULER   0.57721566490153286060651209008
 Euler constant.
 
\n-\n-\n-\n-\n-\n-\n-\n

\n-Typedefs

typedef enum brahe_pretty_format_t brahe_pretty_format
 Formats for pretty-printing integers.
 
typedef struct brahe_statistics_t brahe_statistics
 Structure containing statistical values calculate from a double array.
 
\n \n-\n-\n-\n+\n+\n

\n Enumerations

enum  brahe_pretty_format_t { BRAHE_PRETTY_TEXT\n-, BRAHE_PRETTY_COMMA\n+
enum  brahe_prng_type_t {
\n+  BRAHE_PRNG_MARSENNE_TWISTER = 0\n+, BRAHE_PRNG_KISS\n+, BRAHE_PRNG_CMWC4096\n+, BRAHE_PRNG_MWC1038\n+,
\n+  BRAHE_PRNG_ISAAC\n+
\n }
 Formats for pretty-printing integers. More...
 
 Defines types of prngs. More...
 
\n \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+

\n Functions

double brahe_round_nearest (const double x)
 Round to nearest value.
 
double brahe_sigdig (const double x, const uint16_t n)
 Set number of significant digits in a floating-point value.
 
uint64_t brahe_lcm (const uint64_t x, const uint64_t y)
 Lowest common multiple.
 
uint64_t brahe_gcf (uint64_t x, uint64_t y)
 Greatest common factor (denominator)
 
double brahe_log2base (const double x, const double base)
 Logarithm to a specified base.
 
int brahe_sizepow2 (const int n)
 Smallest power of 2 that includes a given value.
 
char * brahe_pretty_int (int64_t n, brahe_pretty_format fmt)
 Turn a 64-bit integer into a pretty string.
 
brahe_statistics brahe_get_statistics (double *data, size_t n)
 statistics for array of double
 
double * brahe_moving_average (const double *data, const int n, const int distance)
 Moving average.
 
double * brahe_simple_fft (const double *data, const int n)
 Simple real-to-real fft (arbitrary length)
 
double * brahe_simple_fft2 (const double *data, const int n)
 Simple real-to-real fft (power of 2 length)
 
double * brahe_make_sinusoid (const brahe_wave_factor_t *factors, const size_t factor_n, const size_t array_n)
 Sine wave based artificial signal generator.
 
void brahe_add_noise (double *a, const size_t n, double noise)
 Apply noise to a signal.
 
double brahe_asinh (const double x)
 Hyperbolic arcsine.
 
double brahe_acosh (const double x)
 Hyperbolic arccosine.
 
double brahe_atanh (const double x)
 Hyperbolic arctangent.
 
bool brahe_prng_init (brahe_prng_state_t *prng_state, const brahe_prng_type_t type, const uint32_t seed)
 Initialize a psuedo-random number generator (PRNG)
 
void brahe_prng_free (brahe_prng_state_t *prng_state)
 Free resources used by PRNG.
 
uint32_t brahe_prng_next (brahe_prng_state_t *prng_state)
 Get the next integer.
 
uint32_t brahe_prng_range (brahe_prng_state_t *prng_state, const uint32_t lo, const uint32_t hi)
 Get the next integer in the range [lo,hi].
 
size_t brahe_prng_index (brahe_prng_state_t *prng_state, const size_t length)
 Get the next random value as a size_t index.
 
double brahe_prng_real1 (brahe_prng_state_t *prng_state)
 Get the next number in the range [0,1].
 
double brahe_prng_real2 (brahe_prng_state_t *prng_state)
 Get the next number in the range [0,1)
 
double brahe_prng_real3 (brahe_prng_state_t *prng_state)
 Get the next number in the range (0,1)
 
double brahe_prng_real53 (brahe_prng_state_t *prng_state)
 Get the next number in the range [0,1)
 
\n+\n+\n+\n

\n+Variables

static uint32_t BRAHE_UNKNOWN_SEED = 0
 
\n-

Macro Definition Documentation

\n-\n-

◆ BRAHE_DEG_PER_RAD

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_DEG_PER_RAD   57.2957795130823208767981548141
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_E

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_E   2.71828182845904523536028747135
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_EULER

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_EULER   0.57721566490153286060651209008
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_LN_10

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_LN_10   2.30258509299404568401799145468
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_LN_2

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_LN_2   0.69314718055994530941723212146
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_LN_PI

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_LN_PI   1.14472988584940017414342735135
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_LOG10_E

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_LOG10_E   0.43429448190325182765112891892
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_LOG2_E

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_LOG2_E   1.44269504088896340735992468100
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_LOG_2

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_LOG_2   0.30102999566398119521373889472
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_ONE_DIV_PI

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_ONE_DIV_PI   0.31830988618379067153776752675
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_PI

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_PI   3.14159265358979323846264338328
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_PI_DIV_12

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_PI_DIV_12   0.26179938779914943653855361527
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_PI_DIV_18

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_PI_DIV_18   0.17453292519943295769236907685
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_PI_DIV_2

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_PI_DIV_2   1.57079632679489661923132169164
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_PI_DIV_3

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_PI_DIV_3   1.04719755119659774615421446109
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_PI_DIV_36

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_PI_DIV_36   0.08726646259971647884618453842
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_PI_DIV_4

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_PI_DIV_4   0.78539816339744830961566084582
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_PI_DIV_6

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_PI_DIV_6   0.52359877559829887307710723055
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_PI_DIV_9

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_PI_DIV_9   0.34906585039886591538473815370
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_RAD_PER_DEG

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_RAD_PER_DEG   0.01745329251994329576923690768
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_SQRT_2

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_SQRT_2   1.41421356237309504880168872421
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_SQRT_3

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_SQRT_3   1.73205080756887729352744634151
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_SQRT_HALF

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_SQRT_HALF   0.70710678118654752440084436210
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_SQRT_PI

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_SQRT_PI   1.77245385090551602729816748334
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_TAU

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_TAU   6.28318530717958647692528676656
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_TWO_DIV_PI

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_TWO_DIV_PI   0.63661977236758134307553505349
\n-
\n-\n-
\n-
\n-\n-

◆ BRAHE_TWO_DIV_SQRT_PI

\n-\n-
\n-
\n- \n- \n- \n- \n-
#define BRAHE_TWO_DIV_SQRT_PI   1.12837916709551257389615890312
\n-
\n-\n-
\n-
\n-

Typedef Documentation

\n-\n-

◆ brahe_pretty_format

\n-\n-
\n-
\n- \n- \n- \n- \n-
typedef enum brahe_pretty_format_t brahe_pretty_format
\n-
\n-\n-
\n-
\n-\n-

◆ brahe_statistics

\n-\n-
\n-
\n- \n- \n- \n- \n-
typedef struct brahe_statistics_t brahe_statistics
\n-
\n-\n-
\n-
\n

Enumeration Type Documentation

\n-\n-

◆ brahe_pretty_format_t

\n+\n+

◆ brahe_prng_type_t

\n \n
\n
\n \n \n- \n+ \n \n
enum brahe_pretty_format_tenum brahe_prng_type_t
\n
\n \n-\n+\n+\n+\n-\n
Enumerator
BRAHE_PRETTY_TEXT 

english text (nine thousand, two hundred eleven)

\n+
Enumerator
BRAHE_PRNG_MARSENNE_TWISTER 

Marsenne Twister (Matsumoto & Nishimura)

\n+
BRAHE_PRNG_KISS 

Keep is Simple, Stupid (Marsaglia)

\n+
BRAHE_PRNG_CMWC4096 

CMWC4096 (Marsaglia)

\n+
BRAHE_PRNG_MWC1038 

MWC1038 (Marsaglia)

\n
BRAHE_PRETTY_COMMA 

comma delimited, (1,234,567,890)

\n+
BRAHE_PRNG_ISAAC 

Indirect, Shift, Accumulate, Add, and Count (Jenkins)

\n
\n \n
\n
\n

Function Documentation

\n-\n-

◆ brahe_acosh()

\n+\n+

◆ brahe_prng_free()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n \n \n
double brahe_acosh void brahe_prng_free (const double x)brahe_prng_state_tprng_state)
\n
\n-

Calculates cosh-1.

Parameters
\n+

Frees the resources used by a PRNG

Parameters
\n \n- \n+ \n
xa value
prng_stateObject containing the state of a PRNG
\n
\n
\n-
Returns
inverse hyperbolic cosine of x
\n+
Returns
true if successful, false if failed
\n \n
\n
\n-\n-

◆ brahe_add_noise()

\n+\n+

◆ brahe_prng_index()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n \n \n \n \n \n- \n- \n- \n- \n- \n- \n- \n+ \n \n \n \n \n \n \n
void brahe_add_noise size_t brahe_prng_index (double * a, brahe_prng_state_tprng_state,
const size_t n,
double noise length 
)
\n
\n-

Adds a percentage of noise to a signal. If \"noise\" is set to 0.1 (for example) each value will be adjust to between 90% and 110% of its original value. This function changes the existing values in the array.

Parameters
\n+

Returns the next value as a size_t \"index\" in the range [0,length).

Parameters
\n \n- \n- \n- \n+ \n+ \n
aarray containing signal data
nnumber of samples in signal
noisepercentage of noise
prng_stateObject containing the state of a PRNG
length- Maximum value of result
\n
\n
\n+
Returns
A pseudorandom size_t value
\n \n
\n
\n-\n-

◆ brahe_asinh()

\n+\n+

◆ brahe_prng_init()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n- \n+ \n+ \n \n-
double brahe_asinh bool brahe_prng_init (const double x)brahe_prng_state_tprng_state,
\n-
\n-

Calculates sinh-1.

Parameters
\n- \n- \n-
xa value
\n-
\n-
\n-
Returns
inverse hyperbolic sine of x
\n-\n-
\n-
\n-\n-

◆ brahe_atanh()

\n-\n-
\n-
\n- \n \n- \n- \n- \n- \n+ \n \n- \n-
double brahe_atanh (const double x)
\n-
\n-

Calculates tanh-1.

Parameters
\n- \n- \n-
xa value
\n-
\n-
\n-
Returns
inverse hyperbolic tangent of x
\n-\n-
\n-
\n-\n-

◆ brahe_gcf()

\n-\n-
\n-
\n- \n- \n- \n- \n- \n- \n+ \n+ \n \n \n \n \n- \n- \n+ \n+ \n \n \n \n \n \n \n
uint64_t brahe_gcf (uint64_t x, const brahe_prng_type_t type,
uint64_t y const uint32_t seed 
)
\n
\n-

Calculates the greatest common factor for two values.

Parameters
\n+

Initializes a psuedo-random number generator using a specified algorithm.

Parameters
\n \n- \n- \n+ \n+ \n+ \n
xfirst value
ysecond value
prng_stateObject to be initialized for a specific algorithm
typeAlgorithm to be used for this PRNG
seedInitialization seed
\n
\n
\n-
Returns
The greatest common factor for x and y
\n+
Returns
true if successful, false if failed
\n \n
\n
\n-\n-

◆ brahe_get_statistics()

\n+\n+

◆ brahe_prng_next()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n- \n- \n- \n+ \n+ \n \n- \n- \n- \n- \n- \n- \n- \n \n
brahe_statistics brahe_get_statistics uint32_t brahe_prng_next (double * data,
brahe_prng_state_tprng_state)size_t n 
)
\n
\n-

Calculate several common statistics for an array of doubles.

Parameters
\n+

Returns the next uint32_t in sequence.

Parameters
\n \n- \n- \n+ \n
dataarray of double values
nnumber of elements in data
prng_stateObject containing the state of a PRNG
\n
\n
\n-
Returns
statistics for data
\n+
Returns
A pseudorandom uint32_t value
\n \n
\n
\n-\n-

◆ brahe_lcm()

\n+\n+

◆ brahe_prng_range()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n \n \n \n \n- \n- \n- \n- \n- \n- \n- \n- \n-
uint64_t brahe_lcm uint32_t brahe_prng_range (const uint64_t x, brahe_prng_state_tprng_state,
const uint64_t y 
)
\n-
\n-

Calculates the lowest common multiple for two values.

Parameters
\n- \n- \n- \n-
xfirst value
ysecond value
\n-
\n-
\n-
Returns
The lowest common multiple for x and y
\n-\n-
\n-
\n-\n-

◆ brahe_log2base()

\n-\n-
\n-
\n- \n- \n- \n- \n- \n- \n+ \n+ \n \n \n \n \n- \n- \n+ \n+ \n \n \n \n \n \n \n
double brahe_log2base (const double x, const uint32_t lo,
const double base const uint32_t hi 
)
\n
\n-

Calculates the base-n logarithm for a given value. If a range error occurs, the return value equals NaN.

Parameters
\n+

Returns the next int_value between lo and hi, inclusive.

Parameters
\n \n- \n- \n+ \n+ \n+ \n
xvalue for which logarithm is required
baselagarithm base
prng_stateObject containing the state of a PRNG
lo- Minimum value of result
hi- Maximum value of result
\n
\n
\n-
Returns
logarithm of x to base base; NAN on range error
\n+
Returns
A pseudorandom uint32_t value
\n \n
\n
\n-\n-

◆ brahe_make_sinusoid()

\n+\n+

◆ brahe_prng_real1()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n+ \n+ \n \n- \n- \n \n
double * brahe_make_sinusoid double brahe_prng_real1 (const brahe_wave_factor_tfactors,
const size_t factor_n,
const size_t array_n 
brahe_prng_state_tprng_state))
\n
\n-

Generates an array of doubles by combining sine waves. The primary purpose is to produce an artificial signal with known properties, for testing signal analysis applications. The caller is responsible for freeing the memory used by the array returned by this function.

Parameters
\n+

Returns the next real number in the range [0,1], i.e., a number greater than or equal to 0 and less than or equal to 1. Provides 32-bit precision.

Parameters
\n \n- \n- \n- \n+ \n
factorsdefines properties of the sine waves to be combined
factor_nnumber of elements in factors
array_nnumber of elements in the output array
prng_stateObject containing the state of a PRNG
\n
\n
\n-
Returns
an allocated array containg values generated from the given factors
\n+
Returns
A pseudorandom double value
\n \n
\n
\n-\n-

◆ brahe_moving_average()

\n+\n+

◆ brahe_prng_real2()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n+ \n+ \n \n- \n- \n \n
double * brahe_moving_average double brahe_prng_real2 (const double * data,
const int n,
const int distance 
brahe_prng_state_tprng_state))
\n
\n-

Computes the moving average for an array. The returned buffer must be freed by the calling code.

Parameters
\n+

Returns the next real number in the range [0,1), i.e., a number greater than or equal to 0 and less than 1. Provides 32-bit precision.

Parameters
\n \n- \n- \n- \n+ \n
dataarray of double values to be averaged
nnumber of elements in data
distancenumber elements to average before and after an element in data
prng_stateObject containing the state of a PRNG
\n
\n
\n-
Returns
an allocated n-length array containing the moving average of corresponding elements in data
\n+
Returns
A pseudorandom double value
\n \n
\n
\n-\n-

◆ brahe_pretty_int()

\n+\n+

◆ brahe_prng_real3()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n+ \n+ \n \n- \n- \n \n
char * brahe_pretty_int double brahe_prng_real3 (int64_t n,
brahe_pretty_format fmt 
brahe_prng_state_tprng_state))
\n
\n-

Returns a nicely formatted strong for a given 64-bit integer.

Parameters
\n+

Returns the next real number in the range (0,1), i.e., a number greater than 0 and less than 1. Provides 32-bit precision.

Parameters
\n \n- \n- \n+ \n
nnumber to be formatted
fmtspecifies format, as text or comma-delimited
prng_stateObject containing the state of a PRNG
\n
\n
\n-
Returns
an allocated string containing the generated text
\n+
Returns
A pseudorandom double value
\n \n
\n
\n-\n-

◆ brahe_round_nearest()

\n+\n+

◆ brahe_prng_real53()

\n \n
\n
\n \n \n- \n+ \n \n- \n- \n+ \n+ \n \n \n
double brahe_round_nearest double brahe_prng_real53 (const double x)brahe_prng_state_tprng_state)
\n
\n-

Rounds a value to nearest integer, rounding to even for exact fractions of 0.5.

\n-\n-
\n-
\n-\n-

◆ brahe_sigdig()

\n-\n-
\n-
\n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n-
double brahe_sigdig (const double x,
const uint16_t n 
)
\n-
\n-

Returns the given value rounded for the number of specified decimal digits of precision.

Parameters
\n+

Returns the next real number in the range [0,1), i.e., a number greater than or equal to 0 and less than 1. Provides 53-bit precision.

Parameters
\n \n- \n- \n+ \n
x- Original value to be rounded
n- Number of significant digits
prng_stateObject containing the state of a PRNG
\n
\n
\n-
Returns
The value x rounded to n digits of precision
\n+
Returns
A pseudorandom double value
\n \n
\n
\n-\n-

◆ brahe_simple_fft()

\n+

Variable Documentation

\n+\n+

◆ BRAHE_UNKNOWN_SEED

\n \n
\n
\n+\n+ \n+ \n+ \n+ \n+
\n \n \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n-
double * brahe_simple_fft (const double * data,
const int n 
)
\n-
\n-

A simple real-to-real FFT for arbitrary-length data. This is not intended to replace dedicated libraries such as FFTW. The caller is responsible for freeing the memory used by the array returned by this function. /param data input array /param n length of data /return an allocated array containing the real FFT of data

\n-\n-
\n-\n-\n-

◆ brahe_simple_fft2()

\n-\n-
\n-
\n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n- \n-
double * brahe_simple_fft2 (const double * data,
const int n 
)
\n-
\n-

A simple real-to-real FFT for power of 2-length data. This is not intended to replace dedicated libraries such as FFTW. The caller is responsible for freeing the memory used by the array returned by this function. /param data input array /param n length of data /return an allocated array containing the real FFT of data

\n-\n-
\n-
\n-\n-

◆ brahe_sizepow2()

\n-\n-
\n-
\n- \n- \n- \n- \n- \n- \n- \n+ \n \n
int brahe_sizepow2 (const int n)uint32_t BRAHE_UNKNOWN_SEED = 0
\n+
\n+static
\n
\n-

Returns the smallest power of 2 that includes n in its range

Parameters
\n- \n- \n-
nnumber that must be less than the result
\n-
\n-
\n-
Returns
the lowest power of 2 that is greater than n, or
\n \n
\n
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,390 +1,153 @@\n ****** Brahe - a heterogenous collection of mathematical tools ******\n ***** Main_Index\n Home_Page *****\n Created by Scott_Robert_Ladd\n ===============================================================================\n * src\n-Data_Structures | Macros | Typedefs | Enumerations | Functions\n-mathtools.h File Reference\n-#include \n-#include \n-#include \n-#include \n-#include \n-#include \n+Data_Structures | Enumerations | Functions | Variables\n+prng.h File Reference\n+#include \"mathtools.h\"\n Go_to_the_source_code_of_this_file.\n Data Structures\n-struct \u00a0brahe_statistics_t\n-\u00a0 Structure containing statistical values calculate from a double array.\n- More...\n+struct \u00a0brahe_prng_state_t\n+\u00a0 Contains state variables for a PRNG. More...\n \u00a0\n-struct \u00a0brahe_wave_factor_t\n-\u00a0 Sine wave definition. More...\n-\u00a0\n- Macros\n-#define\u00a0BRAHE_E\u00a0\u00a0\u00a02.71828182845904523536028747135\n-\u00a0 e (natural logarithm base\n-\u00a0\n-#define\u00a0BRAHE_LOG2_E\u00a0\u00a0\u00a01.44269504088896340735992468100\n-\u00a0 log_2 (e)\n-\u00a0\n-#define\u00a0BRAHE_LOG10_E\u00a0\u00a0\u00a00.43429448190325182765112891892\n-\u00a0 log_10 (e)\n-\u00a0\n-#define\u00a0BRAHE_SQRT_2\u00a0\u00a0\u00a01.41421356237309504880168872421\n-\u00a0 sqrt(2)\n-\u00a0\n-#define\u00a0BRAHE_SQRT_HALF\u00a0\u00a0\u00a00.70710678118654752440084436210\n-\u00a0 sqrt(1/2)\n-\u00a0\n-#define\u00a0BRAHE_SQRT_3\u00a0\u00a0\u00a01.73205080756887729352744634151\n-\u00a0 sqrt(3)\n-\u00a0\n-#define\u00a0BRAHE_PI\u00a0\u00a0\u00a03.14159265358979323846264338328\n-\u00a0 pi (180 deg)\n-\u00a0\n-#define\u00a0BRAHE_TAU\u00a0\u00a0\u00a06.28318530717958647692528676656\n-\u00a0 tau (2 * pi)\n-\u00a0\n-#define\u00a0BRAHE_PI_DIV_2\u00a0\u00a0\u00a01.57079632679489661923132169164\n-\u00a0 pi/2 (90 deg)\n-\u00a0\n-#define\u00a0BRAHE_PI_DIV_3\u00a0\u00a0\u00a01.04719755119659774615421446109\n-\u00a0 pi/3 (60 deg)\n-\u00a0\n-#define\u00a0BRAHE_PI_DIV_4\u00a0\u00a0\u00a00.78539816339744830961566084582\n-\u00a0 pi/4 (45 deg)\n-\u00a0\n-#define\u00a0BRAHE_PI_DIV_6\u00a0\u00a0\u00a00.52359877559829887307710723055\n-\u00a0 pi/6 (30 deg)\n-\u00a0\n-#define\u00a0BRAHE_PI_DIV_9\u00a0\u00a0\u00a00.34906585039886591538473815370\n-\u00a0 pi/9 (20 deg)\n-\u00a0\n-#define\u00a0BRAHE_PI_DIV_12\u00a0\u00a0\u00a00.26179938779914943653855361527\n-\u00a0 pi / 12 (15 deg)\n-\u00a0\n-#define\u00a0BRAHE_PI_DIV_18\u00a0\u00a0\u00a00.17453292519943295769236907685\n-\u00a0 pi / 18 (10 deg)\n-\u00a0\n-#define\u00a0BRAHE_PI_DIV_36\u00a0\u00a0\u00a00.08726646259971647884618453842\n-\u00a0 pi / 36 (5 deg)\n-\u00a0\n-#define\u00a0BRAHE_DEG_PER_RAD\u00a0\u00a0\u00a057.2957795130823208767981548141\n-\u00a0 degrees per radian\n-\u00a0\n-#define\u00a0BRAHE_RAD_PER_DEG\u00a0\u00a0\u00a00.01745329251994329576923690768\n-\u00a0 radians per degree\n-\u00a0\n-#define\u00a0BRAHE_SQRT_PI\u00a0\u00a0\u00a01.77245385090551602729816748334\n-\u00a0 sqrt(pi)\n-\u00a0\n-#define\u00a0BRAHE_TWO_DIV_SQRT_PI\u00a0\u00a0\u00a01.12837916709551257389615890312\n-\u00a0 2/sqrt(pi)\n-\u00a0\n-#define\u00a0BRAHE_ONE_DIV_PI\u00a0\u00a0\u00a00.31830988618379067153776752675\n-\u00a0 1/pi\n-\u00a0\n-#define\u00a0BRAHE_TWO_DIV_PI\u00a0\u00a0\u00a00.63661977236758134307553505349\n-\u00a0 2/pi\n-\u00a0\n-#define\u00a0BRAHE_LN_10\u00a0\u00a0\u00a02.30258509299404568401799145468\n-\u00a0 ln(10)\n+ Enumerations\n+enum brahe_prng_type_t {\n+ \u00a0\u00a0\u00a0BRAHE_PRNG_MARSENNE_TWISTER = 0 , BRAHE_PRNG_KISS , BRAHE_PRNG_CMWC4096 ,\n+ BRAHE_PRNG_MWC1038 ,\n+ \u00a0\u00a0BRAHE_PRNG_ISAAC\n+ }\n+\u00a0 Defines types of prngs. More...\n \u00a0\n-#define\u00a0BRAHE_LN_2\u00a0\u00a0\u00a00.69314718055994530941723212146\n-\u00a0 ln(2)\n+ Functions\n+ bool\u00a0brahe_prng_init (brahe_prng_state_t *prng_state, const\n+ brahe_prng_type_t type, const uint32_t seed)\n+\u00a0 Initialize a psuedo-random number generator (PRNG)\n \u00a0\n-#define\u00a0BRAHE_LOG_2\u00a0\u00a0\u00a00.30102999566398119521373889472\n-\u00a0 log(2)\n+ void\u00a0brahe_prng_free (brahe_prng_state_t *prng_state)\n+\u00a0 Free resources used by PRNG.\n \u00a0\n-#define\u00a0BRAHE_LN_PI\u00a0\u00a0\u00a01.14472988584940017414342735135\n-\u00a0 ln(pi)\n+uint32_t\u00a0brahe_prng_next (brahe_prng_state_t *prng_state)\n+\u00a0 Get the next integer.\n \u00a0\n-#define\u00a0BRAHE_EULER\u00a0\u00a0\u00a00.57721566490153286060651209008\n-\u00a0 Euler constant.\n+uint32_t\u00a0brahe_prng_range (brahe_prng_state_t *prng_state, const uint32_t lo,\n+ const uint32_t hi)\n+\u00a0 Get the next integer in the range [lo,hi].\n \u00a0\n- Typedefs\n-typedef enum brahe_pretty_format_t\u00a0brahe_pretty_format\n-\u00a0 Formats for pretty-printing integers.\n+ size_t\u00a0brahe_prng_index (brahe_prng_state_t *prng_state, const size_t\n+ length)\n+\u00a0 Get the next random value as a size_t index.\n \u00a0\n- typedef struct brahe_statistics_t\u00a0brahe_statistics\n-\u00a0 Structure containing statistical values\n- calculate from a double array.\n+ double\u00a0brahe_prng_real1 (brahe_prng_state_t *prng_state)\n+\u00a0 Get the next number in the range [0,1].\n \u00a0\n- Enumerations\n-enum \u00a0brahe_pretty_format_t { BRAHE_PRETTY_TEXT , BRAHE_PRETTY_COMMA }\n-\u00a0 Formats for pretty-printing integers. More...\n+ double\u00a0brahe_prng_real2 (brahe_prng_state_t *prng_state)\n+\u00a0 Get the next number in the range [0,1)\n \u00a0\n- Functions\n- double\u00a0brahe_round_nearest (const double x)\n-\u00a0 Round to nearest value.\n+ double\u00a0brahe_prng_real3 (brahe_prng_state_t *prng_state)\n+\u00a0 Get the next number in the range (0,1)\n \u00a0\n- double\u00a0brahe_sigdig (const double x, const uint16_t n)\n-\u00a0 Set number of significant digits in a floating-point value.\n+ double\u00a0brahe_prng_real53 (brahe_prng_state_t *prng_state)\n+\u00a0 Get the next number in the range [0,1)\n \u00a0\n- uint64_t\u00a0brahe_lcm (const uint64_t x, const uint64_t y)\n-\u00a0 Lowest common multiple.\n+ Variables\n+static uint32_t\u00a0BRAHE_UNKNOWN_SEED = 0\n \u00a0\n- uint64_t\u00a0brahe_gcf (uint64_t x, uint64_t y)\n-\u00a0 Greatest common factor (denominator)\n-\u00a0\n- double\u00a0brahe_log2base (const double x, const double base)\n-\u00a0 Logarithm to a specified base.\n-\u00a0\n- int\u00a0brahe_sizepow2 (const int n)\n-\u00a0 Smallest power of 2 that includes a given value.\n-\u00a0\n- char *\u00a0brahe_pretty_int (int64_t n, brahe_pretty_format fmt)\n-\u00a0 Turn a 64-bit integer into a pretty string.\n-\u00a0\n-brahe_statistics\u00a0brahe_get_statistics (double *data, size_t n)\n-\u00a0 statistics for array of double\n-\u00a0\n- double *\u00a0brahe_moving_average (const double *data, const int n, const\n- int distance)\n-\u00a0 Moving average.\n-\u00a0\n- double *\u00a0brahe_simple_fft (const double *data, const int n)\n-\u00a0 Simple real-to-real fft (arbitrary length)\n-\u00a0\n- double *\u00a0brahe_simple_fft2 (const double *data, const int n)\n-\u00a0 Simple real-to-real fft (power of 2 length)\n-\u00a0\n- double *\u00a0brahe_make_sinusoid (const brahe_wave_factor_t *factors,\n- const size_t factor_n, const size_t array_n)\n-\u00a0 Sine wave based artificial signal generator.\n-\u00a0\n- void\u00a0brahe_add_noise (double *a, const size_t n, double noise)\n-\u00a0 Apply noise to a signal.\n-\u00a0\n- double\u00a0brahe_asinh (const double x)\n-\u00a0 Hyperbolic arcsine.\n-\u00a0\n- double\u00a0brahe_acosh (const double x)\n-\u00a0 Hyperbolic arccosine.\n-\u00a0\n- double\u00a0brahe_atanh (const double x)\n-\u00a0 Hyperbolic arctangent.\n-\u00a0\n-***** Macro Definition Documentation *****\n-***** \u25c6\u00a0BRAHE_DEG_PER_RAD *****\n-#define BRAHE_DEG_PER_RAD\u00a0\u00a0\u00a057.2957795130823208767981548141\n-***** \u25c6\u00a0BRAHE_E *****\n-#define BRAHE_E\u00a0\u00a0\u00a02.71828182845904523536028747135\n-***** \u25c6\u00a0BRAHE_EULER *****\n-#define BRAHE_EULER\u00a0\u00a0\u00a00.57721566490153286060651209008\n-***** \u25c6\u00a0BRAHE_LN_10 *****\n-#define BRAHE_LN_10\u00a0\u00a0\u00a02.30258509299404568401799145468\n-***** \u25c6\u00a0BRAHE_LN_2 *****\n-#define BRAHE_LN_2\u00a0\u00a0\u00a00.69314718055994530941723212146\n-***** \u25c6\u00a0BRAHE_LN_PI *****\n-#define BRAHE_LN_PI\u00a0\u00a0\u00a01.14472988584940017414342735135\n-***** \u25c6\u00a0BRAHE_LOG10_E *****\n-#define BRAHE_LOG10_E\u00a0\u00a0\u00a00.43429448190325182765112891892\n-***** \u25c6\u00a0BRAHE_LOG2_E *****\n-#define BRAHE_LOG2_E\u00a0\u00a0\u00a01.44269504088896340735992468100\n-***** \u25c6\u00a0BRAHE_LOG_2 *****\n-#define BRAHE_LOG_2\u00a0\u00a0\u00a00.30102999566398119521373889472\n-***** \u25c6\u00a0BRAHE_ONE_DIV_PI *****\n-#define BRAHE_ONE_DIV_PI\u00a0\u00a0\u00a00.31830988618379067153776752675\n-***** \u25c6\u00a0BRAHE_PI *****\n-#define BRAHE_PI\u00a0\u00a0\u00a03.14159265358979323846264338328\n-***** \u25c6\u00a0BRAHE_PI_DIV_12 *****\n-#define BRAHE_PI_DIV_12\u00a0\u00a0\u00a00.26179938779914943653855361527\n-***** \u25c6\u00a0BRAHE_PI_DIV_18 *****\n-#define BRAHE_PI_DIV_18\u00a0\u00a0\u00a00.17453292519943295769236907685\n-***** \u25c6\u00a0BRAHE_PI_DIV_2 *****\n-#define BRAHE_PI_DIV_2\u00a0\u00a0\u00a01.57079632679489661923132169164\n-***** \u25c6\u00a0BRAHE_PI_DIV_3 *****\n-#define BRAHE_PI_DIV_3\u00a0\u00a0\u00a01.04719755119659774615421446109\n-***** \u25c6\u00a0BRAHE_PI_DIV_36 *****\n-#define BRAHE_PI_DIV_36\u00a0\u00a0\u00a00.08726646259971647884618453842\n-***** \u25c6\u00a0BRAHE_PI_DIV_4 *****\n-#define BRAHE_PI_DIV_4\u00a0\u00a0\u00a00.78539816339744830961566084582\n-***** \u25c6\u00a0BRAHE_PI_DIV_6 *****\n-#define BRAHE_PI_DIV_6\u00a0\u00a0\u00a00.52359877559829887307710723055\n-***** \u25c6\u00a0BRAHE_PI_DIV_9 *****\n-#define BRAHE_PI_DIV_9\u00a0\u00a0\u00a00.34906585039886591538473815370\n-***** \u25c6\u00a0BRAHE_RAD_PER_DEG *****\n-#define BRAHE_RAD_PER_DEG\u00a0\u00a0\u00a00.01745329251994329576923690768\n-***** \u25c6\u00a0BRAHE_SQRT_2 *****\n-#define BRAHE_SQRT_2\u00a0\u00a0\u00a01.41421356237309504880168872421\n-***** \u25c6\u00a0BRAHE_SQRT_3 *****\n-#define BRAHE_SQRT_3\u00a0\u00a0\u00a01.73205080756887729352744634151\n-***** \u25c6\u00a0BRAHE_SQRT_HALF *****\n-#define BRAHE_SQRT_HALF\u00a0\u00a0\u00a00.70710678118654752440084436210\n-***** \u25c6\u00a0BRAHE_SQRT_PI *****\n-#define BRAHE_SQRT_PI\u00a0\u00a0\u00a01.77245385090551602729816748334\n-***** \u25c6\u00a0BRAHE_TAU *****\n-#define BRAHE_TAU\u00a0\u00a0\u00a06.28318530717958647692528676656\n-***** \u25c6\u00a0BRAHE_TWO_DIV_PI *****\n-#define BRAHE_TWO_DIV_PI\u00a0\u00a0\u00a00.63661977236758134307553505349\n-***** \u25c6\u00a0BRAHE_TWO_DIV_SQRT_PI *****\n-#define BRAHE_TWO_DIV_SQRT_PI\u00a0\u00a0\u00a01.12837916709551257389615890312\n-***** Typedef Documentation *****\n-***** \u25c6\u00a0brahe_pretty_format *****\n-typedef enum brahe_pretty_format_t brahe_pretty_format\n-***** \u25c6\u00a0brahe_statistics *****\n-typedef struct brahe_statistics_t brahe_statistics\n ***** Enumeration Type Documentation *****\n-***** \u25c6\u00a0brahe_pretty_format_t *****\n-enum brahe_pretty_format_t\n+***** \u25c6\u00a0brahe_prng_type_t *****\n+enum brahe_prng_type_t\n Enumerator\n-BRAHE_PRETTY_TEXT\u00a0 english text (nine thousand, two hundred eleven)\n-BRAHE_PRETTY_COMMA\u00a0comma delimited, (1,234,567,890)\n+BRAHE_PRNG_MARSENNE_TWISTER\u00a0Marsenne Twister (Matsumoto & Nishimura)\n+BRAHE_PRNG_KISS\u00a0 Keep is Simple, Stupid (Marsaglia)\n+BRAHE_PRNG_CMWC4096\u00a0 CMWC4096 (Marsaglia)\n+BRAHE_PRNG_MWC1038\u00a0 MWC1038 (Marsaglia)\n+BRAHE_PRNG_ISAAC\u00a0 Indirect, Shift, Accumulate, Add, and Count\n+ (Jenkins)\n ***** Function Documentation *****\n-***** \u25c6\u00a0brahe_acosh() *****\n-double brahe_acosh ( const double\u00a0x )\n-Calculates cosh-1.\n- Parameters\n- x a value\n- Returns\n- inverse hyperbolic cosine of x\n-***** \u25c6\u00a0brahe_add_noise() *****\n-void brahe_add_noise ( double *\u00a0 a,\n- const size_t\u00a0n,\n- double\u00a0 noise\u00a0\n- )\n-Adds a percentage of noise to a signal. If \"noise\" is set to 0.1 (for example)\n-each value will be adjust to between 90% and 110% of its original value. This\n-function changes the existing values in the array.\n- Parameters\n- a array containing signal data\n- n number of samples in signal\n- noise percentage of noise\n-***** \u25c6\u00a0brahe_asinh() *****\n-double brahe_asinh ( const double\u00a0x )\n-Calculates sinh-1.\n- Parameters\n- x a value\n- Returns\n- inverse hyperbolic sine of x\n-***** \u25c6\u00a0brahe_atanh() *****\n-double brahe_atanh ( const double\u00a0x )\n-Calculates tanh-1.\n- Parameters\n- x a value\n- Returns\n- inverse hyperbolic tangent of x\n-***** \u25c6\u00a0brahe_gcf() *****\n-uint64_t brahe_gcf ( uint64_t\u00a0x,\n- uint64_t\u00a0y\u00a0\n- )\n-Calculates the greatest common factor for two values.\n- Parameters\n- x first value\n- y second value\n- Returns\n- The greatest common factor for x and y\n-***** \u25c6\u00a0brahe_get_statistics() *****\n-brahe_statistics brahe_get_statistics ( double *\u00a0data,\n- size_t\u00a0 n\u00a0\n- )\n-Calculate several common statistics for an array of doubles.\n- Parameters\n- data array of double values\n- n number of elements in data\n- Returns\n- statistics for data\n-***** \u25c6\u00a0brahe_lcm() *****\n-uint64_t brahe_lcm ( const uint64_t\u00a0x,\n- const uint64_t\u00a0y\u00a0\n- )\n-Calculates the lowest common multiple for two values.\n- Parameters\n- x first value\n- y second value\n- Returns\n- The lowest common multiple for x and y\n-***** \u25c6\u00a0brahe_log2base() *****\n-double brahe_log2base ( const double\u00a0x,\n- const double\u00a0base\u00a0\n- )\n-Calculates the base-n logarithm for a given value. If a range error occurs, the\n-return value equals NaN.\n- Parameters\n- x value for which logarithm is required\n- base lagarithm base\n- Returns\n- logarithm of x to base base; NAN on range error\n-***** \u25c6\u00a0brahe_make_sinusoid() *****\n-double * brahe_make_sinusoid ( const brahe_wave_factor_t *\u00a0factors,\n- const size_t\u00a0 factor_n,\n- const size_t\u00a0 array_n\u00a0\n- )\n-Generates an array of doubles by combining sine waves. The primary purpose is\n-to produce an artificial signal with known properties, for testing signal\n-analysis applications. The caller is responsible for freeing the memory used by\n-the array returned by this function.\n- Parameters\n- factors defines properties of the sine waves to be combined\n- factor_n number of elements in factors\n- array_n number of elements in the output array\n- Returns\n- an allocated array containg values generated from the given factors\n-***** \u25c6\u00a0brahe_moving_average() *****\n-double * brahe_moving_average ( const double *\u00a0data,\n- const int\u00a0 n,\n- const int\u00a0 distance\u00a0\n- )\n-Computes the moving average for an array. The returned buffer must be freed by\n-the calling code.\n- Parameters\n- data array of double values to be averaged\n- n number of elements in data\n- distance number elements to average before and after an element in data\n- Returns\n- an allocated n-length array containing the moving average of\n- corresponding elements in data\n-***** \u25c6\u00a0brahe_pretty_int() *****\n-char * brahe_pretty_int ( int64_t\u00a0 n,\n- brahe_pretty_format\u00a0fmt\u00a0\n+***** \u25c6\u00a0brahe_prng_free() *****\n+void brahe_prng_free ( brahe_prng_state_t *\u00a0prng_state )\n+Frees the resources used by a PRNG\n+ Parameters\n+ prng_state Object containing the state of a PRNG\n+ Returns\n+ true if successful, false if failed\n+***** \u25c6\u00a0brahe_prng_index() *****\n+size_t brahe_prng_index ( brahe_prng_state_t *\u00a0prng_state,\n+ const size_t\u00a0 length\u00a0\n )\n-Returns a nicely formatted strong for a given 64-bit integer.\n+Returns the next value as a size_t \"index\" in the range [0,length).\n Parameters\n- n number to be formatted\n- fmt specifies format, as text or comma-delimited\n+ prng_state Object containing the state of a PRNG\n+ length - Maximum value of result\n Returns\n- an allocated string containing the generated text\n-***** \u25c6\u00a0brahe_round_nearest() *****\n-double brahe_round_nearest ( const double\u00a0x )\n-Rounds a value to nearest integer, rounding to even for exact fractions of 0.5.\n-***** \u25c6\u00a0brahe_sigdig() *****\n-double brahe_sigdig ( const double\u00a0 x,\n- const uint16_t\u00a0n\u00a0\n- )\n-Returns the given value rounded for the number of specified decimal digits of\n-precision.\n+ A pseudorandom size_t value\n+***** \u25c6\u00a0brahe_prng_init() *****\n+bool brahe_prng_init ( brahe_prng_state_t *\u00a0 prng_state,\n+ const brahe_prng_type_t\u00a0type,\n+ const uint32_t\u00a0 seed\u00a0\n+ )\n+Initializes a psuedo-random number generator using a specified algorithm.\n Parameters\n- x - Original value to be rounded\n- n - Number of significant digits\n- Returns\n- The value x rounded to n digits of precision\n-***** \u25c6\u00a0brahe_simple_fft() *****\n-double * brahe_simple_fft ( const double *\u00a0data,\n- const int\u00a0 n\u00a0\n+ prng_state Object to be initialized for a specific algorithm\n+ type Algorithm to be used for this PRNG\n+ seed Initialization seed\n+ Returns\n+ true if successful, false if failed\n+***** \u25c6\u00a0brahe_prng_next() *****\n+uint32_t brahe_prng_next ( brahe_prng_state_t *\u00a0prng_state )\n+Returns the next uint32_t in sequence.\n+ Parameters\n+ prng_state Object containing the state of a PRNG\n+ Returns\n+ A pseudorandom uint32_t value\n+***** \u25c6\u00a0brahe_prng_range() *****\n+uint32_t brahe_prng_range ( brahe_prng_state_t *\u00a0prng_state,\n+ const uint32_t\u00a0 lo,\n+ const uint32_t\u00a0 hi\u00a0\n )\n-A simple real-to-real FFT for arbitrary-length data. This is not intended to\n-replace dedicated libraries such as FFTW. The caller is responsible for freeing\n-the memory used by the array returned by this function. /param data input array\n-/param n length of data /return an allocated array containing the real FFT of\n-data\n-***** \u25c6\u00a0brahe_simple_fft2() *****\n-double * brahe_simple_fft2 ( const double *\u00a0data,\n- const int\u00a0 n\u00a0\n- )\n-A simple real-to-real FFT for power of 2-length data. This is not intended to\n-replace dedicated libraries such as FFTW. The caller is responsible for freeing\n-the memory used by the array returned by this function. /param data input array\n-/param n length of data /return an allocated array containing the real FFT of\n-data\n-***** \u25c6\u00a0brahe_sizepow2() *****\n-int brahe_sizepow2 ( const int\u00a0n )\n-Returns the smallest power of 2 that includes n in its range\n+Returns the next int_value between lo and hi, inclusive.\n Parameters\n- n number that must be less than the result\n- Returns\n- the lowest power of 2 that is greater than n, or\n+ prng_state Object containing the state of a PRNG\n+ lo - Minimum value of result\n+ hi - Maximum value of result\n+ Returns\n+ A pseudorandom uint32_t value\n+***** \u25c6\u00a0brahe_prng_real1() *****\n+double brahe_prng_real1 ( brahe_prng_state_t *\u00a0prng_state )\n+Returns the next real number in the range [0,1], i.e., a number greater than or\n+equal to 0 and less than or equal to 1. Provides 32-bit precision.\n+ Parameters\n+ prng_state Object containing the state of a PRNG\n+ Returns\n+ A pseudorandom double value\n+***** \u25c6\u00a0brahe_prng_real2() *****\n+double brahe_prng_real2 ( brahe_prng_state_t *\u00a0prng_state )\n+Returns the next real number in the range [0,1), i.e., a number greater than or\n+equal to 0 and less than 1. Provides 32-bit precision.\n+ Parameters\n+ prng_state Object containing the state of a PRNG\n+ Returns\n+ A pseudorandom double value\n+***** \u25c6\u00a0brahe_prng_real3() *****\n+double brahe_prng_real3 ( brahe_prng_state_t *\u00a0prng_state )\n+Returns the next real number in the range (0,1), i.e., a number greater than 0\n+and less than 1. Provides 32-bit precision.\n+ Parameters\n+ prng_state Object containing the state of a PRNG\n+ Returns\n+ A pseudorandom double value\n+***** \u25c6\u00a0brahe_prng_real53() *****\n+double brahe_prng_real53 ( brahe_prng_state_t *\u00a0prng_state )\n+Returns the next real number in the range [0,1), i.e., a number greater than or\n+equal to 0 and less than 1. Provides 53-bit precision.\n+ Parameters\n+ prng_state Object containing the state of a PRNG\n+ Returns\n+ A pseudorandom double value\n+***** Variable Documentation *****\n+***** \u25c6\u00a0BRAHE_UNKNOWN_SEED *****\n+uint32_t BRAHE_UNKNOWN_SEED = 0 static\n ===============================================================================\n \u00a9 2011 Scott Robert Ladd. All rights reserved.\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n"}]}, {"source1": "./usr/share/doc/libbrahe-dev/html/a00005_source.html", "source2": "./usr/share/doc/libbrahe-dev/html/a00005_source.html", "unified_diff": "@@ -17,15 +17,15 @@\n \n

\n \n
\n
\n
\n-
mathtools.h
\n+
prng.h
\n
\n
\n Go to the documentation of this file.
1/*
\n
2 Brahe is a heterogenous collection of mathematical tools, written in Standard C.
\n
3
\n
4 Copyright 2011 Scott Robert Ladd. All rights reserved.
\n
5
\n@@ -72,246 +72,108 @@\n
46 The author can be contacted at:
\n
47
\n
48 scott.ladd@coyotegulch.com
\n
49 scott.ladd@gmail.com
\n
50 http:www.coyotegulch.com
\n
51*/
\n
52
\n-
53#if !defined(LIBBRAHE_MATHTOOLS_H)
\n-
54#define LIBBRAHE_MATHTOOLS_H
\n+
53#if !defined(LIBBRAHE_PRNG_H)
\n+
54#define LIBBRAHE_PRNG_H
\n
55
\n-
56#include <stddef.h>
\n-
57#include <math.h>
\n-
58#include <limits.h>
\n-
59#include <float.h>
\n-
60
\n-
61#if defined(__cplusplus)
\n-
62extern "C" {
\n-
63#endif
\n-
64
\n-
65#if defined(_MSC_VER)
\n-
66#pragma warning (disable: 4244 4267 4996)
\n-
67#if !defined(__cplusplus)
\n-
68typedef char bool;
\n-
69static const int true = 1;
\n-
70static const int false = 0;
\n-
71#endif
\n-
72typedef unsigned __int64 uint64_t;
\n-
73typedef __int64 int64_t;
\n-
74typedef unsigned __int32 uint32_t;
\n-
75typedef __int32 int32_t;
\n-
76typedef unsigned __int16 uint16_t;
\n-
77typedef __int16 int16_t;
\n-
78typedef unsigned __int8 uint8_t;
\n-
79typedef __int8 int8_t;
\n-
80#else
\n-
81// ISO C standard compilers
\n-
82#include <stdbool.h>
\n-
83#include <stdint.h>
\n-
84#endif
\n-
85
\n-
86//-----------------------------------------------------------------------------
\n-
87// Rounding
\n-
88//-----------------------------------------------------------------------------
\n+
56#include "mathtools.h"
\n+
57
\n+
58#if defined(__cplusplus)
\n+
59extern "C" {
\n+
60#endif
\n+
61
\n+\n+
76
\n+
\n+
78typedef struct
\n+
79{
\n+
80 brahe_prng_type_t m_type; // the algorithm we're using
\n+
81 uint32_t m_seed; // "seed" that defines the sequence
\n+
82 void * m_data1; // array or table
\n+
83 void * m_data2; // additional array or table
\n+
84 size_t m_i; // only used by some algorithms
\n+
85 size_t m_a; // only used by some algorithms
\n+
86 size_t m_b; // only used by some algorithms
\n+
87 size_t m_c; // only used by some algorithms
\n+\n+
\n
89
\n+
90static uint32_t BRAHE_UNKNOWN_SEED = 0;
\n
91
\n-
94double brahe_round_nearest(const double x);
\n-
95
\n-
97
\n-
104double brahe_sigdig(const double x, const uint16_t n);
\n-
105
\n-
106//-----------------------------------------------------------------------------
\n-
107// Lowest Common Multple (LCM) and Lowest Common Denominator (GCD)
\n-
108//-----------------------------------------------------------------------------
\n+
93
\n+
100bool brahe_prng_init(brahe_prng_state_t * prng_state, const brahe_prng_type_t type, const uint32_t seed);
\n+
101
\n+
103
\n+\n
109
\n
111
\n-
117uint64_t brahe_lcm(const uint64_t x, const uint64_t y);
\n-
118
\n-
120
\n-
126uint64_t brahe_gcf(uint64_t x, uint64_t y);
\n+
116uint32_t brahe_prng_next(brahe_prng_state_t * prng_state);
\n+
117
\n+
119
\n+
126uint32_t brahe_prng_range(brahe_prng_state_t * prng_state, const uint32_t lo, const uint32_t hi);
\n
127
\n-
128//-----------------------------------------------------------------------------
\n-
129// Logarithms
\n-
130//-----------------------------------------------------------------------------
\n-
131
\n-
133
\n-
140double brahe_log2base(const double x, const double base);
\n-
141
\n-
143
\n-
148int brahe_sizepow2(const int n);
\n-
149
\n-
150//-----------------------------------------------------------------------------
\n-
151// Statistical functions
\n-
152//-----------------------------------------------------------------------------
\n-
153
\n-\n-\n-
163
\n-
165
\n-\n-
172
\n-
173//-----------------------------------------------------------------------------
\n-
174// Statistical functions
\n-
175//-----------------------------------------------------------------------------
\n+
129
\n+
135size_t brahe_prng_index(brahe_prng_state_t * prng_state, const size_t length);
\n+
136
\n+
138
\n+\n+
146
\n+
148
\n+\n+
156
\n+
158
\n+\n+
166
\n+
168
\n+\n
176
\n-
\n-
178typedef struct brahe_statistics_t
\n-
179{
\n-
181 double min;
\n-
183 double max;
\n-
185 double mean;
\n-
187 double variance;
\n-
189 double sigma;
\n-
190}
\n-
\n-\n-
192
\n-
194
\n-
200brahe_statistics brahe_get_statistics(double * data, size_t n);
\n-
201
\n-
203
\n-
211double * brahe_moving_average(const double * data, const int n, const int distance);
\n-
212
\n-
213//-----------------------------------------------------------------------------
\n-
214// Digital Signal Processing
\n-
215//-----------------------------------------------------------------------------
\n-
216
\n-
218
\n-
226double * brahe_simple_fft(const double * data, const int n);
\n-
227
\n-
229
\n-
237double * brahe_simple_fft2(const double * data, const int n);
\n-
238
\n-
240
\n-
\n-
243typedef struct
\n-
244{
\n-\n-
248 double amplitude;
\n-
249}
\n-
\n-\n-
251
\n-
253
\n-
263double * brahe_make_sinusoid(const brahe_wave_factor_t * factors, const size_t factor_n, const size_t array_n);
\n-
264
\n-
266
\n-
274void brahe_add_noise(double * a, const size_t n, double noise);
\n-
275
\n-
276//-----------------------------------------------------------------------------
\n-
277// Trigonometry
\n-
278//-----------------------------------------------------------------------------
\n-
280
\n-
285double brahe_asinh(const double x);
\n-
286
\n-
288
\n-
293double brahe_acosh(const double x);
\n-
294
\n-
296
\n-
301double brahe_atanh(const double x);
\n-
302
\n-
303//-----------------------------------------------------------------------------
\n-
304// Constants
\n-
305//-----------------------------------------------------------------------------
\n-
306
\n-
308#define BRAHE_E 2.71828182845904523536028747135
\n-
309
\n-
311#define BRAHE_LOG2_E 1.44269504088896340735992468100
\n-
312
\n-
314#define BRAHE_LOG10_E 0.43429448190325182765112891892
\n-
315
\n-
317#define BRAHE_SQRT_2 1.41421356237309504880168872421
\n-
318
\n-
320#define BRAHE_SQRT_HALF 0.70710678118654752440084436210
\n-
321
\n-
323#define BRAHE_SQRT_3 1.73205080756887729352744634151
\n-
324
\n-
326#define BRAHE_PI 3.14159265358979323846264338328
\n-
327
\n-
329#define BRAHE_TAU 6.28318530717958647692528676656
\n-
330
\n-
332#define BRAHE_PI_DIV_2 1.57079632679489661923132169164
\n-
333
\n-
335#define BRAHE_PI_DIV_3 1.04719755119659774615421446109
\n-
336
\n-
338#define BRAHE_PI_DIV_4 0.78539816339744830961566084582
\n-
339
\n-
341#define BRAHE_PI_DIV_6 0.52359877559829887307710723055
\n-
342
\n-
344#define BRAHE_PI_DIV_9 0.34906585039886591538473815370
\n-
345
\n-
347#define BRAHE_PI_DIV_12 0.26179938779914943653855361527
\n-
348
\n-
350#define BRAHE_PI_DIV_18 0.17453292519943295769236907685
\n-
351
\n-
353#define BRAHE_PI_DIV_36 0.08726646259971647884618453842
\n-
354
\n-
356#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141
\n-
357
\n-
359#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768
\n-
360
\n-
362#define BRAHE_SQRT_PI 1.77245385090551602729816748334
\n-
363
\n-
365#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312
\n-
366
\n-
368#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675
\n-
369
\n-
371#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349
\n-
372
\n-
374#define BRAHE_LN_10 2.30258509299404568401799145468
\n-
375
\n-
377#define BRAHE_LN_2 0.69314718055994530941723212146
\n-
378
\n-
380#define BRAHE_LOG_2 0.30102999566398119521373889472
\n-
381
\n-
383#define BRAHE_LN_PI 1.14472988584940017414342735135
\n-
384
\n-
386#define BRAHE_EULER 0.57721566490153286060651209008
\n-
387
\n-
388#if defined(__cplusplus)
\n-
389}
\n-
390#endif
\n-
391
\n-
392#endif
\n-
double brahe_log2base(const double x, const double base)
Logarithm to a specified base.
\n-
double brahe_round_nearest(const double x)
Round to nearest value.
\n-
brahe_pretty_format_t
Formats for pretty-printing integers.
Definition mathtools.h:156
\n-
@ BRAHE_PRETTY_COMMA
comma delimited, (1,234,567,890)
Definition mathtools.h:160
\n-
@ BRAHE_PRETTY_TEXT
english text (nine thousand, two hundred eleven)
Definition mathtools.h:158
\n-
char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt)
Turn a 64-bit integer into a pretty string.
\n-
double * brahe_moving_average(const double *data, const int n, const int distance)
Moving average.
\n-
int brahe_sizepow2(const int n)
Smallest power of 2 that includes a given value.
\n-
uint64_t brahe_lcm(const uint64_t x, const uint64_t y)
Lowest common multiple.
\n-
double * brahe_simple_fft2(const double *data, const int n)
Simple real-to-real fft (power of 2 length)
\n-
double brahe_sigdig(const double x, const uint16_t n)
Set number of significant digits in a floating-point value.
\n-
double brahe_asinh(const double x)
Hyperbolic arcsine.
\n-
double brahe_acosh(const double x)
Hyperbolic arccosine.
\n-
struct brahe_statistics_t brahe_statistics
Structure containing statistical values calculate from a double array.
\n-
double brahe_atanh(const double x)
Hyperbolic arctangent.
\n-
double * brahe_simple_fft(const double *data, const int n)
Simple real-to-real fft (arbitrary length)
\n-
brahe_statistics brahe_get_statistics(double *data, size_t n)
statistics for array of double
\n-
enum brahe_pretty_format_t brahe_pretty_format
Formats for pretty-printing integers.
\n-
double * brahe_make_sinusoid(const brahe_wave_factor_t *factors, const size_t factor_n, const size_t array_n)
Sine wave based artificial signal generator.
\n-
uint64_t brahe_gcf(uint64_t x, uint64_t y)
Greatest common factor (denominator)
\n-
void brahe_add_noise(double *a, const size_t n, double noise)
Apply noise to a signal.
\n-
Structure containing statistical values calculate from a double array.
Definition mathtools.h:179
\n-
double min
minimum value from array
Definition mathtools.h:181
\n-
double mean
mean (average)
Definition mathtools.h:185
\n-
double variance
variance
Definition mathtools.h:187
\n-
double max
maximum value
Definition mathtools.h:183
\n-
double sigma
standard deviation
Definition mathtools.h:189
\n-
Sine wave definition.
Definition mathtools.h:244
\n-
double amplitude
arbitrary wave amplitude
Definition mathtools.h:248
\n-
double wavelength
wavelength
Definition mathtools.h:246
\n+
177#if defined(__cplusplus)
\n+
178}
\n+
179#endif
\n+
180
\n+
181#endif
\n+\n+
size_t brahe_prng_index(brahe_prng_state_t *prng_state, const size_t length)
Get the next random value as a size_t index.
\n+
static uint32_t BRAHE_UNKNOWN_SEED
Definition prng.h:90
\n+
double brahe_prng_real2(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1)
\n+
uint32_t brahe_prng_range(brahe_prng_state_t *prng_state, const uint32_t lo, const uint32_t hi)
Get the next integer in the range [lo,hi].
\n+
bool brahe_prng_init(brahe_prng_state_t *prng_state, const brahe_prng_type_t type, const uint32_t seed)
Initialize a psuedo-random number generator (PRNG)
\n+
void brahe_prng_free(brahe_prng_state_t *prng_state)
Free resources used by PRNG.
\n+
double brahe_prng_real1(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1].
\n+
brahe_prng_type_t
Defines types of prngs.
Definition prng.h:64
\n+
@ BRAHE_PRNG_ISAAC
Indirect, Shift, Accumulate, Add, and Count (Jenkins)
Definition prng.h:74
\n+
@ BRAHE_PRNG_MARSENNE_TWISTER
Marsenne Twister (Matsumoto & Nishimura)
Definition prng.h:66
\n+
@ BRAHE_PRNG_MWC1038
MWC1038 (Marsaglia)
Definition prng.h:72
\n+
@ BRAHE_PRNG_CMWC4096
CMWC4096 (Marsaglia)
Definition prng.h:70
\n+
@ BRAHE_PRNG_KISS
Keep is Simple, Stupid (Marsaglia)
Definition prng.h:68
\n+
uint32_t brahe_prng_next(brahe_prng_state_t *prng_state)
Get the next integer.
\n+
double brahe_prng_real53(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1)
\n+
double brahe_prng_real3(brahe_prng_state_t *prng_state)
Get the next number in the range (0,1)
\n+
Contains state variables for a PRNG.
Definition prng.h:79
\n+
void * m_data2
Definition prng.h:83
\n+
size_t m_b
Definition prng.h:86
\n+
void * m_data1
Definition prng.h:82
\n+
size_t m_i
Definition prng.h:84
\n+
size_t m_a
Definition prng.h:85
\n+
size_t m_c
Definition prng.h:87
\n+
brahe_prng_type_t m_type
Definition prng.h:80
\n+
uint32_t m_seed
Definition prng.h:81
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n

\n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,14 +1,14 @@\n ****** Brahe - a heterogenous collection of mathematical tools ******\n ***** Main_Index\n Home_Page *****\n Created by Scott_Robert_Ladd\n ===============================================================================\n * src\n-mathtools.h\n+prng.h\n Go_to_the_documentation_of_this_file.\n 1/*\n 2 Brahe is a heterogenous collection of mathematical tools, written in\n Standard C.\n 3\n 4 Copyright 2011 Scott Robert Ladd. All rights reserved.\n 5\n@@ -73,326 +73,161 @@\n 46 The author can be contacted at:\n 47\n 48 scott.ladd@coyotegulch.com\n 49 scott.ladd@gmail.com\n 50 http:www.coyotegulch.com\n 51*/\n 52\n- 53#if !defined(LIBBRAHE_MATHTOOLS_H)\n- 54#define LIBBRAHE_MATHTOOLS_H\n+ 53#if !defined(LIBBRAHE_PRNG_H)\n+ 54#define LIBBRAHE_PRNG_H\n 55\n- 56#include \n- 57#include \n- 58#include \n- 59#include \n- 60\n- 61#if defined(__cplusplus)\n- 62extern \"C\" {\n- 63#endif\n- 64\n- 65#if defined(_MSC_VER)\n- 66#pragma warning (disable: 4244 4267 4996)\n- 67#if !defined(__cplusplus)\n- 68typedef char bool;\n- 69static const int true = 1;\n- 70static const int false = 0;\n- 71#endif\n- 72typedef unsigned __int64 uint64_t;\n- 73typedef __int64 int64_t;\n- 74typedef unsigned __int32 uint32_t;\n- 75typedef __int32 int32_t;\n- 76typedef unsigned __int16 uint16_t;\n- 77typedef __int16 int16_t;\n- 78typedef unsigned __int8 uint8_t;\n- 79typedef __int8 int8_t;\n- 80#else\n- 81// ISO C standard compilers\n- 82#include \n- 83#include \n- 84#endif\n- 85\n- 86//--------------------------------------------------------------------------\n----\n- 87// Rounding\n- 88//--------------------------------------------------------------------------\n----\n+ 56#include \"mathtools.h\"\n+ 57\n+ 58#if defined(__cplusplus)\n+ 59extern \"C\" {\n+ 60#endif\n+ 61\n+63typedef enum\n+ 64{\n+66 BRAHE_PRNG_MARSENNE_TWISTER = 0,\n+68 BRAHE_PRNG_KISS,\n+70 BRAHE_PRNG_CMWC4096,\n+72 BRAHE_PRNG_MWC1038,\n+ 74 BRAHE_PRNG_ISAAC\n+75} brahe_prng_type_t;\n+ 76\n+78typedef struct\n+ 79{\n+80 brahe_prng_type_t m_type; // the algorithm we're using\n+81 uint32_t m_seed; // \"seed\" that defines the sequence\n+82 void * m_data1; // array or table\n+83 void * m_data2; // additional array or table\n+84 size_t m_i; // only used by some algorithms\n+85 size_t m_a; // only used by some algorithms\n+86 size_t m_b; // only used by some algorithms\n+87 size_t m_c; // only used by some algorithms\n+ 88} brahe_prng_state_t;\n 89\n+90static uint32_t BRAHE_UNKNOWN_SEED = 0;\n 91\n-94double brahe_round_nearest(const double x);\n- 95\n- 97\n-104double brahe_sigdig(const double x, const uint16_t n);\n- 105\n- 106//-------------------------------------------------------------------------\n-----\n- 107// Lowest Common Multple (LCM) and Lowest Common Denominator (GCD)\n- 108//-------------------------------------------------------------------------\n-----\n+ 93\n+100bool brahe_prng_init(brahe_prng_state_t * prng_state, const\n+brahe_prng_type_t type, const uint32_t seed);\n+ 101\n+ 103\n+108void brahe_prng_free(brahe_prng_state_t * prng_state);\n 109\n 111\n-117uint64_t brahe_lcm(const uint64_t x, const uint64_t y);\n- 118\n- 120\n-126uint64_t brahe_gcf(uint64_t x, uint64_t y);\n+116uint32_t brahe_prng_next(brahe_prng_state_t * prng_state);\n+ 117\n+ 119\n+126uint32_t brahe_prng_range(brahe_prng_state_t * prng_state, const uint32_t\n+lo, const uint32_t hi);\n 127\n- 128//-------------------------------------------------------------------------\n-----\n- 129// Logarithms\n- 130//-------------------------------------------------------------------------\n-----\n- 131\n- 133\n-140double brahe_log2base(const double x, const double base);\n- 141\n- 143\n-148int brahe_sizepow2(const int n);\n- 149\n- 150//-------------------------------------------------------------------------\n-----\n- 151// Statistical functions\n- 152//-------------------------------------------------------------------------\n-----\n- 153\n-155typedef enum brahe_pretty_format_t\n- 156{\n-158 BRAHE_PRETTY_TEXT,\n- 160 BRAHE_PRETTY_COMMA\n-161}\n-162brahe_pretty_format;\n- 163\n- 165\n-171char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt);\n- 172\n- 173//-------------------------------------------------------------------------\n-----\n- 174// Statistical functions\n- 175//-------------------------------------------------------------------------\n-----\n+ 129\n+135size_t brahe_prng_index(brahe_prng_state_t * prng_state, const size_t\n+length);\n+ 136\n+ 138\n+145double brahe_prng_real1(brahe_prng_state_t * prng_state);\n+ 146\n+ 148\n+155double brahe_prng_real2(brahe_prng_state_t * prng_state);\n+ 156\n+ 158\n+165double brahe_prng_real3(brahe_prng_state_t * prng_state);\n+ 166\n+ 168\n+175double brahe_prng_real53(brahe_prng_state_t * prng_state);\n 176\n-178typedef struct brahe_statistics_t\n- 179{\n-181 double min;\n-183 double max;\n-185 double mean;\n-187 double variance;\n-189 double sigma;\n- 190}\n-191brahe_statistics;\n- 192\n- 194\n-200brahe_statistics brahe_get_statistics(double * data, size_t n);\n- 201\n- 203\n-211double * brahe_moving_average(const double * data, const int n, const int\n-distance);\n- 212\n- 213//-------------------------------------------------------------------------\n-----\n- 214// Digital Signal Processing\n- 215//-------------------------------------------------------------------------\n-----\n- 216\n- 218\n-226double * brahe_simple_fft(const double * data, const int n);\n- 227\n- 229\n-237double * brahe_simple_fft2(const double * data, const int n);\n- 238\n- 240\n-243typedef struct\n- 244{\n-246 double wavelength;\n-248 double amplitude;\n- 249}\n- 250brahe_wave_factor_t;\n- 251\n- 253\n-263double * brahe_make_sinusoid(const brahe_wave_factor_t * factors, const\n-size_t factor_n, const size_t array_n);\n- 264\n- 266\n-274void brahe_add_noise(double * a, const size_t n, double noise);\n- 275\n- 276//-------------------------------------------------------------------------\n-----\n- 277// Trigonometry\n- 278//-------------------------------------------------------------------------\n-----\n- 280\n-285double brahe_asinh(const double x);\n- 286\n- 288\n-293double brahe_acosh(const double x);\n- 294\n- 296\n-301double brahe_atanh(const double x);\n- 302\n- 303//-------------------------------------------------------------------------\n-----\n- 304// Constants\n- 305//-------------------------------------------------------------------------\n-----\n- 306\n-308#define BRAHE_E 2.71828182845904523536028747135\n- 309\n-311#define BRAHE_LOG2_E 1.44269504088896340735992468100\n- 312\n-314#define BRAHE_LOG10_E 0.43429448190325182765112891892\n- 315\n-317#define BRAHE_SQRT_2 1.41421356237309504880168872421\n- 318\n-320#define BRAHE_SQRT_HALF 0.70710678118654752440084436210\n- 321\n-323#define BRAHE_SQRT_3 1.73205080756887729352744634151\n- 324\n-326#define BRAHE_PI 3.14159265358979323846264338328\n- 327\n-329#define BRAHE_TAU 6.28318530717958647692528676656\n- 330\n-332#define BRAHE_PI_DIV_2 1.57079632679489661923132169164\n- 333\n-335#define BRAHE_PI_DIV_3 1.04719755119659774615421446109\n- 336\n-338#define BRAHE_PI_DIV_4 0.78539816339744830961566084582\n- 339\n-341#define BRAHE_PI_DIV_6 0.52359877559829887307710723055\n- 342\n-344#define BRAHE_PI_DIV_9 0.34906585039886591538473815370\n- 345\n-347#define BRAHE_PI_DIV_12 0.26179938779914943653855361527\n- 348\n-350#define BRAHE_PI_DIV_18 0.17453292519943295769236907685\n- 351\n-353#define BRAHE_PI_DIV_36 0.08726646259971647884618453842\n- 354\n-356#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141\n- 357\n-359#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768\n- 360\n-362#define BRAHE_SQRT_PI 1.77245385090551602729816748334\n- 363\n-365#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312\n- 366\n-368#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675\n- 369\n-371#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349\n- 372\n-374#define BRAHE_LN_10 2.30258509299404568401799145468\n- 375\n-377#define BRAHE_LN_2 0.69314718055994530941723212146\n- 378\n-380#define BRAHE_LOG_2 0.30102999566398119521373889472\n- 381\n-383#define BRAHE_LN_PI 1.14472988584940017414342735135\n- 384\n-386#define BRAHE_EULER 0.57721566490153286060651209008\n- 387\n- 388#if defined(__cplusplus)\n- 389}\n- 390#endif\n- 391\n- 392#endif\n-brahe_log2base\n-double brahe_log2base(const double x, const double base)\n-Logarithm to a specified base.\n-brahe_round_nearest\n-double brahe_round_nearest(const double x)\n-Round to nearest value.\n-brahe_pretty_format_t\n-brahe_pretty_format_t\n-Formats for pretty-printing integers.\n-Definition mathtools.h:156\n-BRAHE_PRETTY_COMMA\n-@ BRAHE_PRETTY_COMMA\n-comma delimited, (1,234,567,890)\n-Definition mathtools.h:160\n-BRAHE_PRETTY_TEXT\n-@ BRAHE_PRETTY_TEXT\n-english text (nine thousand, two hundred eleven)\n-Definition mathtools.h:158\n-brahe_pretty_int\n-char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt)\n-Turn a 64-bit integer into a pretty string.\n-brahe_moving_average\n-double * brahe_moving_average(const double *data, const int n, const int\n-distance)\n-Moving average.\n-brahe_sizepow2\n-int brahe_sizepow2(const int n)\n-Smallest power of 2 that includes a given value.\n-brahe_lcm\n-uint64_t brahe_lcm(const uint64_t x, const uint64_t y)\n-Lowest common multiple.\n-brahe_simple_fft2\n-double * brahe_simple_fft2(const double *data, const int n)\n-Simple real-to-real fft (power of 2 length)\n-brahe_sigdig\n-double brahe_sigdig(const double x, const uint16_t n)\n-Set number of significant digits in a floating-point value.\n-brahe_asinh\n-double brahe_asinh(const double x)\n-Hyperbolic arcsine.\n-brahe_acosh\n-double brahe_acosh(const double x)\n-Hyperbolic arccosine.\n-brahe_statistics\n-struct brahe_statistics_t brahe_statistics\n-Structure containing statistical values calculate from a double array.\n-brahe_atanh\n-double brahe_atanh(const double x)\n-Hyperbolic arctangent.\n-brahe_simple_fft\n-double * brahe_simple_fft(const double *data, const int n)\n-Simple real-to-real fft (arbitrary length)\n-brahe_get_statistics\n-brahe_statistics brahe_get_statistics(double *data, size_t n)\n-statistics for array of double\n-brahe_pretty_format\n-enum brahe_pretty_format_t brahe_pretty_format\n-Formats for pretty-printing integers.\n-brahe_make_sinusoid\n-double * brahe_make_sinusoid(const brahe_wave_factor_t *factors, const size_t\n-factor_n, const size_t array_n)\n-Sine wave based artificial signal generator.\n-brahe_gcf\n-uint64_t brahe_gcf(uint64_t x, uint64_t y)\n-Greatest common factor (denominator)\n-brahe_add_noise\n-void brahe_add_noise(double *a, const size_t n, double noise)\n-Apply noise to a signal.\n-brahe_statistics_t\n-Structure containing statistical values calculate from a double array.\n-Definition mathtools.h:179\n-brahe_statistics_t::min\n-double min\n-minimum value from array\n-Definition mathtools.h:181\n-brahe_statistics_t::mean\n-double mean\n-mean (average)\n-Definition mathtools.h:185\n-brahe_statistics_t::variance\n-double variance\n-variance\n-Definition mathtools.h:187\n-brahe_statistics_t::max\n-double max\n-maximum value\n-Definition mathtools.h:183\n-brahe_statistics_t::sigma\n-double sigma\n-standard deviation\n-Definition mathtools.h:189\n-brahe_wave_factor_t\n-Sine wave definition.\n-Definition mathtools.h:244\n-brahe_wave_factor_t::amplitude\n-double amplitude\n-arbitrary wave amplitude\n-Definition mathtools.h:248\n-brahe_wave_factor_t::wavelength\n-double wavelength\n-wavelength\n-Definition mathtools.h:246\n+ 177#if defined(__cplusplus)\n+ 178}\n+ 179#endif\n+ 180\n+ 181#endif\n+mathtools.h\n+brahe_prng_index\n+size_t brahe_prng_index(brahe_prng_state_t *prng_state, const size_t length)\n+Get the next random value as a size_t index.\n+BRAHE_UNKNOWN_SEED\n+static uint32_t BRAHE_UNKNOWN_SEED\n+Definition prng.h:90\n+brahe_prng_real2\n+double brahe_prng_real2(brahe_prng_state_t *prng_state)\n+Get the next number in the range [0,1)\n+brahe_prng_range\n+uint32_t brahe_prng_range(brahe_prng_state_t *prng_state, const uint32_t lo,\n+const uint32_t hi)\n+Get the next integer in the range [lo,hi].\n+brahe_prng_init\n+bool brahe_prng_init(brahe_prng_state_t *prng_state, const brahe_prng_type_t\n+type, const uint32_t seed)\n+Initialize a psuedo-random number generator (PRNG)\n+brahe_prng_free\n+void brahe_prng_free(brahe_prng_state_t *prng_state)\n+Free resources used by PRNG.\n+brahe_prng_real1\n+double brahe_prng_real1(brahe_prng_state_t *prng_state)\n+Get the next number in the range [0,1].\n+brahe_prng_type_t\n+brahe_prng_type_t\n+Defines types of prngs.\n+Definition prng.h:64\n+BRAHE_PRNG_ISAAC\n+@ BRAHE_PRNG_ISAAC\n+Indirect, Shift, Accumulate, Add, and Count (Jenkins)\n+Definition prng.h:74\n+BRAHE_PRNG_MARSENNE_TWISTER\n+@ BRAHE_PRNG_MARSENNE_TWISTER\n+Marsenne Twister (Matsumoto & Nishimura)\n+Definition prng.h:66\n+BRAHE_PRNG_MWC1038\n+@ BRAHE_PRNG_MWC1038\n+MWC1038 (Marsaglia)\n+Definition prng.h:72\n+BRAHE_PRNG_CMWC4096\n+@ BRAHE_PRNG_CMWC4096\n+CMWC4096 (Marsaglia)\n+Definition prng.h:70\n+BRAHE_PRNG_KISS\n+@ BRAHE_PRNG_KISS\n+Keep is Simple, Stupid (Marsaglia)\n+Definition prng.h:68\n+brahe_prng_next\n+uint32_t brahe_prng_next(brahe_prng_state_t *prng_state)\n+Get the next integer.\n+brahe_prng_real53\n+double brahe_prng_real53(brahe_prng_state_t *prng_state)\n+Get the next number in the range [0,1)\n+brahe_prng_real3\n+double brahe_prng_real3(brahe_prng_state_t *prng_state)\n+Get the next number in the range (0,1)\n+brahe_prng_state_t\n+Contains state variables for a PRNG.\n+Definition prng.h:79\n+brahe_prng_state_t::m_data2\n+void * m_data2\n+Definition prng.h:83\n+brahe_prng_state_t::m_b\n+size_t m_b\n+Definition prng.h:86\n+brahe_prng_state_t::m_data1\n+void * m_data1\n+Definition prng.h:82\n+brahe_prng_state_t::m_i\n+size_t m_i\n+Definition prng.h:84\n+brahe_prng_state_t::m_a\n+size_t m_a\n+Definition prng.h:85\n+brahe_prng_state_t::m_c\n+size_t m_c\n+Definition prng.h:87\n+brahe_prng_state_t::m_type\n+brahe_prng_type_t m_type\n+Definition prng.h:80\n+brahe_prng_state_t::m_seed\n+uint32_t m_seed\n+Definition prng.h:81\n ===============================================================================\n \u00a9 2011 Scott Robert Ladd. All rights reserved.\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n"}]}, {"source1": "./usr/share/doc/libbrahe-dev/html/a00011.html", "source2": "./usr/share/doc/libbrahe-dev/html/a00011.html", "unified_diff": "@@ -22,15 +22,15 @@\n
brahe_statistics_t Struct Reference
\n \n
\n \n

Structure containing statistical values calculate from a double array. \n

\n \n-

#include <mathtools.h>

\n+

#include <mathtools.h>

\n \n \n \n \n \n \n@@ -114,15 +114,15 @@\n \n

\n Data Fields

double min
 minimum value from array
 
double max
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/a00015.html", "source2": "./usr/share/doc/libbrahe-dev/html/a00015.html", "unified_diff": "@@ -22,15 +22,15 @@\n

brahe_wave_factor_t Struct Reference
\n \n
\n \n

Sine wave definition. \n More...

\n \n-

#include <mathtools.h>

\n+

#include <mathtools.h>

\n \n \n \n \n \n \n@@ -65,15 +65,15 @@\n \n

\n Data Fields

double wavelength
 wavelength
 
double amplitude
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/a00019.html", "source2": "./usr/share/doc/libbrahe-dev/html/a00019.html", "unified_diff": "@@ -22,19 +22,19 @@\n

brahe_prng_state_t Struct Reference
\n \n
\n \n

Contains state variables for a PRNG. \n

\n \n-

#include <prng.h>

\n+

#include <prng.h>

\n \n \n-\n+\n \n \n \n \n \n \n \n@@ -149,23 +149,23 @@\n \n

◆ m_type

\n \n
\n
\n

\n Data Fields

brahe_prng_type_t m_type
brahe_prng_type_t m_type
 
uint32_t m_seed
 
void * m_data1
 
void * m_data2
 
\n \n- \n+ \n \n
brahe_prng_type_t brahe_prng_state_t::m_typebrahe_prng_type_t brahe_prng_state_t::m_type
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html", "source2": "./usr/share/doc/libbrahe-dev/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html", "unified_diff": "@@ -23,17 +23,17 @@\n

\n
src Directory Reference
\n
\n
\n \n \n-\n+\n \n-\n+\n \n

\n Files

 mathtools.h
 mathtools.h
 
 prng.h
 prng.h
 
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/files.html", "source2": "./usr/share/doc/libbrahe-dev/html/files.html", "unified_diff": "@@ -19,16 +19,16 @@\n

\n
File List
\n
\n
\n
Here is a list of all files with brief descriptions:
\n
[detail level 12]
\n \n-\n-\n+\n+\n
  src
 mathtools.h
 prng.h
 mathtools.h
 prng.h
\n
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/globals.html", "source2": "./usr/share/doc/libbrahe-dev/html/globals.html", "unified_diff": "@@ -16,78 +16,78 @@\n


\n \n \n
\n
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
\n \n

- b -

\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/globals_defs.html", "source2": "./usr/share/doc/libbrahe-dev/html/globals_defs.html", "unified_diff": "@@ -14,41 +14,41 @@\n Created by Scott Robert Ladd
\n

\n
\n \n \n
\n
Here is a list of all macros with links to the files they belong to:
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/globals_enum.html", "source2": "./usr/share/doc/libbrahe-dev/html/globals_enum.html", "unified_diff": "@@ -14,16 +14,16 @@\n Created by Scott Robert Ladd
\n

\n
\n \n \n
\n
Here is a list of all enums with links to the files they belong to:
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/globals_eval.html", "source2": "./usr/share/doc/libbrahe-dev/html/globals_eval.html", "unified_diff": "@@ -14,21 +14,21 @@\n Created by Scott Robert Ladd
\n

\n
\n \n \n
\n
Here is a list of all enum values with links to the files they belong to:
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/globals_func.html", "source2": "./usr/share/doc/libbrahe-dev/html/globals_func.html", "unified_diff": "@@ -14,39 +14,39 @@\n Created by Scott Robert Ladd
\n

\n
\n \n \n
\n
Here is a list of all functions with links to the files they belong to:
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/globals_type.html", "source2": "./usr/share/doc/libbrahe-dev/html/globals_type.html", "unified_diff": "@@ -14,16 +14,16 @@\n Created by Scott Robert Ladd
\n

\n
\n \n \n
\n
Here is a list of all typedefs with links to the files they belong to:
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}, {"source1": "./usr/share/doc/libbrahe-dev/html/globals_vars.html", "source2": "./usr/share/doc/libbrahe-dev/html/globals_vars.html", "unified_diff": "@@ -14,15 +14,15 @@\n Created by Scott Robert Ladd
\n

\n
\n \n \n
\n
Here is a list of all variables with links to the files they belong to:
    \n-
  • BRAHE_UNKNOWN_SEED : prng.h
  • \n+
  • BRAHE_UNKNOWN_SEED : prng.h
  • \n
\n
\n
\n

\n © 2011 Scott Robert Ladd. All rights reserved.
\n HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.\n
\n"}]}]}]}]}