--- /srv/rebuilderd/tmp/rebuilderdflunfJ/inputs/libbrahe-dev_1.3.2-10+b2_loong64.deb
+++ /srv/rebuilderd/tmp/rebuilderdflunfJ/out/libbrahe-dev_1.3.2-10+b2_loong64.deb
├── file list
│ @@ -1,3 +1,3 @@
│ -rw-r--r-- 0 0 0 4 2026-04-27 16:35:20.000000 debian-binary
│ --rw-r--r-- 0 0 0 2220 2026-04-27 16:35:20.000000 control.tar.xz
│ --rw-r--r-- 0 0 0 80828 2026-04-27 16:35:20.000000 data.tar.xz
│ +-rw-r--r-- 0 0 0 2216 2026-04-27 16:35:20.000000 control.tar.xz
│ +-rw-r--r-- 0 0 0 80796 2026-04-27 16:35:20.000000 data.tar.xz
├── control.tar.xz
│ ├── control.tar
│ │ ├── ./md5sums
│ │ │ ├── ./md5sums
│ │ │ │┄ Files differ
├── data.tar.xz
│ ├── data.tar
│ │ ├── file list
│ │ │ @@ -14,18 +14,18 @@
│ │ │ -rw-r--r-- 0 root (0) root (0) 1506 2011-06-27 20:43:04.000000 ./usr/share/doc/libbrahe-dev/LicenseOpenSource.txt
│ │ │ -rw-r--r-- 0 root (0) root (0) 291 2025-08-31 16:34:13.000000 ./usr/share/doc/libbrahe-dev/README.Debian
│ │ │ -rw-r--r-- 0 root (0) root (0) 846 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/changelog.Debian.gz
│ │ │ -rw-r--r-- 0 root (0) root (0) 219 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/changelog.Debian.loong64.gz
│ │ │ -rw-r--r-- 0 root (0) root (0) 943 2011-07-06 11:52:08.000000 ./usr/share/doc/libbrahe-dev/changelog.gz
│ │ │ -rw-r--r-- 0 root (0) root (0) 2579 2025-08-31 16:34:13.000000 ./usr/share/doc/libbrahe-dev/copyright
│ │ │ drwxr-xr-x 0 root (0) root (0) 0 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/
│ │ │ --rw-r--r-- 0 root (0) root (0) 61991 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00002.html
│ │ │ --rw-r--r-- 0 root (0) root (0) 54928 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00002_source.html
│ │ │ --rw-r--r-- 0 root (0) root (0) 23357 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00005.html
│ │ │ --rw-r--r-- 0 root (0) root (0) 31890 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00005_source.html
│ │ │ +-rw-r--r-- 0 root (0) root (0) 23357 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00002.html
│ │ │ +-rw-r--r-- 0 root (0) root (0) 31890 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00002_source.html
│ │ │ +-rw-r--r-- 0 root (0) root (0) 61991 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00005.html
│ │ │ +-rw-r--r-- 0 root (0) root (0) 54928 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00005_source.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 6218 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00011.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 3829 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00015.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 7781 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/a00019.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2227 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/annotated.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 1540 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/classes.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2938 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/clipboard.js
│ │ │ -rw-r--r-- 0 root (0) root (0) 2059 2026-04-27 16:35:20.000000 ./usr/share/doc/libbrahe-dev/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html
│ │ ├── ./usr/share/doc/libbrahe-dev/html/a00002.html
│ │ │ @@ -23,1006 +23,358 @@
│ │ │
src
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ +
│ │ │
│ │ │
│ │ │ -
#include <stddef.h>
│ │ │ -
#include <math.h>
│ │ │ -
#include <limits.h>
│ │ │ -
#include <float.h>
│ │ │ -
#include <stdbool.h>
│ │ │ -
#include <stdint.h>
│ │ │ +
#include "mathtools.h"
│ │ │
│ │ │
Go to the source code of this file.
│ │ │
│ │ │ - |
│ │ │ -| #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.
|
│ │ │ -
│ │ │ |
│ │ │ -| 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).
|
│ │ │ +
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_DEG_PER_RAD
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_E
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_E 2.71828182845904523536028747135 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_EULER
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_EULER 0.57721566490153286060651209008 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_LN_10
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_LN_10 2.30258509299404568401799145468 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_LN_2
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_LN_2 0.69314718055994530941723212146 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_LN_PI
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_LN_PI 1.14472988584940017414342735135 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_LOG10_E
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_LOG10_E 0.43429448190325182765112891892 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_LOG2_E
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_LOG2_E 1.44269504088896340735992468100 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_LOG_2
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_LOG_2 0.30102999566398119521373889472 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_ONE_DIV_PI
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_PI
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_PI 3.14159265358979323846264338328 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_PI_DIV_12
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_PI_DIV_12 0.26179938779914943653855361527 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_PI_DIV_18
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_PI_DIV_18 0.17453292519943295769236907685 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_PI_DIV_2
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_PI_DIV_2 1.57079632679489661923132169164 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_PI_DIV_3
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_PI_DIV_3 1.04719755119659774615421446109 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_PI_DIV_36
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_PI_DIV_36 0.08726646259971647884618453842 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_PI_DIV_4
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_PI_DIV_4 0.78539816339744830961566084582 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_PI_DIV_6
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_PI_DIV_6 0.52359877559829887307710723055 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_PI_DIV_9
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_PI_DIV_9 0.34906585039886591538473815370 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_RAD_PER_DEG
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_SQRT_2
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_SQRT_2 1.41421356237309504880168872421 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_SQRT_3
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_SQRT_3 1.73205080756887729352744634151 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_SQRT_HALF
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_SQRT_HALF 0.70710678118654752440084436210 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_SQRT_PI
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_SQRT_PI 1.77245385090551602729816748334 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_TAU
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_TAU 6.28318530717958647692528676656 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_TWO_DIV_PI
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_TWO_DIV_SQRT_PI
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | #define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312 |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ brahe_pretty_format
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ brahe_statistics
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_pretty_format_t
│ │ │ +
│ │ │ +
◆ brahe_prng_type_t
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -| Enumerator |
|---|
| BRAHE_PRETTY_TEXT | english text (nine thousand, two hundred eleven)
│ │ │ + |
| Enumerator |
|---|
| BRAHE_PRNG_MARSENNE_TWISTER | Marsenne Twister (Matsumoto & Nishimura).
│ │ │ + |
│ │ │ +| BRAHE_PRNG_KISS | Keep is Simple, Stupid (Marsaglia).
│ │ │ + |
│ │ │ +| BRAHE_PRNG_CMWC4096 | CMWC4096 (Marsaglia).
│ │ │ + |
│ │ │ +| BRAHE_PRNG_MWC1038 | MWC1038 (Marsaglia).
│ │ │ |
│ │ │ -| BRAHE_PRETTY_COMMA | comma delimited, (1,234,567,890)
│ │ │ + |
| BRAHE_PRNG_ISAAC | Indirect, Shift, Accumulate, Add, and Count (Jenkins).
│ │ │ |
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_acosh()
│ │ │ +
│ │ │ +
◆ brahe_prng_free()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | double brahe_acosh |
│ │ │ + void brahe_prng_free |
│ │ │ ( |
│ │ │ - const double | x | ) |
│ │ │ + brahe_prng_state_t * | prng_state | ) |
│ │ │ |
│ │ │
│ │ │
│ │ │
│ │ │ -
Calculates cosh-1.
- Parameters
-
│ │ │ +
Frees the resources used by a PRNG
- Parameters
-
│ │ │
│ │ │ - | x | a value |
│ │ │ + | prng_state | Object containing the state of a PRNG |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- inverse hyperbolic cosine of x
│ │ │ +- Returns
- true if successful, false if failed
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_add_noise()
│ │ │ +
│ │ │ +
◆ brahe_prng_index()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | void brahe_add_noise |
│ │ │ + size_t brahe_prng_index |
│ │ │ ( |
│ │ │ - double * | a, |
│ │ │ + brahe_prng_state_t * | prng_state, |
│ │ │
│ │ │
│ │ │ |
│ │ │ |
│ │ │ - const size_t | n, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ - |
│ │ │ - double | noise ) |
│ │ │ + const size_t | length ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
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
-
│ │ │ +
Returns the next value as a size_t "index" in the range [0,length).
- Parameters
-
│ │ │
│ │ │ - | a | array containing signal data |
│ │ │ - | n | number of samples in signal |
│ │ │ - | noise | percentage of noise |
│ │ │ + | prng_state | Object containing the state of a PRNG |
│ │ │ + | length | - Maximum value of result |
│ │ │
│ │ │
│ │ │
│ │ │ +- Returns
- A pseudorandom size_t value
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_asinh()
│ │ │ +
│ │ │ +
◆ brahe_prng_init()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | double brahe_asinh |
│ │ │ + bool brahe_prng_init |
│ │ │ ( |
│ │ │ - const double | x | ) |
│ │ │ - |
│ │ │ + brahe_prng_state_t * | prng_state, |
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
Calculates sinh-1.
- Parameters
-
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
- Returns
- inverse hyperbolic sine of x
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ brahe_atanh()
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │
│ │ │ - | double brahe_atanh |
│ │ │ - ( |
│ │ │ - const double | x | ) |
│ │ │ + |
│ │ │ |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
Calculates tanh-1.
- Parameters
-
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
- Returns
- inverse hyperbolic tangent of x
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ brahe_gcf()
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | uint64_t brahe_gcf |
│ │ │ - ( |
│ │ │ - uint64_t | x, |
│ │ │ + const brahe_prng_type_t | type, |
│ │ │
│ │ │
│ │ │ |
│ │ │ |
│ │ │ - uint64_t | y ) |
│ │ │ + const uint32_t | seed ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Calculates the greatest common factor for two values.
- Parameters
-
│ │ │ +
Initializes a psuedo-random number generator using a specified algorithm.
- Parameters
-
│ │ │
│ │ │ - | x | first value |
│ │ │ - | y | second value |
│ │ │ + | prng_state | Object to be initialized for a specific algorithm |
│ │ │ + | type | Algorithm to be used for this PRNG |
│ │ │ + | seed | Initialization seed |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- The greatest common factor for x and y
│ │ │ +- Returns
- true if successful, false if failed
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_get_statistics()
│ │ │ +
│ │ │ +
◆ brahe_prng_next()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | brahe_statistics brahe_get_statistics |
│ │ │ + uint32_t brahe_prng_next |
│ │ │ ( |
│ │ │ - double * | data, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ + brahe_prng_state_t * | prng_state | ) |
│ │ │ |
│ │ │ - size_t | n ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Calculate several common statistics for an array of doubles.
- Parameters
-
│ │ │ +
Returns the next uint32_t in sequence.
- Parameters
-
│ │ │
│ │ │ - | data | array of double values |
│ │ │ - | n | number of elements in data |
│ │ │ + | prng_state | Object containing the state of a PRNG |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- statistics for data
│ │ │ +- Returns
- A pseudorandom uint32_t value
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_lcm()
│ │ │ +
│ │ │ +
◆ brahe_prng_range()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | uint64_t brahe_lcm |
│ │ │ + uint32_t brahe_prng_range |
│ │ │ ( |
│ │ │ - const uint64_t | x, |
│ │ │ + brahe_prng_state_t * | prng_state, |
│ │ │
│ │ │
│ │ │ |
│ │ │ |
│ │ │ - const uint64_t | y ) |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
Calculates the lowest common multiple for two values.
- Parameters
-
│ │ │ -
│ │ │ - | x | first value |
│ │ │ - | y | second value |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
- Returns
- The lowest common multiple for x and y
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ brahe_log2base()
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | double brahe_log2base |
│ │ │ - ( |
│ │ │ - const double | x, |
│ │ │ + const uint32_t | lo, |
│ │ │
│ │ │
│ │ │ |
│ │ │ |
│ │ │ - const double | base ) |
│ │ │ + const uint32_t | hi ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Calculates the base-n logarithm for a given value. If a range error occurs, the return value equals NaN.
- Parameters
-
│ │ │ +
Returns the next int_value between lo and hi, inclusive.
- Parameters
-
│ │ │
│ │ │ - | x | value for which logarithm is required |
│ │ │ - | base | lagarithm base |
│ │ │ + | prng_state | Object containing the state of a PRNG |
│ │ │ + | lo | - Minimum value of result |
│ │ │ + | hi | - Maximum value of result |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- logarithm of x to base base; NAN on range error
│ │ │ +- Returns
- A pseudorandom uint32_t value
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_make_sinusoid()
│ │ │ +
│ │ │ +
◆ brahe_prng_real1()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | double * brahe_make_sinusoid |
│ │ │ + double brahe_prng_real1 |
│ │ │ ( |
│ │ │ - const brahe_wave_factor_t * | factors, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ + brahe_prng_state_t * | prng_state | ) |
│ │ │ |
│ │ │ - const size_t | factor_n, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ - |
│ │ │ - const size_t | array_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
-
│ │ │ +
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
-
│ │ │
│ │ │ - | factors | defines properties of the sine waves to be combined |
│ │ │ - | factor_n | number of elements in factors |
│ │ │ - | array_n | number of elements in the output array |
│ │ │ + | prng_state | Object containing the state of a PRNG |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- an allocated array containg values generated from the given factors
│ │ │ +- Returns
- A pseudorandom double value
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_moving_average()
│ │ │ +
│ │ │ +
◆ brahe_prng_real2()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | double * brahe_moving_average |
│ │ │ + double brahe_prng_real2 |
│ │ │ ( |
│ │ │ - const double * | data, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ + brahe_prng_state_t * | prng_state | ) |
│ │ │ |
│ │ │ - const int | n, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ - |
│ │ │ - const int | distance ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Computes the moving average for an array. The returned buffer must be freed by the calling code.
- Parameters
-
│ │ │ +
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
-
│ │ │
│ │ │ - | data | array of double values to be averaged |
│ │ │ - | n | number of elements in data |
│ │ │ - | distance | number elements to average before and after an element in data |
│ │ │ + | prng_state | Object containing the state of a PRNG |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- an allocated n-length array containing the moving average of corresponding elements in data
│ │ │ +- Returns
- A pseudorandom double value
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_pretty_int()
│ │ │ +
│ │ │ +
◆ brahe_prng_real3()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | char * brahe_pretty_int |
│ │ │ + double brahe_prng_real3 |
│ │ │ ( |
│ │ │ - int64_t | n, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ + brahe_prng_state_t * | prng_state | ) |
│ │ │ |
│ │ │ - brahe_pretty_format | fmt ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Returns a nicely formatted strong for a given 64-bit integer.
- Parameters
-
│ │ │ +
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 | number to be formatted |
│ │ │ - | fmt | specifies format, as text or comma-delimited |
│ │ │ + | prng_state | Object containing the state of a PRNG |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- an allocated string containing the generated text
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ brahe_round_nearest()
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | double brahe_round_nearest |
│ │ │ - ( |
│ │ │ - const double | x | ) |
│ │ │ - |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
Rounds a value to nearest integer, rounding to even for exact fractions of 0.5.
│ │ │ +
- Returns
- A pseudorandom double value
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_sigdig()
│ │ │ +
│ │ │ +
◆ brahe_prng_real53()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | double brahe_sigdig |
│ │ │ + double brahe_prng_real53 |
│ │ │ ( |
│ │ │ - const double | x, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ + brahe_prng_state_t * | prng_state | ) |
│ │ │ |
│ │ │ - const uint16_t | n ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Returns the given value rounded for the number of specified decimal digits of precision.
- Parameters
-
│ │ │ +
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
-
│ │ │
│ │ │ - | x | - Original value to be rounded |
│ │ │ - | n | - Number of significant digits |
│ │ │ + | prng_state | Object containing the state of a PRNG |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- The value x rounded to n digits of precision
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ brahe_simple_fft()
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | double * brahe_simple_fft |
│ │ │ - ( |
│ │ │ - const double * | data, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ - |
│ │ │ - const int | 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
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
◆ brahe_simple_fft2()
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - | double * brahe_simple_fft2 |
│ │ │ - ( |
│ │ │ - const double * | data, |
│ │ │ -
│ │ │ -
│ │ │ - |
│ │ │ - |
│ │ │ - const int | 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
│ │ │ +
- Returns
- A pseudorandom double value
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_sizepow2()
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_UNKNOWN_SEED
│ │ │
│ │ │
│ │ │
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │
│ │ │
│ │ │ - | int brahe_sizepow2 |
│ │ │ - ( |
│ │ │ - const int | n | ) |
│ │ │ - |
│ │ │ + uint32_t BRAHE_UNKNOWN_SEED = 0 |
│ │ │
│ │ │
│ │ │ + |
│ │ │ +
│ │ │ +static |
│ │ │ +
│ │ │ +
│ │ │
│ │ │ -
Returns the smallest power of 2 that includes n in its range
- Parameters
-
│ │ │ -
│ │ │ - | n | number that must be less than the result |
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
- Returns
- the lowest power of 2 that is greater than n, or
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ ├── html2text {}
│ │ │ │ @@ -1,331 +1,138 @@
│ │ │ │ ****** Brahe - a heterogenous collection of mathematical tools ******
│ │ │ │ ***** Main_Index
│ │ │ │ Home_Page *****
│ │ │ │ Created by Scott_Robert_Ladd
│ │ │ │ ===============================================================================
│ │ │ │ * src
│ │ │ │ -Data_Structures | Macros | Typedefs | Enumerations | Functions
│ │ │ │ -mathtools.h File Reference
│ │ │ │ -#include
│ │ │ │ -#include
│ │ │ │ -#include
│ │ │ │ -#include
│ │ │ │ -#include
│ │ │ │ -#include
│ │ │ │ +Data_Structures | Enumerations | Functions | Variables
│ │ │ │ +prng.h File Reference
│ │ │ │ +#include "mathtools.h"
│ │ │ │ Go_to_the_source_code_of_this_file.
│ │ │ │ Data Structures
│ │ │ │ -struct brahe_statistics_t
│ │ │ │ - Structure containing statistical values calculate from a double array.
│ │ │ │ - More...
│ │ │ │ -struct brahe_wave_factor_t
│ │ │ │ - Sine wave definition. More...
│ │ │ │ -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.
│ │ │ │ -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.
│ │ │ │ +struct brahe_prng_state_t
│ │ │ │ + Contains state variables for a PRNG. More...
│ │ │ │ Enumerations
│ │ │ │ -enum brahe_pretty_format_t { BRAHE_PRETTY_TEXT , BRAHE_PRETTY_COMMA }
│ │ │ │ - Formats for pretty-printing integers. More...
│ │ │ │ +enum brahe_prng_type_t {
│ │ │ │ + BRAHE_PRNG_MARSENNE_TWISTER = 0 , BRAHE_PRNG_KISS , BRAHE_PRNG_
│ │ │ │ + CMWC4096 , BRAHE_PRNG_MWC1038 ,
│ │ │ │ + BRAHE_PRNG_ISAAC
│ │ │ │ + }
│ │ │ │ + Defines types of prngs. More...
│ │ │ │ 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.
│ │ │ │ -***** Macro Definition Documentation *****
│ │ │ │ -***** ◆ BRAHE_DEG_PER_RAD *****
│ │ │ │ -#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141
│ │ │ │ -***** ◆ BRAHE_E *****
│ │ │ │ -#define BRAHE_E 2.71828182845904523536028747135
│ │ │ │ -***** ◆ BRAHE_EULER *****
│ │ │ │ -#define BRAHE_EULER 0.57721566490153286060651209008
│ │ │ │ -***** ◆ BRAHE_LN_10 *****
│ │ │ │ -#define BRAHE_LN_10 2.30258509299404568401799145468
│ │ │ │ -***** ◆ BRAHE_LN_2 *****
│ │ │ │ -#define BRAHE_LN_2 0.69314718055994530941723212146
│ │ │ │ -***** ◆ BRAHE_LN_PI *****
│ │ │ │ -#define BRAHE_LN_PI 1.14472988584940017414342735135
│ │ │ │ -***** ◆ BRAHE_LOG10_E *****
│ │ │ │ -#define BRAHE_LOG10_E 0.43429448190325182765112891892
│ │ │ │ -***** ◆ BRAHE_LOG2_E *****
│ │ │ │ -#define BRAHE_LOG2_E 1.44269504088896340735992468100
│ │ │ │ -***** ◆ BRAHE_LOG_2 *****
│ │ │ │ -#define BRAHE_LOG_2 0.30102999566398119521373889472
│ │ │ │ -***** ◆ BRAHE_ONE_DIV_PI *****
│ │ │ │ -#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675
│ │ │ │ -***** ◆ BRAHE_PI *****
│ │ │ │ -#define BRAHE_PI 3.14159265358979323846264338328
│ │ │ │ -***** ◆ BRAHE_PI_DIV_12 *****
│ │ │ │ -#define BRAHE_PI_DIV_12 0.26179938779914943653855361527
│ │ │ │ -***** ◆ BRAHE_PI_DIV_18 *****
│ │ │ │ -#define BRAHE_PI_DIV_18 0.17453292519943295769236907685
│ │ │ │ -***** ◆ BRAHE_PI_DIV_2 *****
│ │ │ │ -#define BRAHE_PI_DIV_2 1.57079632679489661923132169164
│ │ │ │ -***** ◆ BRAHE_PI_DIV_3 *****
│ │ │ │ -#define BRAHE_PI_DIV_3 1.04719755119659774615421446109
│ │ │ │ -***** ◆ BRAHE_PI_DIV_36 *****
│ │ │ │ -#define BRAHE_PI_DIV_36 0.08726646259971647884618453842
│ │ │ │ -***** ◆ BRAHE_PI_DIV_4 *****
│ │ │ │ -#define BRAHE_PI_DIV_4 0.78539816339744830961566084582
│ │ │ │ -***** ◆ BRAHE_PI_DIV_6 *****
│ │ │ │ -#define BRAHE_PI_DIV_6 0.52359877559829887307710723055
│ │ │ │ -***** ◆ BRAHE_PI_DIV_9 *****
│ │ │ │ -#define BRAHE_PI_DIV_9 0.34906585039886591538473815370
│ │ │ │ -***** ◆ BRAHE_RAD_PER_DEG *****
│ │ │ │ -#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768
│ │ │ │ -***** ◆ BRAHE_SQRT_2 *****
│ │ │ │ -#define BRAHE_SQRT_2 1.41421356237309504880168872421
│ │ │ │ -***** ◆ BRAHE_SQRT_3 *****
│ │ │ │ -#define BRAHE_SQRT_3 1.73205080756887729352744634151
│ │ │ │ -***** ◆ BRAHE_SQRT_HALF *****
│ │ │ │ -#define BRAHE_SQRT_HALF 0.70710678118654752440084436210
│ │ │ │ -***** ◆ BRAHE_SQRT_PI *****
│ │ │ │ -#define BRAHE_SQRT_PI 1.77245385090551602729816748334
│ │ │ │ -***** ◆ BRAHE_TAU *****
│ │ │ │ -#define BRAHE_TAU 6.28318530717958647692528676656
│ │ │ │ -***** ◆ BRAHE_TWO_DIV_PI *****
│ │ │ │ -#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349
│ │ │ │ -***** ◆ BRAHE_TWO_DIV_SQRT_PI *****
│ │ │ │ -#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312
│ │ │ │ -***** Typedef Documentation *****
│ │ │ │ -***** ◆ brahe_pretty_format *****
│ │ │ │ -typedef enum brahe_pretty_format_t brahe_pretty_format
│ │ │ │ -***** ◆ brahe_statistics *****
│ │ │ │ -typedef struct brahe_statistics_t brahe_statistics
│ │ │ │ + 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).
│ │ │ │ +Variables
│ │ │ │ +static uint32_t BRAHE_UNKNOWN_SEED = 0
│ │ │ │ ***** Enumeration Type Documentation *****
│ │ │ │ -***** ◆ brahe_pretty_format_t *****
│ │ │ │ -enum brahe_pretty_format_t
│ │ │ │ +***** ◆ brahe_prng_type_t *****
│ │ │ │ +enum brahe_prng_type_t
│ │ │ │ Enumerator
│ │ │ │ -BRAHE_PRETTY_TEXT english text (nine thousand, two hundred eleven)
│ │ │ │ -BRAHE_PRETTY_COMMA comma delimited, (1,234,567,890)
│ │ │ │ +BRAHE_PRNG_MARSENNE_TWISTER Marsenne Twister (Matsumoto & Nishimura).
│ │ │ │ +BRAHE_PRNG_KISS Keep is Simple, Stupid (Marsaglia).
│ │ │ │ +BRAHE_PRNG_CMWC4096 CMWC4096 (Marsaglia).
│ │ │ │ +BRAHE_PRNG_MWC1038 MWC1038 (Marsaglia).
│ │ │ │ +BRAHE_PRNG_ISAAC Indirect, Shift, Accumulate, Add, and Count
│ │ │ │ + (Jenkins).
│ │ │ │ ***** Function Documentation *****
│ │ │ │ -***** ◆ brahe_acosh() *****
│ │ │ │ -double brahe_acosh ( const double x )
│ │ │ │ -Calculates cosh-1.
│ │ │ │ - Parameters
│ │ │ │ - x a value
│ │ │ │ - Returns
│ │ │ │ - inverse hyperbolic cosine of x
│ │ │ │ -***** ◆ brahe_add_noise() *****
│ │ │ │ -void brahe_add_noise ( double * a,
│ │ │ │ - const size_t n,
│ │ │ │ - double noise )
│ │ │ │ -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
│ │ │ │ - a array containing signal data
│ │ │ │ - n number of samples in signal
│ │ │ │ - noise percentage of noise
│ │ │ │ -***** ◆ brahe_asinh() *****
│ │ │ │ -double brahe_asinh ( const double x )
│ │ │ │ -Calculates sinh-1.
│ │ │ │ - Parameters
│ │ │ │ - x a value
│ │ │ │ - Returns
│ │ │ │ - inverse hyperbolic sine of x
│ │ │ │ -***** ◆ brahe_atanh() *****
│ │ │ │ -double brahe_atanh ( const double x )
│ │ │ │ -Calculates tanh-1.
│ │ │ │ - Parameters
│ │ │ │ - x a value
│ │ │ │ - Returns
│ │ │ │ - inverse hyperbolic tangent of x
│ │ │ │ -***** ◆ brahe_gcf() *****
│ │ │ │ -uint64_t brahe_gcf ( uint64_t x,
│ │ │ │ - uint64_t y )
│ │ │ │ -Calculates the greatest common factor for two values.
│ │ │ │ - Parameters
│ │ │ │ - x first value
│ │ │ │ - y second value
│ │ │ │ - Returns
│ │ │ │ - The greatest common factor for x and y
│ │ │ │ -***** ◆ brahe_get_statistics() *****
│ │ │ │ -brahe_statistics brahe_get_statistics ( double * data,
│ │ │ │ - size_t n )
│ │ │ │ -Calculate several common statistics for an array of doubles.
│ │ │ │ - Parameters
│ │ │ │ - data array of double values
│ │ │ │ - n number of elements in data
│ │ │ │ - Returns
│ │ │ │ - statistics for data
│ │ │ │ -***** ◆ brahe_lcm() *****
│ │ │ │ -uint64_t brahe_lcm ( const uint64_t x,
│ │ │ │ - const uint64_t y )
│ │ │ │ -Calculates the lowest common multiple for two values.
│ │ │ │ - Parameters
│ │ │ │ - x first value
│ │ │ │ - y second value
│ │ │ │ - Returns
│ │ │ │ - The lowest common multiple for x and y
│ │ │ │ -***** ◆ brahe_log2base() *****
│ │ │ │ -double brahe_log2base ( const double x,
│ │ │ │ - const double base )
│ │ │ │ -Calculates the base-n logarithm for a given value. If a range error occurs, the
│ │ │ │ -return value equals NaN.
│ │ │ │ - Parameters
│ │ │ │ - x value for which logarithm is required
│ │ │ │ - base lagarithm base
│ │ │ │ - Returns
│ │ │ │ - logarithm of x to base base; NAN on range error
│ │ │ │ -***** ◆ brahe_make_sinusoid() *****
│ │ │ │ -double * brahe_make_sinusoid ( const brahe_wave_factor_t * factors,
│ │ │ │ - const size_t factor_n,
│ │ │ │ - const size_t array_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
│ │ │ │ - factors defines properties of the sine waves to be combined
│ │ │ │ - factor_n number of elements in factors
│ │ │ │ - array_n number of elements in the output array
│ │ │ │ - Returns
│ │ │ │ - an allocated array containg values generated from the given factors
│ │ │ │ -***** ◆ brahe_moving_average() *****
│ │ │ │ -double * brahe_moving_average ( const double * data,
│ │ │ │ - const int n,
│ │ │ │ - const int distance )
│ │ │ │ -Computes the moving average for an array. The returned buffer must be freed by
│ │ │ │ -the calling code.
│ │ │ │ - Parameters
│ │ │ │ - data array of double values to be averaged
│ │ │ │ - n number of elements in data
│ │ │ │ - distance number elements to average before and after an element in data
│ │ │ │ - Returns
│ │ │ │ - an allocated n-length array containing the moving average of
│ │ │ │ - corresponding elements in data
│ │ │ │ -***** ◆ brahe_pretty_int() *****
│ │ │ │ -char * brahe_pretty_int ( int64_t n,
│ │ │ │ - brahe_pretty_format fmt )
│ │ │ │ -Returns a nicely formatted strong for a given 64-bit integer.
│ │ │ │ - Parameters
│ │ │ │ - n number to be formatted
│ │ │ │ - fmt specifies format, as text or comma-delimited
│ │ │ │ - Returns
│ │ │ │ - an allocated string containing the generated text
│ │ │ │ -***** ◆ brahe_round_nearest() *****
│ │ │ │ -double brahe_round_nearest ( const double x )
│ │ │ │ -Rounds a value to nearest integer, rounding to even for exact fractions of 0.5.
│ │ │ │ -***** ◆ brahe_sigdig() *****
│ │ │ │ -double brahe_sigdig ( const double x,
│ │ │ │ - const uint16_t n )
│ │ │ │ -Returns the given value rounded for the number of specified decimal digits of
│ │ │ │ -precision.
│ │ │ │ - Parameters
│ │ │ │ - x - Original value to be rounded
│ │ │ │ - n - Number of significant digits
│ │ │ │ - Returns
│ │ │ │ - The value x rounded to n digits of precision
│ │ │ │ -***** ◆ brahe_simple_fft() *****
│ │ │ │ -double * brahe_simple_fft ( const double * data,
│ │ │ │ - const int 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
│ │ │ │ -***** ◆ brahe_simple_fft2() *****
│ │ │ │ -double * brahe_simple_fft2 ( const double * data,
│ │ │ │ - const int 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
│ │ │ │ -***** ◆ brahe_sizepow2() *****
│ │ │ │ -int brahe_sizepow2 ( const int n )
│ │ │ │ -Returns the smallest power of 2 that includes n in its range
│ │ │ │ - Parameters
│ │ │ │ - n number that must be less than the result
│ │ │ │ - Returns
│ │ │ │ - the lowest power of 2 that is greater than n, or
│ │ │ │ +***** ◆ brahe_prng_free() *****
│ │ │ │ +void brahe_prng_free ( brahe_prng_state_t * prng_state )
│ │ │ │ +Frees the resources used by a PRNG
│ │ │ │ + Parameters
│ │ │ │ + prng_state Object containing the state of a PRNG
│ │ │ │ + Returns
│ │ │ │ + true if successful, false if failed
│ │ │ │ +***** ◆ brahe_prng_index() *****
│ │ │ │ +size_t brahe_prng_index ( brahe_prng_state_t * prng_state,
│ │ │ │ + const size_t length )
│ │ │ │ +Returns the next value as a size_t "index" in the range [0,length).
│ │ │ │ + Parameters
│ │ │ │ + prng_state Object containing the state of a PRNG
│ │ │ │ + length - Maximum value of result
│ │ │ │ + Returns
│ │ │ │ + A pseudorandom size_t value
│ │ │ │ +***** ◆ brahe_prng_init() *****
│ │ │ │ +bool brahe_prng_init ( brahe_prng_state_t * prng_state,
│ │ │ │ + const brahe_prng_type_t type,
│ │ │ │ + const uint32_t seed )
│ │ │ │ +Initializes a psuedo-random number generator using a specified algorithm.
│ │ │ │ + Parameters
│ │ │ │ + prng_state Object to be initialized for a specific algorithm
│ │ │ │ + type Algorithm to be used for this PRNG
│ │ │ │ + seed Initialization seed
│ │ │ │ + Returns
│ │ │ │ + true if successful, false if failed
│ │ │ │ +***** ◆ brahe_prng_next() *****
│ │ │ │ +uint32_t brahe_prng_next ( brahe_prng_state_t * prng_state )
│ │ │ │ +Returns the next uint32_t in sequence.
│ │ │ │ + Parameters
│ │ │ │ + prng_state Object containing the state of a PRNG
│ │ │ │ + Returns
│ │ │ │ + A pseudorandom uint32_t value
│ │ │ │ +***** ◆ brahe_prng_range() *****
│ │ │ │ +uint32_t brahe_prng_range ( brahe_prng_state_t * prng_state,
│ │ │ │ + const uint32_t lo,
│ │ │ │ + const uint32_t hi )
│ │ │ │ +Returns the next int_value between lo and hi, inclusive.
│ │ │ │ + Parameters
│ │ │ │ + prng_state Object containing the state of a PRNG
│ │ │ │ + lo - Minimum value of result
│ │ │ │ + hi - Maximum value of result
│ │ │ │ + Returns
│ │ │ │ + A pseudorandom uint32_t value
│ │ │ │ +***** ◆ brahe_prng_real1() *****
│ │ │ │ +double brahe_prng_real1 ( brahe_prng_state_t * prng_state )
│ │ │ │ +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
│ │ │ │ + prng_state Object containing the state of a PRNG
│ │ │ │ + Returns
│ │ │ │ + A pseudorandom double value
│ │ │ │ +***** ◆ brahe_prng_real2() *****
│ │ │ │ +double brahe_prng_real2 ( brahe_prng_state_t * prng_state )
│ │ │ │ +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
│ │ │ │ + prng_state Object containing the state of a PRNG
│ │ │ │ + Returns
│ │ │ │ + A pseudorandom double value
│ │ │ │ +***** ◆ brahe_prng_real3() *****
│ │ │ │ +double brahe_prng_real3 ( brahe_prng_state_t * prng_state )
│ │ │ │ +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
│ │ │ │ + prng_state Object containing the state of a PRNG
│ │ │ │ + Returns
│ │ │ │ + A pseudorandom double value
│ │ │ │ +***** ◆ brahe_prng_real53() *****
│ │ │ │ +double brahe_prng_real53 ( brahe_prng_state_t * prng_state )
│ │ │ │ +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
│ │ │ │ + prng_state Object containing the state of a PRNG
│ │ │ │ + Returns
│ │ │ │ + A pseudorandom double value
│ │ │ │ +***** Variable Documentation *****
│ │ │ │ +***** ◆ BRAHE_UNKNOWN_SEED *****
│ │ │ │ +uint32_t BRAHE_UNKNOWN_SEED = 0 static
│ │ │ │ ===============================================================================
│ │ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ ├── ./usr/share/doc/libbrahe-dev/html/a00002_source.html
│ │ │ @@ -21,15 +21,15 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Go to the documentation of this file.
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -76,246 +76,108 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
53#if !defined(LIBBRAHE_MATHTOOLS_H)
│ │ │ -
54#define LIBBRAHE_MATHTOOLS_H
│ │ │ +
53#if !defined(LIBBRAHE_PRNG_H)
│ │ │ +
54#define LIBBRAHE_PRNG_H
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
61#if defined(__cplusplus)
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
66#pragma warning (disable: 4244 4267 4996)
│ │ │ -
67#if !defined(__cplusplus)
│ │ │ -
│ │ │ -
69static const int true = 1;
│ │ │ -
70static const int false = 0;
│ │ │ -
│ │ │ -
72typedef unsigned __int64 uint64_t;
│ │ │ -
73typedef __int64 int64_t;
│ │ │ -
74typedef unsigned __int32 uint32_t;
│ │ │ -
75typedef __int32 int32_t;
│ │ │ -
76typedef unsigned __int16 uint16_t;
│ │ │ -
77typedef __int16 int16_t;
│ │ │ -
78typedef unsigned __int8 uint8_t;
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +
│ │ │ +
│ │ │ +
58#if defined(__cplusplus)
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
308#define BRAHE_E 2.71828182845904523536028747135
│ │ │ -
│ │ │ -
311#define BRAHE_LOG2_E 1.44269504088896340735992468100
│ │ │ -
│ │ │ -
314#define BRAHE_LOG10_E 0.43429448190325182765112891892
│ │ │ -
│ │ │ -
317#define BRAHE_SQRT_2 1.41421356237309504880168872421
│ │ │ -
│ │ │ -
320#define BRAHE_SQRT_HALF 0.70710678118654752440084436210
│ │ │ -
│ │ │ -
323#define BRAHE_SQRT_3 1.73205080756887729352744634151
│ │ │ -
│ │ │ -
326#define BRAHE_PI 3.14159265358979323846264338328
│ │ │ -
│ │ │ -
329#define BRAHE_TAU 6.28318530717958647692528676656
│ │ │ -
│ │ │ -
332#define BRAHE_PI_DIV_2 1.57079632679489661923132169164
│ │ │ -
│ │ │ -
335#define BRAHE_PI_DIV_3 1.04719755119659774615421446109
│ │ │ -
│ │ │ -
338#define BRAHE_PI_DIV_4 0.78539816339744830961566084582
│ │ │ -
│ │ │ -
341#define BRAHE_PI_DIV_6 0.52359877559829887307710723055
│ │ │ -
│ │ │ -
344#define BRAHE_PI_DIV_9 0.34906585039886591538473815370
│ │ │ -
│ │ │ -
347#define BRAHE_PI_DIV_12 0.26179938779914943653855361527
│ │ │ -
│ │ │ -
350#define BRAHE_PI_DIV_18 0.17453292519943295769236907685
│ │ │ -
│ │ │ -
353#define BRAHE_PI_DIV_36 0.08726646259971647884618453842
│ │ │ -
│ │ │ -
356#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141
│ │ │ -
│ │ │ -
359#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768
│ │ │ -
│ │ │ -
362#define BRAHE_SQRT_PI 1.77245385090551602729816748334
│ │ │ -
│ │ │ -
365#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312
│ │ │ -
│ │ │ -
368#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675
│ │ │ -
│ │ │ -
371#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349
│ │ │ -
│ │ │ -
374#define BRAHE_LN_10 2.30258509299404568401799145468
│ │ │ -
│ │ │ -
377#define BRAHE_LN_2 0.69314718055994530941723212146
│ │ │ -
│ │ │ -
380#define BRAHE_LOG_2 0.30102999566398119521373889472
│ │ │ -
│ │ │ -
383#define BRAHE_LN_PI 1.14472988584940017414342735135
│ │ │ -
│ │ │ -
386#define BRAHE_EULER 0.57721566490153286060651209008
│ │ │ -
│ │ │ -
388#if defined(__cplusplus)
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
double brahe_log2base(const double x, const double base)
Logarithm to a specified base.
│ │ │ -
double brahe_round_nearest(const double x)
Round to nearest value.
│ │ │ -
brahe_pretty_format_t
Formats for pretty-printing integers.
Definition mathtools.h:156
│ │ │ -
@ BRAHE_PRETTY_COMMA
comma delimited, (1,234,567,890)
Definition mathtools.h:160
│ │ │ -
@ BRAHE_PRETTY_TEXT
english text (nine thousand, two hundred eleven)
Definition mathtools.h:158
│ │ │ -
char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt)
Turn a 64-bit integer into a pretty string.
│ │ │ -
double * brahe_moving_average(const double *data, const int n, const int distance)
Moving average.
│ │ │ -
int brahe_sizepow2(const int n)
Smallest power of 2 that includes a given value.
│ │ │ -
uint64_t brahe_lcm(const uint64_t x, const uint64_t y)
Lowest common multiple.
│ │ │ -
double * brahe_simple_fft2(const double *data, const int n)
Simple real-to-real fft (power of 2 length).
│ │ │ -
double brahe_sigdig(const double x, const uint16_t n)
Set number of significant digits in a floating-point value.
│ │ │ -
double brahe_asinh(const double x)
Hyperbolic arcsine.
│ │ │ -
double brahe_acosh(const double x)
Hyperbolic arccosine.
│ │ │ -
struct brahe_statistics_t brahe_statistics
Structure containing statistical values calculate from a double array.
│ │ │ -
double brahe_atanh(const double x)
Hyperbolic arctangent.
│ │ │ -
double * brahe_simple_fft(const double *data, const int n)
Simple real-to-real fft (arbitrary length).
│ │ │ -
brahe_statistics brahe_get_statistics(double *data, size_t n)
statistics for array of double
│ │ │ -
enum brahe_pretty_format_t brahe_pretty_format
Formats for pretty-printing integers.
│ │ │ -
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.
│ │ │ -
uint64_t brahe_gcf(uint64_t x, uint64_t y)
Greatest common factor (denominator).
│ │ │ -
void brahe_add_noise(double *a, const size_t n, double noise)
Apply noise to a signal.
│ │ │ -
Structure containing statistical values calculate from a double array.
Definition mathtools.h:179
│ │ │ -
double min
minimum value from array
Definition mathtools.h:181
│ │ │ -
double mean
mean (average)
Definition mathtools.h:185
│ │ │ -
double variance
variance
Definition mathtools.h:187
│ │ │ -
double max
maximum value
Definition mathtools.h:183
│ │ │ -
double sigma
standard deviation
Definition mathtools.h:189
│ │ │ -
Sine wave definition.
Definition mathtools.h:244
│ │ │ -
double amplitude
arbitrary wave amplitude
Definition mathtools.h:248
│ │ │ -
double wavelength
wavelength
Definition mathtools.h:246
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
177#if defined(__cplusplus)
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
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.
│ │ │ +
static uint32_t BRAHE_UNKNOWN_SEED
Definition prng.h:90
│ │ │ +
double brahe_prng_real2(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1).
│ │ │ +
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].
│ │ │ +
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.
│ │ │ +
double brahe_prng_real1(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1].
│ │ │ +
brahe_prng_type_t
Defines types of prngs.
Definition prng.h:64
│ │ │ +
@ BRAHE_PRNG_ISAAC
Indirect, Shift, Accumulate, Add, and Count (Jenkins).
Definition prng.h:74
│ │ │ +
@ BRAHE_PRNG_MARSENNE_TWISTER
Marsenne Twister (Matsumoto & Nishimura).
Definition prng.h:66
│ │ │ +
@ BRAHE_PRNG_MWC1038
MWC1038 (Marsaglia).
Definition prng.h:72
│ │ │ +
@ BRAHE_PRNG_CMWC4096
CMWC4096 (Marsaglia).
Definition prng.h:70
│ │ │ +
@ BRAHE_PRNG_KISS
Keep is Simple, Stupid (Marsaglia).
Definition prng.h:68
│ │ │ +
uint32_t brahe_prng_next(brahe_prng_state_t *prng_state)
Get the next integer.
│ │ │ +
double brahe_prng_real53(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).
│ │ │ +
│ │ │ +
Contains state variables for a PRNG.
Definition prng.h:79
│ │ │ +
void * m_data2
Definition prng.h:83
│ │ │ +
size_t m_b
Definition prng.h:86
│ │ │ +
void * m_data1
Definition prng.h:82
│ │ │ +
size_t m_i
Definition prng.h:84
│ │ │ +
size_t m_a
Definition prng.h:85
│ │ │ +
size_t m_c
Definition prng.h:87
│ │ │ +
brahe_prng_type_t m_type
Definition prng.h:80
│ │ │ +
uint32_t m_seed
Definition prng.h:81
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ │
│ │ │ ├── html2text {}
│ │ │ │ @@ -1,14 +1,14 @@
│ │ │ │ ****** Brahe - a heterogenous collection of mathematical tools ******
│ │ │ │ ***** Main_Index
│ │ │ │ Home_Page *****
│ │ │ │ Created by Scott_Robert_Ladd
│ │ │ │ ===============================================================================
│ │ │ │ * src
│ │ │ │ -mathtools.h
│ │ │ │ +prng.h
│ │ │ │ Go_to_the_documentation_of_this_file.
│ │ │ │ 1/*
│ │ │ │ 2 Brahe is a heterogenous collection of mathematical tools, written in Standard
│ │ │ │ C.
│ │ │ │ 3
│ │ │ │ 4 Copyright 2011 Scott Robert Ladd. All rights reserved.
│ │ │ │ 5
│ │ │ │ @@ -73,326 +73,161 @@
│ │ │ │ 46 The author can be contacted at:
│ │ │ │ 47
│ │ │ │ 48 scott.ladd@coyotegulch.com
│ │ │ │ 49 scott.ladd@gmail.com
│ │ │ │ 50 http:www.coyotegulch.com
│ │ │ │ 51*/
│ │ │ │ 52
│ │ │ │ -53#if !defined(LIBBRAHE_MATHTOOLS_H)
│ │ │ │ -54#define LIBBRAHE_MATHTOOLS_H
│ │ │ │ +53#if !defined(LIBBRAHE_PRNG_H)
│ │ │ │ +54#define LIBBRAHE_PRNG_H
│ │ │ │ 55
│ │ │ │ -56#include
│ │ │ │ -57#include
│ │ │ │ -58#include
│ │ │ │ -59#include
│ │ │ │ -60
│ │ │ │ -61#if defined(__cplusplus)
│ │ │ │ -62extern "C" {
│ │ │ │ -63#endif
│ │ │ │ -64
│ │ │ │ -65#if defined(_MSC_VER)
│ │ │ │ -66#pragma warning (disable: 4244 4267 4996)
│ │ │ │ -67#if !defined(__cplusplus)
│ │ │ │ -68typedef char bool;
│ │ │ │ -69static const int true = 1;
│ │ │ │ -70static const int false = 0;
│ │ │ │ -71#endif
│ │ │ │ -72typedef unsigned __int64 uint64_t;
│ │ │ │ -73typedef __int64 int64_t;
│ │ │ │ -74typedef unsigned __int32 uint32_t;
│ │ │ │ -75typedef __int32 int32_t;
│ │ │ │ -76typedef unsigned __int16 uint16_t;
│ │ │ │ -77typedef __int16 int16_t;
│ │ │ │ -78typedef unsigned __int8 uint8_t;
│ │ │ │ -79typedef __int8 int8_t;
│ │ │ │ -80#else
│ │ │ │ -81// ISO C standard compilers
│ │ │ │ -82#include
│ │ │ │ -83#include
│ │ │ │ -84#endif
│ │ │ │ -85
│ │ │ │ -86//---------------------------------------------------------------------------
│ │ │ │ ---
│ │ │ │ -87// Rounding
│ │ │ │ -88//---------------------------------------------------------------------------
│ │ │ │ ---
│ │ │ │ +56#include "mathtools.h"
│ │ │ │ +57
│ │ │ │ +58#if defined(__cplusplus)
│ │ │ │ +59extern "C" {
│ │ │ │ +60#endif
│ │ │ │ +61
│ │ │ │ +63typedef enum
│ │ │ │ +64{
│ │ │ │ +66 BRAHE_PRNG_MARSENNE_TWISTER = 0,
│ │ │ │ +68 BRAHE_PRNG_KISS,
│ │ │ │ +70 BRAHE_PRNG_CMWC4096,
│ │ │ │ +72 BRAHE_PRNG_MWC1038,
│ │ │ │ +74 BRAHE_PRNG_ISAAC
│ │ │ │ +75} brahe_prng_type_t;
│ │ │ │ +76
│ │ │ │ +78typedef struct
│ │ │ │ +79{
│ │ │ │ +80 brahe_prng_type_t m_type; // the algorithm we're using
│ │ │ │ +81 uint32_t m_seed; // "seed" that defines the sequence
│ │ │ │ +82 void * m_data1; // array or table
│ │ │ │ +83 void * m_data2; // additional array or table
│ │ │ │ +84 size_t m_i; // only used by some algorithms
│ │ │ │ +85 size_t m_a; // only used by some algorithms
│ │ │ │ +86 size_t m_b; // only used by some algorithms
│ │ │ │ +87 size_t m_c; // only used by some algorithms
│ │ │ │ +88} brahe_prng_state_t;
│ │ │ │ 89
│ │ │ │ +90static uint32_t BRAHE_UNKNOWN_SEED = 0;
│ │ │ │ 91
│ │ │ │ -94double brahe_round_nearest(const double x);
│ │ │ │ -95
│ │ │ │ -97
│ │ │ │ -104double brahe_sigdig(const double x, const uint16_t n);
│ │ │ │ -105
│ │ │ │ -106//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -107// Lowest Common Multple (LCM) and Lowest Common Denominator (GCD)
│ │ │ │ -108//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ +93
│ │ │ │ +100bool brahe_prng_init(brahe_prng_state_t * prng_state, const brahe_prng_type_
│ │ │ │ +t type, const uint32_t seed);
│ │ │ │ +101
│ │ │ │ +103
│ │ │ │ +108void brahe_prng_free(brahe_prng_state_t * prng_state);
│ │ │ │ 109
│ │ │ │ 111
│ │ │ │ -117uint64_t brahe_lcm(const uint64_t x, const uint64_t y);
│ │ │ │ -118
│ │ │ │ -120
│ │ │ │ -126uint64_t brahe_gcf(uint64_t x, uint64_t y);
│ │ │ │ +116uint32_t brahe_prng_next(brahe_prng_state_t * prng_state);
│ │ │ │ +117
│ │ │ │ +119
│ │ │ │ +126uint32_t brahe_prng_range(brahe_prng_state_t * prng_state, const uint32_
│ │ │ │ +t lo, const uint32_t hi);
│ │ │ │ 127
│ │ │ │ -128//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -129// Logarithms
│ │ │ │ -130//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -131
│ │ │ │ -133
│ │ │ │ -140double brahe_log2base(const double x, const double base);
│ │ │ │ -141
│ │ │ │ -143
│ │ │ │ -148int brahe_sizepow2(const int n);
│ │ │ │ -149
│ │ │ │ -150//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -151// Statistical functions
│ │ │ │ -152//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -153
│ │ │ │ -155typedef enum brahe_pretty_format_t
│ │ │ │ -156{
│ │ │ │ -158 BRAHE_PRETTY_TEXT,
│ │ │ │ -160 BRAHE_PRETTY_COMMA
│ │ │ │ -161}
│ │ │ │ -162brahe_pretty_format;
│ │ │ │ -163
│ │ │ │ -165
│ │ │ │ -171char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt);
│ │ │ │ -172
│ │ │ │ -173//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -174// Statistical functions
│ │ │ │ -175//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ +129
│ │ │ │ +135size_t brahe_prng_index(brahe_prng_state_t * prng_state, const size_
│ │ │ │ +t length);
│ │ │ │ +136
│ │ │ │ +138
│ │ │ │ +145double brahe_prng_real1(brahe_prng_state_t * prng_state);
│ │ │ │ +146
│ │ │ │ +148
│ │ │ │ +155double brahe_prng_real2(brahe_prng_state_t * prng_state);
│ │ │ │ +156
│ │ │ │ +158
│ │ │ │ +165double brahe_prng_real3(brahe_prng_state_t * prng_state);
│ │ │ │ +166
│ │ │ │ +168
│ │ │ │ +175double brahe_prng_real53(brahe_prng_state_t * prng_state);
│ │ │ │ 176
│ │ │ │ -178typedef struct brahe_statistics_t
│ │ │ │ -179{
│ │ │ │ -181 double min;
│ │ │ │ -183 double max;
│ │ │ │ -185 double mean;
│ │ │ │ -187 double variance;
│ │ │ │ -189 double sigma;
│ │ │ │ -190}
│ │ │ │ -191brahe_statistics;
│ │ │ │ -192
│ │ │ │ -194
│ │ │ │ -200brahe_statistics brahe_get_statistics(double * data, size_t n);
│ │ │ │ -201
│ │ │ │ -203
│ │ │ │ -211double * brahe_moving_average(const double * data, const int n, const int
│ │ │ │ -distance);
│ │ │ │ -212
│ │ │ │ -213//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -214// Digital Signal Processing
│ │ │ │ -215//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -216
│ │ │ │ -218
│ │ │ │ -226double * brahe_simple_fft(const double * data, const int n);
│ │ │ │ -227
│ │ │ │ -229
│ │ │ │ -237double * brahe_simple_fft2(const double * data, const int n);
│ │ │ │ -238
│ │ │ │ -240
│ │ │ │ -243typedef struct
│ │ │ │ -244{
│ │ │ │ -246 double wavelength;
│ │ │ │ -248 double amplitude;
│ │ │ │ -249}
│ │ │ │ -250brahe_wave_factor_t;
│ │ │ │ -251
│ │ │ │ -253
│ │ │ │ -263double * brahe_make_sinusoid(const brahe_wave_factor_t * factors, const
│ │ │ │ -size_t factor_n, const size_t array_n);
│ │ │ │ -264
│ │ │ │ -266
│ │ │ │ -274void brahe_add_noise(double * a, const size_t n, double noise);
│ │ │ │ -275
│ │ │ │ -276//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -277// Trigonometry
│ │ │ │ -278//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -280
│ │ │ │ -285double brahe_asinh(const double x);
│ │ │ │ -286
│ │ │ │ -288
│ │ │ │ -293double brahe_acosh(const double x);
│ │ │ │ -294
│ │ │ │ -296
│ │ │ │ -301double brahe_atanh(const double x);
│ │ │ │ -302
│ │ │ │ -303//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -304// Constants
│ │ │ │ -305//--------------------------------------------------------------------------
│ │ │ │ ----
│ │ │ │ -306
│ │ │ │ -308#define BRAHE_E 2.71828182845904523536028747135
│ │ │ │ -309
│ │ │ │ -311#define BRAHE_LOG2_E 1.44269504088896340735992468100
│ │ │ │ -312
│ │ │ │ -314#define BRAHE_LOG10_E 0.43429448190325182765112891892
│ │ │ │ -315
│ │ │ │ -317#define BRAHE_SQRT_2 1.41421356237309504880168872421
│ │ │ │ -318
│ │ │ │ -320#define BRAHE_SQRT_HALF 0.70710678118654752440084436210
│ │ │ │ -321
│ │ │ │ -323#define BRAHE_SQRT_3 1.73205080756887729352744634151
│ │ │ │ -324
│ │ │ │ -326#define BRAHE_PI 3.14159265358979323846264338328
│ │ │ │ -327
│ │ │ │ -329#define BRAHE_TAU 6.28318530717958647692528676656
│ │ │ │ -330
│ │ │ │ -332#define BRAHE_PI_DIV_2 1.57079632679489661923132169164
│ │ │ │ -333
│ │ │ │ -335#define BRAHE_PI_DIV_3 1.04719755119659774615421446109
│ │ │ │ -336
│ │ │ │ -338#define BRAHE_PI_DIV_4 0.78539816339744830961566084582
│ │ │ │ -339
│ │ │ │ -341#define BRAHE_PI_DIV_6 0.52359877559829887307710723055
│ │ │ │ -342
│ │ │ │ -344#define BRAHE_PI_DIV_9 0.34906585039886591538473815370
│ │ │ │ -345
│ │ │ │ -347#define BRAHE_PI_DIV_12 0.26179938779914943653855361527
│ │ │ │ -348
│ │ │ │ -350#define BRAHE_PI_DIV_18 0.17453292519943295769236907685
│ │ │ │ -351
│ │ │ │ -353#define BRAHE_PI_DIV_36 0.08726646259971647884618453842
│ │ │ │ -354
│ │ │ │ -356#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141
│ │ │ │ -357
│ │ │ │ -359#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768
│ │ │ │ -360
│ │ │ │ -362#define BRAHE_SQRT_PI 1.77245385090551602729816748334
│ │ │ │ -363
│ │ │ │ -365#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312
│ │ │ │ -366
│ │ │ │ -368#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675
│ │ │ │ -369
│ │ │ │ -371#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349
│ │ │ │ -372
│ │ │ │ -374#define BRAHE_LN_10 2.30258509299404568401799145468
│ │ │ │ -375
│ │ │ │ -377#define BRAHE_LN_2 0.69314718055994530941723212146
│ │ │ │ -378
│ │ │ │ -380#define BRAHE_LOG_2 0.30102999566398119521373889472
│ │ │ │ -381
│ │ │ │ -383#define BRAHE_LN_PI 1.14472988584940017414342735135
│ │ │ │ -384
│ │ │ │ -386#define BRAHE_EULER 0.57721566490153286060651209008
│ │ │ │ -387
│ │ │ │ -388#if defined(__cplusplus)
│ │ │ │ -389}
│ │ │ │ -390#endif
│ │ │ │ -391
│ │ │ │ -392#endif
│ │ │ │ -brahe_log2base
│ │ │ │ -double brahe_log2base(const double x, const double base)
│ │ │ │ -Logarithm to a specified base.
│ │ │ │ -brahe_round_nearest
│ │ │ │ -double brahe_round_nearest(const double x)
│ │ │ │ -Round to nearest value.
│ │ │ │ -brahe_pretty_format_t
│ │ │ │ -brahe_pretty_format_t
│ │ │ │ -Formats for pretty-printing integers.
│ │ │ │ -Definition mathtools.h:156
│ │ │ │ -BRAHE_PRETTY_COMMA
│ │ │ │ -@ BRAHE_PRETTY_COMMA
│ │ │ │ -comma delimited, (1,234,567,890)
│ │ │ │ -Definition mathtools.h:160
│ │ │ │ -BRAHE_PRETTY_TEXT
│ │ │ │ -@ BRAHE_PRETTY_TEXT
│ │ │ │ -english text (nine thousand, two hundred eleven)
│ │ │ │ -Definition mathtools.h:158
│ │ │ │ -brahe_pretty_int
│ │ │ │ -char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt)
│ │ │ │ -Turn a 64-bit integer into a pretty string.
│ │ │ │ -brahe_moving_average
│ │ │ │ -double * brahe_moving_average(const double *data, const int n, const int
│ │ │ │ -distance)
│ │ │ │ -Moving average.
│ │ │ │ -brahe_sizepow2
│ │ │ │ -int brahe_sizepow2(const int n)
│ │ │ │ -Smallest power of 2 that includes a given value.
│ │ │ │ -brahe_lcm
│ │ │ │ -uint64_t brahe_lcm(const uint64_t x, const uint64_t y)
│ │ │ │ -Lowest common multiple.
│ │ │ │ -brahe_simple_fft2
│ │ │ │ -double * brahe_simple_fft2(const double *data, const int n)
│ │ │ │ -Simple real-to-real fft (power of 2 length).
│ │ │ │ -brahe_sigdig
│ │ │ │ -double brahe_sigdig(const double x, const uint16_t n)
│ │ │ │ -Set number of significant digits in a floating-point value.
│ │ │ │ -brahe_asinh
│ │ │ │ -double brahe_asinh(const double x)
│ │ │ │ -Hyperbolic arcsine.
│ │ │ │ -brahe_acosh
│ │ │ │ -double brahe_acosh(const double x)
│ │ │ │ -Hyperbolic arccosine.
│ │ │ │ -brahe_statistics
│ │ │ │ -struct brahe_statistics_t brahe_statistics
│ │ │ │ -Structure containing statistical values calculate from a double array.
│ │ │ │ -brahe_atanh
│ │ │ │ -double brahe_atanh(const double x)
│ │ │ │ -Hyperbolic arctangent.
│ │ │ │ -brahe_simple_fft
│ │ │ │ -double * brahe_simple_fft(const double *data, const int n)
│ │ │ │ -Simple real-to-real fft (arbitrary length).
│ │ │ │ -brahe_get_statistics
│ │ │ │ -brahe_statistics brahe_get_statistics(double *data, size_t n)
│ │ │ │ -statistics for array of double
│ │ │ │ -brahe_pretty_format
│ │ │ │ -enum brahe_pretty_format_t brahe_pretty_format
│ │ │ │ -Formats for pretty-printing integers.
│ │ │ │ -brahe_make_sinusoid
│ │ │ │ -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.
│ │ │ │ -brahe_gcf
│ │ │ │ -uint64_t brahe_gcf(uint64_t x, uint64_t y)
│ │ │ │ -Greatest common factor (denominator).
│ │ │ │ -brahe_add_noise
│ │ │ │ -void brahe_add_noise(double *a, const size_t n, double noise)
│ │ │ │ -Apply noise to a signal.
│ │ │ │ -brahe_statistics_t
│ │ │ │ -Structure containing statistical values calculate from a double array.
│ │ │ │ -Definition mathtools.h:179
│ │ │ │ -brahe_statistics_t::min
│ │ │ │ -double min
│ │ │ │ -minimum value from array
│ │ │ │ -Definition mathtools.h:181
│ │ │ │ -brahe_statistics_t::mean
│ │ │ │ -double mean
│ │ │ │ -mean (average)
│ │ │ │ -Definition mathtools.h:185
│ │ │ │ -brahe_statistics_t::variance
│ │ │ │ -double variance
│ │ │ │ -variance
│ │ │ │ -Definition mathtools.h:187
│ │ │ │ -brahe_statistics_t::max
│ │ │ │ -double max
│ │ │ │ -maximum value
│ │ │ │ -Definition mathtools.h:183
│ │ │ │ -brahe_statistics_t::sigma
│ │ │ │ -double sigma
│ │ │ │ -standard deviation
│ │ │ │ -Definition mathtools.h:189
│ │ │ │ -brahe_wave_factor_t
│ │ │ │ -Sine wave definition.
│ │ │ │ -Definition mathtools.h:244
│ │ │ │ -brahe_wave_factor_t::amplitude
│ │ │ │ -double amplitude
│ │ │ │ -arbitrary wave amplitude
│ │ │ │ -Definition mathtools.h:248
│ │ │ │ -brahe_wave_factor_t::wavelength
│ │ │ │ -double wavelength
│ │ │ │ -wavelength
│ │ │ │ -Definition mathtools.h:246
│ │ │ │ +177#if defined(__cplusplus)
│ │ │ │ +178}
│ │ │ │ +179#endif
│ │ │ │ +180
│ │ │ │ +181#endif
│ │ │ │ +brahe_prng_index
│ │ │ │ +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.
│ │ │ │ +BRAHE_UNKNOWN_SEED
│ │ │ │ +static uint32_t BRAHE_UNKNOWN_SEED
│ │ │ │ +Definition prng.h:90
│ │ │ │ +brahe_prng_real2
│ │ │ │ +double brahe_prng_real2(brahe_prng_state_t *prng_state)
│ │ │ │ +Get the next number in the range [0,1).
│ │ │ │ +brahe_prng_range
│ │ │ │ +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].
│ │ │ │ +brahe_prng_init
│ │ │ │ +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).
│ │ │ │ +brahe_prng_free
│ │ │ │ +void brahe_prng_free(brahe_prng_state_t *prng_state)
│ │ │ │ +Free resources used by PRNG.
│ │ │ │ +brahe_prng_real1
│ │ │ │ +double brahe_prng_real1(brahe_prng_state_t *prng_state)
│ │ │ │ +Get the next number in the range [0,1].
│ │ │ │ +brahe_prng_type_t
│ │ │ │ +brahe_prng_type_t
│ │ │ │ +Defines types of prngs.
│ │ │ │ +Definition prng.h:64
│ │ │ │ +BRAHE_PRNG_ISAAC
│ │ │ │ +@ BRAHE_PRNG_ISAAC
│ │ │ │ +Indirect, Shift, Accumulate, Add, and Count (Jenkins).
│ │ │ │ +Definition prng.h:74
│ │ │ │ +BRAHE_PRNG_MARSENNE_TWISTER
│ │ │ │ +@ BRAHE_PRNG_MARSENNE_TWISTER
│ │ │ │ +Marsenne Twister (Matsumoto & Nishimura).
│ │ │ │ +Definition prng.h:66
│ │ │ │ +BRAHE_PRNG_MWC1038
│ │ │ │ +@ BRAHE_PRNG_MWC1038
│ │ │ │ +MWC1038 (Marsaglia).
│ │ │ │ +Definition prng.h:72
│ │ │ │ +BRAHE_PRNG_CMWC4096
│ │ │ │ +@ BRAHE_PRNG_CMWC4096
│ │ │ │ +CMWC4096 (Marsaglia).
│ │ │ │ +Definition prng.h:70
│ │ │ │ +BRAHE_PRNG_KISS
│ │ │ │ +@ BRAHE_PRNG_KISS
│ │ │ │ +Keep is Simple, Stupid (Marsaglia).
│ │ │ │ +Definition prng.h:68
│ │ │ │ +brahe_prng_next
│ │ │ │ +uint32_t brahe_prng_next(brahe_prng_state_t *prng_state)
│ │ │ │ +Get the next integer.
│ │ │ │ +brahe_prng_real53
│ │ │ │ +double brahe_prng_real53(brahe_prng_state_t *prng_state)
│ │ │ │ +Get the next number in the range [0,1).
│ │ │ │ +brahe_prng_real3
│ │ │ │ +double brahe_prng_real3(brahe_prng_state_t *prng_state)
│ │ │ │ +Get the next number in the range (0,1).
│ │ │ │ +mathtools.h
│ │ │ │ +brahe_prng_state_t
│ │ │ │ +Contains state variables for a PRNG.
│ │ │ │ +Definition prng.h:79
│ │ │ │ +brahe_prng_state_t::m_data2
│ │ │ │ +void * m_data2
│ │ │ │ +Definition prng.h:83
│ │ │ │ +brahe_prng_state_t::m_b
│ │ │ │ +size_t m_b
│ │ │ │ +Definition prng.h:86
│ │ │ │ +brahe_prng_state_t::m_data1
│ │ │ │ +void * m_data1
│ │ │ │ +Definition prng.h:82
│ │ │ │ +brahe_prng_state_t::m_i
│ │ │ │ +size_t m_i
│ │ │ │ +Definition prng.h:84
│ │ │ │ +brahe_prng_state_t::m_a
│ │ │ │ +size_t m_a
│ │ │ │ +Definition prng.h:85
│ │ │ │ +brahe_prng_state_t::m_c
│ │ │ │ +size_t m_c
│ │ │ │ +Definition prng.h:87
│ │ │ │ +brahe_prng_state_t::m_type
│ │ │ │ +brahe_prng_type_t m_type
│ │ │ │ +Definition prng.h:80
│ │ │ │ +brahe_prng_state_t::m_seed
│ │ │ │ +uint32_t m_seed
│ │ │ │ +Definition prng.h:81
│ │ │ │ ===============================================================================
│ │ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ ├── ./usr/share/doc/libbrahe-dev/html/a00005.html
│ │ │ @@ -23,358 +23,1006 @@
│ │ │ src
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ +
│ │ │
│ │ │
│ │ │ -
#include "mathtools.h"
│ │ │ +
#include <stddef.h>
│ │ │ +#include <math.h>
│ │ │ +#include <limits.h>
│ │ │ +#include <float.h>
│ │ │ +#include <stdbool.h>
│ │ │ +#include <stdint.h>
│ │ │
│ │ │
Go to the source code of this file.
│ │ │
│ │ │ + |
│ │ │ +| #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.
|
│ │ │ +
│ │ │ |
│ │ │ -| 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).
|
│ │ │ -
│ │ │ - |
│ │ │ -| 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.
|
│ │ │
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_DEG_PER_RAD
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_E
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_E 2.71828182845904523536028747135 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_EULER
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_EULER 0.57721566490153286060651209008 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_LN_10
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_LN_10 2.30258509299404568401799145468 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_LN_2
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_LN_2 0.69314718055994530941723212146 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_LN_PI
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_LN_PI 1.14472988584940017414342735135 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_LOG10_E
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_LOG10_E 0.43429448190325182765112891892 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_LOG2_E
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_LOG2_E 1.44269504088896340735992468100 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_LOG_2
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_LOG_2 0.30102999566398119521373889472 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_ONE_DIV_PI
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_PI
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_PI 3.14159265358979323846264338328 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_PI_DIV_12
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_PI_DIV_12 0.26179938779914943653855361527 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_PI_DIV_18
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_PI_DIV_18 0.17453292519943295769236907685 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_PI_DIV_2
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_PI_DIV_2 1.57079632679489661923132169164 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_PI_DIV_3
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_PI_DIV_3 1.04719755119659774615421446109 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_PI_DIV_36
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_PI_DIV_36 0.08726646259971647884618453842 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_PI_DIV_4
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_PI_DIV_4 0.78539816339744830961566084582 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_PI_DIV_6
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_PI_DIV_6 0.52359877559829887307710723055 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_PI_DIV_9
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_PI_DIV_9 0.34906585039886591538473815370 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_RAD_PER_DEG
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_SQRT_2
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_SQRT_2 1.41421356237309504880168872421 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_SQRT_3
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_SQRT_3 1.73205080756887729352744634151 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_SQRT_HALF
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_SQRT_HALF 0.70710678118654752440084436210 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_SQRT_PI
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_SQRT_PI 1.77245385090551602729816748334 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_TAU
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_TAU 6.28318530717958647692528676656 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_TWO_DIV_PI
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ BRAHE_TWO_DIV_SQRT_PI
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | #define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312 |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ brahe_pretty_format
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ brahe_statistics
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_type_t
│ │ │ +
│ │ │ +
◆ brahe_pretty_format_t
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -| Enumerator |
|---|
| BRAHE_PRNG_MARSENNE_TWISTER | Marsenne Twister (Matsumoto & Nishimura).
│ │ │ - |
│ │ │ -| BRAHE_PRNG_KISS | Keep is Simple, Stupid (Marsaglia).
│ │ │ - |
│ │ │ -| BRAHE_PRNG_CMWC4096 | CMWC4096 (Marsaglia).
│ │ │ - |
│ │ │ -| BRAHE_PRNG_MWC1038 | MWC1038 (Marsaglia).
│ │ │ + |
| Enumerator |
|---|
| BRAHE_PRETTY_TEXT | english text (nine thousand, two hundred eleven)
│ │ │ |
│ │ │ -| BRAHE_PRNG_ISAAC | Indirect, Shift, Accumulate, Add, and Count (Jenkins).
│ │ │ + |
| BRAHE_PRETTY_COMMA | comma delimited, (1,234,567,890)
│ │ │ |
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_free()
│ │ │ +
│ │ │ +
◆ brahe_acosh()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | void brahe_prng_free |
│ │ │ + double brahe_acosh |
│ │ │ ( |
│ │ │ - brahe_prng_state_t * | prng_state | ) |
│ │ │ + const double | x | ) |
│ │ │ |
│ │ │
│ │ │
│ │ │
│ │ │ -
Frees the resources used by a PRNG
- Parameters
-
│ │ │ +
Calculates cosh-1.
- Parameters
-
│ │ │
│ │ │ - | prng_state | Object containing the state of a PRNG |
│ │ │ + | x | a value |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- true if successful, false if failed
│ │ │ +- Returns
- inverse hyperbolic cosine of x
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_index()
│ │ │ +
│ │ │ +
◆ brahe_add_noise()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | size_t brahe_prng_index |
│ │ │ + void brahe_add_noise |
│ │ │ ( |
│ │ │ - brahe_prng_state_t * | prng_state, |
│ │ │ + double * | a, |
│ │ │
│ │ │
│ │ │ |
│ │ │ |
│ │ │ - const size_t | length ) |
│ │ │ + const size_t | n, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ + |
│ │ │ + double | noise ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Returns the next value as a size_t "index" in the range [0,length).
- Parameters
-
│ │ │ +
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
-
│ │ │
│ │ │ - | prng_state | Object containing the state of a PRNG |
│ │ │ - | length | - Maximum value of result |
│ │ │ + | a | array containing signal data |
│ │ │ + | n | number of samples in signal |
│ │ │ + | noise | percentage of noise |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- A pseudorandom size_t value
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_init()
│ │ │ +
│ │ │ +
◆ brahe_asinh()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | bool brahe_prng_init |
│ │ │ + double brahe_asinh |
│ │ │ ( |
│ │ │ - brahe_prng_state_t * | prng_state, |
│ │ │ + const double | x | ) |
│ │ │ + |
│ │ │
│ │ │ +
│ │ │ +
│ │ │ +
Calculates sinh-1.
- Parameters
-
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
- Returns
- inverse hyperbolic sine of x
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ brahe_atanh()
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │
│ │ │ - |
│ │ │ + double brahe_atanh |
│ │ │ + ( |
│ │ │ + const double | x | ) |
│ │ │ |
│ │ │ - const brahe_prng_type_t | type, |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
Calculates tanh-1.
- Parameters
-
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
- Returns
- inverse hyperbolic tangent of x
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ brahe_gcf()
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | uint64_t brahe_gcf |
│ │ │ + ( |
│ │ │ + uint64_t | x, |
│ │ │
│ │ │
│ │ │ |
│ │ │ |
│ │ │ - const uint32_t | seed ) |
│ │ │ + uint64_t | y ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Initializes a psuedo-random number generator using a specified algorithm.
- Parameters
-
│ │ │ +
Calculates the greatest common factor for two values.
- Parameters
-
│ │ │
│ │ │ - | prng_state | Object to be initialized for a specific algorithm |
│ │ │ - | type | Algorithm to be used for this PRNG |
│ │ │ - | seed | Initialization seed |
│ │ │ + | x | first value |
│ │ │ + | y | second value |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- true if successful, false if failed
│ │ │ +- Returns
- The greatest common factor for x and y
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_next()
│ │ │ +
│ │ │ +
◆ brahe_get_statistics()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | uint32_t brahe_prng_next |
│ │ │ + brahe_statistics brahe_get_statistics |
│ │ │ ( |
│ │ │ - brahe_prng_state_t * | prng_state | ) |
│ │ │ + double * | data, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ |
│ │ │ + size_t | n ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Returns the next uint32_t in sequence.
- Parameters
-
│ │ │ +
Calculate several common statistics for an array of doubles.
- Parameters
-
│ │ │
│ │ │ - | prng_state | Object containing the state of a PRNG |
│ │ │ + | data | array of double values |
│ │ │ + | n | number of elements in data |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- A pseudorandom uint32_t value
│ │ │ +- Returns
- statistics for data
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_range()
│ │ │ +
│ │ │ +
◆ brahe_lcm()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | uint32_t brahe_prng_range |
│ │ │ + uint64_t brahe_lcm |
│ │ │ ( |
│ │ │ - brahe_prng_state_t * | prng_state, |
│ │ │ + const uint64_t | x, |
│ │ │
│ │ │
│ │ │ |
│ │ │ |
│ │ │ - const uint32_t | lo, |
│ │ │ + const uint64_t | y ) |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
Calculates the lowest common multiple for two values.
- Parameters
-
│ │ │ +
│ │ │ + | x | first value |
│ │ │ + | y | second value |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
- Returns
- The lowest common multiple for x and y
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ brahe_log2base()
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | double brahe_log2base |
│ │ │ + ( |
│ │ │ + const double | x, |
│ │ │
│ │ │
│ │ │ |
│ │ │ |
│ │ │ - const uint32_t | hi ) |
│ │ │ + const double | base ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
Returns the next int_value between lo and hi, inclusive.
- Parameters
-
│ │ │ +
Calculates the base-n logarithm for a given value. If a range error occurs, the return value equals NaN.
- Parameters
-
│ │ │
│ │ │ - | prng_state | Object containing the state of a PRNG |
│ │ │ - | lo | - Minimum value of result |
│ │ │ - | hi | - Maximum value of result |
│ │ │ + | x | value for which logarithm is required |
│ │ │ + | base | lagarithm base |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- A pseudorandom uint32_t value
│ │ │ +- Returns
- logarithm of x to base base; NAN on range error
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_real1()
│ │ │ +
│ │ │ +
◆ brahe_make_sinusoid()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | double brahe_prng_real1 |
│ │ │ + double * brahe_make_sinusoid |
│ │ │ ( |
│ │ │ - brahe_prng_state_t * | prng_state | ) |
│ │ │ + const brahe_wave_factor_t * | factors, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ |
│ │ │ + const size_t | factor_n, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ + |
│ │ │ + const size_t | array_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
-
│ │ │ +
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
-
│ │ │
│ │ │ - | prng_state | Object containing the state of a PRNG |
│ │ │ + | factors | defines properties of the sine waves to be combined |
│ │ │ + | factor_n | number of elements in factors |
│ │ │ + | array_n | number of elements in the output array |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- A pseudorandom double value
│ │ │ +- Returns
- an allocated array containg values generated from the given factors
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_real2()
│ │ │ +
│ │ │ +
◆ brahe_moving_average()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | double brahe_prng_real2 |
│ │ │ + double * brahe_moving_average |
│ │ │ ( |
│ │ │ - brahe_prng_state_t * | prng_state | ) |
│ │ │ + const double * | data, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ |
│ │ │ + const int | n, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ + |
│ │ │ + const int | distance ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
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
-
│ │ │ +
Computes the moving average for an array. The returned buffer must be freed by the calling code.
- Parameters
-
│ │ │
│ │ │ - | prng_state | Object containing the state of a PRNG |
│ │ │ + | data | array of double values to be averaged |
│ │ │ + | n | number of elements in data |
│ │ │ + | distance | number elements to average before and after an element in data |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- A pseudorandom double value
│ │ │ +- Returns
- an allocated n-length array containing the moving average of corresponding elements in data
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_real3()
│ │ │ +
│ │ │ +
◆ brahe_pretty_int()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | double brahe_prng_real3 |
│ │ │ + char * brahe_pretty_int |
│ │ │ ( |
│ │ │ - brahe_prng_state_t * | prng_state | ) |
│ │ │ + int64_t | n, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ |
│ │ │ + brahe_pretty_format | fmt ) |
│ │ │
│ │ │
│ │ │
│ │ │ -
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
-
│ │ │ +
Returns a nicely formatted strong for a given 64-bit integer.
- Parameters
-
│ │ │
│ │ │ - | prng_state | Object containing the state of a PRNG |
│ │ │ + | n | number to be formatted |
│ │ │ + | fmt | specifies format, as text or comma-delimited |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- A pseudorandom double value
│ │ │ +- Returns
- an allocated string containing the generated text
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
◆ brahe_round_nearest()
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | double brahe_round_nearest |
│ │ │ + ( |
│ │ │ + const double | x | ) |
│ │ │ + |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
Rounds a value to nearest integer, rounding to even for exact fractions of 0.5.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
◆ brahe_prng_real53()
│ │ │ +
│ │ │ +
◆ brahe_sigdig()
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ - | double brahe_prng_real53 |
│ │ │ + double brahe_sigdig |
│ │ │ ( |
│ │ │ - brahe_prng_state_t * | prng_state | ) |
│ │ │ + const double | x, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ |
│ │ │ + const uint16_t | 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
-
│ │ │ +
Returns the given value rounded for the number of specified decimal digits of precision.
- Parameters
-
│ │ │
│ │ │ - | prng_state | Object containing the state of a PRNG |
│ │ │ + | x | - Original value to be rounded |
│ │ │ + | n | - Number of significant digits |
│ │ │
│ │ │
│ │ │
│ │ │ -- Returns
- A pseudorandom double value
│ │ │ +- Returns
- The value x rounded to n digits of precision
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
◆ BRAHE_UNKNOWN_SEED
│ │ │ +
│ │ │ +
◆ brahe_simple_fft()
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │
│ │ │
│ │ │ - | uint32_t BRAHE_UNKNOWN_SEED = 0 |
│ │ │ + double * brahe_simple_fft |
│ │ │ + ( |
│ │ │ + const double * | data, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ + |
│ │ │ + const int | 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
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +◆ brahe_simple_fft2()
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | double * brahe_simple_fft2 |
│ │ │ + ( |
│ │ │ + const double * | data, |
│ │ │ +
│ │ │ +
│ │ │ + |
│ │ │ + |
│ │ │ + const int | 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
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +◆ brahe_sizepow2()
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ + | int brahe_sizepow2 |
│ │ │ + ( |
│ │ │ + const int | n | ) |
│ │ │ + |
│ │ │
│ │ │
│ │ │ - |
│ │ │ -
│ │ │ -static |
│ │ │ -
│ │ │ -
│ │ │
│ │ │ +
Returns the smallest power of 2 that includes n in its range
- Parameters
-
│ │ │ +
│ │ │ + | n | number that must be less than the result |
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
- Returns
- the lowest power of 2 that is greater than n, or
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ ├── html2text {}
│ │ │ │ @@ -1,138 +1,331 @@
│ │ │ │ ****** Brahe - a heterogenous collection of mathematical tools ******
│ │ │ │ ***** Main_Index
│ │ │ │ Home_Page *****
│ │ │ │ Created by Scott_Robert_Ladd
│ │ │ │ ===============================================================================
│ │ │ │ * src
│ │ │ │ -Data_Structures | Enumerations | Functions | Variables
│ │ │ │ -prng.h File Reference
│ │ │ │ -#include "mathtools.h"
│ │ │ │ +Data_Structures | Macros | Typedefs | Enumerations | Functions
│ │ │ │ +mathtools.h File Reference
│ │ │ │ +#include
│ │ │ │ +#include
│ │ │ │ +#include
│ │ │ │ +#include
│ │ │ │ +#include
│ │ │ │ +#include
│ │ │ │ Go_to_the_source_code_of_this_file.
│ │ │ │ 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...
│ │ │ │ +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.
│ │ │ │ +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.
│ │ │ │ Enumerations
│ │ │ │ -enum brahe_prng_type_t {
│ │ │ │ - BRAHE_PRNG_MARSENNE_TWISTER = 0 , BRAHE_PRNG_KISS , BRAHE_PRNG_
│ │ │ │ - CMWC4096 , BRAHE_PRNG_MWC1038 ,
│ │ │ │ - BRAHE_PRNG_ISAAC
│ │ │ │ - }
│ │ │ │ - Defines types of prngs. More...
│ │ │ │ +enum brahe_pretty_format_t { BRAHE_PRETTY_TEXT , BRAHE_PRETTY_COMMA }
│ │ │ │ + Formats for pretty-printing integers. More...
│ │ │ │ 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).
│ │ │ │ -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.
│ │ │ │ +***** Macro Definition Documentation *****
│ │ │ │ +***** ◆ BRAHE_DEG_PER_RAD *****
│ │ │ │ +#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141
│ │ │ │ +***** ◆ BRAHE_E *****
│ │ │ │ +#define BRAHE_E 2.71828182845904523536028747135
│ │ │ │ +***** ◆ BRAHE_EULER *****
│ │ │ │ +#define BRAHE_EULER 0.57721566490153286060651209008
│ │ │ │ +***** ◆ BRAHE_LN_10 *****
│ │ │ │ +#define BRAHE_LN_10 2.30258509299404568401799145468
│ │ │ │ +***** ◆ BRAHE_LN_2 *****
│ │ │ │ +#define BRAHE_LN_2 0.69314718055994530941723212146
│ │ │ │ +***** ◆ BRAHE_LN_PI *****
│ │ │ │ +#define BRAHE_LN_PI 1.14472988584940017414342735135
│ │ │ │ +***** ◆ BRAHE_LOG10_E *****
│ │ │ │ +#define BRAHE_LOG10_E 0.43429448190325182765112891892
│ │ │ │ +***** ◆ BRAHE_LOG2_E *****
│ │ │ │ +#define BRAHE_LOG2_E 1.44269504088896340735992468100
│ │ │ │ +***** ◆ BRAHE_LOG_2 *****
│ │ │ │ +#define BRAHE_LOG_2 0.30102999566398119521373889472
│ │ │ │ +***** ◆ BRAHE_ONE_DIV_PI *****
│ │ │ │ +#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675
│ │ │ │ +***** ◆ BRAHE_PI *****
│ │ │ │ +#define BRAHE_PI 3.14159265358979323846264338328
│ │ │ │ +***** ◆ BRAHE_PI_DIV_12 *****
│ │ │ │ +#define BRAHE_PI_DIV_12 0.26179938779914943653855361527
│ │ │ │ +***** ◆ BRAHE_PI_DIV_18 *****
│ │ │ │ +#define BRAHE_PI_DIV_18 0.17453292519943295769236907685
│ │ │ │ +***** ◆ BRAHE_PI_DIV_2 *****
│ │ │ │ +#define BRAHE_PI_DIV_2 1.57079632679489661923132169164
│ │ │ │ +***** ◆ BRAHE_PI_DIV_3 *****
│ │ │ │ +#define BRAHE_PI_DIV_3 1.04719755119659774615421446109
│ │ │ │ +***** ◆ BRAHE_PI_DIV_36 *****
│ │ │ │ +#define BRAHE_PI_DIV_36 0.08726646259971647884618453842
│ │ │ │ +***** ◆ BRAHE_PI_DIV_4 *****
│ │ │ │ +#define BRAHE_PI_DIV_4 0.78539816339744830961566084582
│ │ │ │ +***** ◆ BRAHE_PI_DIV_6 *****
│ │ │ │ +#define BRAHE_PI_DIV_6 0.52359877559829887307710723055
│ │ │ │ +***** ◆ BRAHE_PI_DIV_9 *****
│ │ │ │ +#define BRAHE_PI_DIV_9 0.34906585039886591538473815370
│ │ │ │ +***** ◆ BRAHE_RAD_PER_DEG *****
│ │ │ │ +#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768
│ │ │ │ +***** ◆ BRAHE_SQRT_2 *****
│ │ │ │ +#define BRAHE_SQRT_2 1.41421356237309504880168872421
│ │ │ │ +***** ◆ BRAHE_SQRT_3 *****
│ │ │ │ +#define BRAHE_SQRT_3 1.73205080756887729352744634151
│ │ │ │ +***** ◆ BRAHE_SQRT_HALF *****
│ │ │ │ +#define BRAHE_SQRT_HALF 0.70710678118654752440084436210
│ │ │ │ +***** ◆ BRAHE_SQRT_PI *****
│ │ │ │ +#define BRAHE_SQRT_PI 1.77245385090551602729816748334
│ │ │ │ +***** ◆ BRAHE_TAU *****
│ │ │ │ +#define BRAHE_TAU 6.28318530717958647692528676656
│ │ │ │ +***** ◆ BRAHE_TWO_DIV_PI *****
│ │ │ │ +#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349
│ │ │ │ +***** ◆ BRAHE_TWO_DIV_SQRT_PI *****
│ │ │ │ +#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312
│ │ │ │ +***** Typedef Documentation *****
│ │ │ │ +***** ◆ brahe_pretty_format *****
│ │ │ │ +typedef enum brahe_pretty_format_t brahe_pretty_format
│ │ │ │ +***** ◆ brahe_statistics *****
│ │ │ │ +typedef struct brahe_statistics_t brahe_statistics
│ │ │ │ ***** Enumeration Type Documentation *****
│ │ │ │ -***** ◆ brahe_prng_type_t *****
│ │ │ │ -enum brahe_prng_type_t
│ │ │ │ +***** ◆ brahe_pretty_format_t *****
│ │ │ │ +enum brahe_pretty_format_t
│ │ │ │ Enumerator
│ │ │ │ -BRAHE_PRNG_MARSENNE_TWISTER Marsenne Twister (Matsumoto & Nishimura).
│ │ │ │ -BRAHE_PRNG_KISS Keep is Simple, Stupid (Marsaglia).
│ │ │ │ -BRAHE_PRNG_CMWC4096 CMWC4096 (Marsaglia).
│ │ │ │ -BRAHE_PRNG_MWC1038 MWC1038 (Marsaglia).
│ │ │ │ -BRAHE_PRNG_ISAAC Indirect, Shift, Accumulate, Add, and Count
│ │ │ │ - (Jenkins).
│ │ │ │ +BRAHE_PRETTY_TEXT english text (nine thousand, two hundred eleven)
│ │ │ │ +BRAHE_PRETTY_COMMA comma delimited, (1,234,567,890)
│ │ │ │ ***** Function Documentation *****
│ │ │ │ -***** ◆ brahe_prng_free() *****
│ │ │ │ -void brahe_prng_free ( brahe_prng_state_t * prng_state )
│ │ │ │ -Frees the resources used by a PRNG
│ │ │ │ - Parameters
│ │ │ │ - prng_state Object containing the state of a PRNG
│ │ │ │ - Returns
│ │ │ │ - true if successful, false if failed
│ │ │ │ -***** ◆ brahe_prng_index() *****
│ │ │ │ -size_t brahe_prng_index ( brahe_prng_state_t * prng_state,
│ │ │ │ - const size_t length )
│ │ │ │ -Returns the next value as a size_t "index" in the range [0,length).
│ │ │ │ - Parameters
│ │ │ │ - prng_state Object containing the state of a PRNG
│ │ │ │ - length - Maximum value of result
│ │ │ │ - Returns
│ │ │ │ - A pseudorandom size_t value
│ │ │ │ -***** ◆ brahe_prng_init() *****
│ │ │ │ -bool brahe_prng_init ( brahe_prng_state_t * prng_state,
│ │ │ │ - const brahe_prng_type_t type,
│ │ │ │ - const uint32_t seed )
│ │ │ │ -Initializes a psuedo-random number generator using a specified algorithm.
│ │ │ │ - Parameters
│ │ │ │ - prng_state Object to be initialized for a specific algorithm
│ │ │ │ - type Algorithm to be used for this PRNG
│ │ │ │ - seed Initialization seed
│ │ │ │ - Returns
│ │ │ │ - true if successful, false if failed
│ │ │ │ -***** ◆ brahe_prng_next() *****
│ │ │ │ -uint32_t brahe_prng_next ( brahe_prng_state_t * prng_state )
│ │ │ │ -Returns the next uint32_t in sequence.
│ │ │ │ - Parameters
│ │ │ │ - prng_state Object containing the state of a PRNG
│ │ │ │ - Returns
│ │ │ │ - A pseudorandom uint32_t value
│ │ │ │ -***** ◆ brahe_prng_range() *****
│ │ │ │ -uint32_t brahe_prng_range ( brahe_prng_state_t * prng_state,
│ │ │ │ - const uint32_t lo,
│ │ │ │ - const uint32_t hi )
│ │ │ │ -Returns the next int_value between lo and hi, inclusive.
│ │ │ │ - Parameters
│ │ │ │ - prng_state Object containing the state of a PRNG
│ │ │ │ - lo - Minimum value of result
│ │ │ │ - hi - Maximum value of result
│ │ │ │ - Returns
│ │ │ │ - A pseudorandom uint32_t value
│ │ │ │ -***** ◆ brahe_prng_real1() *****
│ │ │ │ -double brahe_prng_real1 ( brahe_prng_state_t * prng_state )
│ │ │ │ -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
│ │ │ │ - prng_state Object containing the state of a PRNG
│ │ │ │ - Returns
│ │ │ │ - A pseudorandom double value
│ │ │ │ -***** ◆ brahe_prng_real2() *****
│ │ │ │ -double brahe_prng_real2 ( brahe_prng_state_t * prng_state )
│ │ │ │ -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
│ │ │ │ - prng_state Object containing the state of a PRNG
│ │ │ │ - Returns
│ │ │ │ - A pseudorandom double value
│ │ │ │ -***** ◆ brahe_prng_real3() *****
│ │ │ │ -double brahe_prng_real3 ( brahe_prng_state_t * prng_state )
│ │ │ │ -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
│ │ │ │ - prng_state Object containing the state of a PRNG
│ │ │ │ - Returns
│ │ │ │ - A pseudorandom double value
│ │ │ │ -***** ◆ brahe_prng_real53() *****
│ │ │ │ -double brahe_prng_real53 ( brahe_prng_state_t * prng_state )
│ │ │ │ -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
│ │ │ │ - prng_state Object containing the state of a PRNG
│ │ │ │ - Returns
│ │ │ │ - A pseudorandom double value
│ │ │ │ -***** Variable Documentation *****
│ │ │ │ -***** ◆ BRAHE_UNKNOWN_SEED *****
│ │ │ │ -uint32_t BRAHE_UNKNOWN_SEED = 0 static
│ │ │ │ +***** ◆ brahe_acosh() *****
│ │ │ │ +double brahe_acosh ( const double x )
│ │ │ │ +Calculates cosh-1.
│ │ │ │ + Parameters
│ │ │ │ + x a value
│ │ │ │ + Returns
│ │ │ │ + inverse hyperbolic cosine of x
│ │ │ │ +***** ◆ brahe_add_noise() *****
│ │ │ │ +void brahe_add_noise ( double * a,
│ │ │ │ + const size_t n,
│ │ │ │ + double noise )
│ │ │ │ +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
│ │ │ │ + a array containing signal data
│ │ │ │ + n number of samples in signal
│ │ │ │ + noise percentage of noise
│ │ │ │ +***** ◆ brahe_asinh() *****
│ │ │ │ +double brahe_asinh ( const double x )
│ │ │ │ +Calculates sinh-1.
│ │ │ │ + Parameters
│ │ │ │ + x a value
│ │ │ │ + Returns
│ │ │ │ + inverse hyperbolic sine of x
│ │ │ │ +***** ◆ brahe_atanh() *****
│ │ │ │ +double brahe_atanh ( const double x )
│ │ │ │ +Calculates tanh-1.
│ │ │ │ + Parameters
│ │ │ │ + x a value
│ │ │ │ + Returns
│ │ │ │ + inverse hyperbolic tangent of x
│ │ │ │ +***** ◆ brahe_gcf() *****
│ │ │ │ +uint64_t brahe_gcf ( uint64_t x,
│ │ │ │ + uint64_t y )
│ │ │ │ +Calculates the greatest common factor for two values.
│ │ │ │ + Parameters
│ │ │ │ + x first value
│ │ │ │ + y second value
│ │ │ │ + Returns
│ │ │ │ + The greatest common factor for x and y
│ │ │ │ +***** ◆ brahe_get_statistics() *****
│ │ │ │ +brahe_statistics brahe_get_statistics ( double * data,
│ │ │ │ + size_t n )
│ │ │ │ +Calculate several common statistics for an array of doubles.
│ │ │ │ + Parameters
│ │ │ │ + data array of double values
│ │ │ │ + n number of elements in data
│ │ │ │ + Returns
│ │ │ │ + statistics for data
│ │ │ │ +***** ◆ brahe_lcm() *****
│ │ │ │ +uint64_t brahe_lcm ( const uint64_t x,
│ │ │ │ + const uint64_t y )
│ │ │ │ +Calculates the lowest common multiple for two values.
│ │ │ │ + Parameters
│ │ │ │ + x first value
│ │ │ │ + y second value
│ │ │ │ + Returns
│ │ │ │ + The lowest common multiple for x and y
│ │ │ │ +***** ◆ brahe_log2base() *****
│ │ │ │ +double brahe_log2base ( const double x,
│ │ │ │ + const double base )
│ │ │ │ +Calculates the base-n logarithm for a given value. If a range error occurs, the
│ │ │ │ +return value equals NaN.
│ │ │ │ + Parameters
│ │ │ │ + x value for which logarithm is required
│ │ │ │ + base lagarithm base
│ │ │ │ + Returns
│ │ │ │ + logarithm of x to base base; NAN on range error
│ │ │ │ +***** ◆ brahe_make_sinusoid() *****
│ │ │ │ +double * brahe_make_sinusoid ( const brahe_wave_factor_t * factors,
│ │ │ │ + const size_t factor_n,
│ │ │ │ + const size_t array_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
│ │ │ │ + factors defines properties of the sine waves to be combined
│ │ │ │ + factor_n number of elements in factors
│ │ │ │ + array_n number of elements in the output array
│ │ │ │ + Returns
│ │ │ │ + an allocated array containg values generated from the given factors
│ │ │ │ +***** ◆ brahe_moving_average() *****
│ │ │ │ +double * brahe_moving_average ( const double * data,
│ │ │ │ + const int n,
│ │ │ │ + const int distance )
│ │ │ │ +Computes the moving average for an array. The returned buffer must be freed by
│ │ │ │ +the calling code.
│ │ │ │ + Parameters
│ │ │ │ + data array of double values to be averaged
│ │ │ │ + n number of elements in data
│ │ │ │ + distance number elements to average before and after an element in data
│ │ │ │ + Returns
│ │ │ │ + an allocated n-length array containing the moving average of
│ │ │ │ + corresponding elements in data
│ │ │ │ +***** ◆ brahe_pretty_int() *****
│ │ │ │ +char * brahe_pretty_int ( int64_t n,
│ │ │ │ + brahe_pretty_format fmt )
│ │ │ │ +Returns a nicely formatted strong for a given 64-bit integer.
│ │ │ │ + Parameters
│ │ │ │ + n number to be formatted
│ │ │ │ + fmt specifies format, as text or comma-delimited
│ │ │ │ + Returns
│ │ │ │ + an allocated string containing the generated text
│ │ │ │ +***** ◆ brahe_round_nearest() *****
│ │ │ │ +double brahe_round_nearest ( const double x )
│ │ │ │ +Rounds a value to nearest integer, rounding to even for exact fractions of 0.5.
│ │ │ │ +***** ◆ brahe_sigdig() *****
│ │ │ │ +double brahe_sigdig ( const double x,
│ │ │ │ + const uint16_t n )
│ │ │ │ +Returns the given value rounded for the number of specified decimal digits of
│ │ │ │ +precision.
│ │ │ │ + Parameters
│ │ │ │ + x - Original value to be rounded
│ │ │ │ + n - Number of significant digits
│ │ │ │ + Returns
│ │ │ │ + The value x rounded to n digits of precision
│ │ │ │ +***** ◆ brahe_simple_fft() *****
│ │ │ │ +double * brahe_simple_fft ( const double * data,
│ │ │ │ + const int 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
│ │ │ │ +***** ◆ brahe_simple_fft2() *****
│ │ │ │ +double * brahe_simple_fft2 ( const double * data,
│ │ │ │ + const int 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
│ │ │ │ +***** ◆ brahe_sizepow2() *****
│ │ │ │ +int brahe_sizepow2 ( const int n )
│ │ │ │ +Returns the smallest power of 2 that includes n in its range
│ │ │ │ + Parameters
│ │ │ │ + n number that must be less than the result
│ │ │ │ + Returns
│ │ │ │ + the lowest power of 2 that is greater than n, or
│ │ │ │ ===============================================================================
│ │ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ ├── ./usr/share/doc/libbrahe-dev/html/a00005_source.html
│ │ │ @@ -21,15 +21,15 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Go to the documentation of this file.
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -76,108 +76,246 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
53#if !defined(LIBBRAHE_PRNG_H)
│ │ │ -
54#define LIBBRAHE_PRNG_H
│ │ │ +
53#if !defined(LIBBRAHE_MATHTOOLS_H)
│ │ │ +
54#define LIBBRAHE_MATHTOOLS_H
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
58#if defined(__cplusplus)
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
61#if defined(__cplusplus)
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
66#pragma warning (disable: 4244 4267 4996)
│ │ │ +
67#if !defined(__cplusplus)
│ │ │ +
│ │ │ +
69static const int true = 1;
│ │ │ +
70static const int false = 0;
│ │ │ +
│ │ │ +
72typedef unsigned __int64 uint64_t;
│ │ │ +
73typedef __int64 int64_t;
│ │ │ +
74typedef unsigned __int32 uint32_t;
│ │ │ +
75typedef __int32 int32_t;
│ │ │ +
76typedef unsigned __int16 uint16_t;
│ │ │ +
77typedef __int16 int16_t;
│ │ │ +
78typedef unsigned __int8 uint8_t;
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
177#if defined(__cplusplus)
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
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.
│ │ │ -
static uint32_t BRAHE_UNKNOWN_SEED
Definition prng.h:90
│ │ │ -
double brahe_prng_real2(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1).
│ │ │ -
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].
│ │ │ -
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.
│ │ │ -
double brahe_prng_real1(brahe_prng_state_t *prng_state)
Get the next number in the range [0,1].
│ │ │ -
brahe_prng_type_t
Defines types of prngs.
Definition prng.h:64
│ │ │ -
@ BRAHE_PRNG_ISAAC
Indirect, Shift, Accumulate, Add, and Count (Jenkins).
Definition prng.h:74
│ │ │ -
@ BRAHE_PRNG_MARSENNE_TWISTER
Marsenne Twister (Matsumoto & Nishimura).
Definition prng.h:66
│ │ │ -
@ BRAHE_PRNG_MWC1038
MWC1038 (Marsaglia).
Definition prng.h:72
│ │ │ -
@ BRAHE_PRNG_CMWC4096
CMWC4096 (Marsaglia).
Definition prng.h:70
│ │ │ -
@ BRAHE_PRNG_KISS
Keep is Simple, Stupid (Marsaglia).
Definition prng.h:68
│ │ │ -
uint32_t brahe_prng_next(brahe_prng_state_t *prng_state)
Get the next integer.
│ │ │ -
double brahe_prng_real53(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).
│ │ │ -
Contains state variables for a PRNG.
Definition prng.h:79
│ │ │ -
void * m_data2
Definition prng.h:83
│ │ │ -
size_t m_b
Definition prng.h:86
│ │ │ -
void * m_data1
Definition prng.h:82
│ │ │ -
size_t m_i
Definition prng.h:84
│ │ │ -
size_t m_a
Definition prng.h:85
│ │ │ -
size_t m_c
Definition prng.h:87
│ │ │ -
brahe_prng_type_t m_type
Definition prng.h:80
│ │ │ -
uint32_t m_seed
Definition prng.h:81
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
308#define BRAHE_E 2.71828182845904523536028747135
│ │ │ +
│ │ │ +
311#define BRAHE_LOG2_E 1.44269504088896340735992468100
│ │ │ +
│ │ │ +
314#define BRAHE_LOG10_E 0.43429448190325182765112891892
│ │ │ +
│ │ │ +
317#define BRAHE_SQRT_2 1.41421356237309504880168872421
│ │ │ +
│ │ │ +
320#define BRAHE_SQRT_HALF 0.70710678118654752440084436210
│ │ │ +
│ │ │ +
323#define BRAHE_SQRT_3 1.73205080756887729352744634151
│ │ │ +
│ │ │ +
326#define BRAHE_PI 3.14159265358979323846264338328
│ │ │ +
│ │ │ +
329#define BRAHE_TAU 6.28318530717958647692528676656
│ │ │ +
│ │ │ +
332#define BRAHE_PI_DIV_2 1.57079632679489661923132169164
│ │ │ +
│ │ │ +
335#define BRAHE_PI_DIV_3 1.04719755119659774615421446109
│ │ │ +
│ │ │ +
338#define BRAHE_PI_DIV_4 0.78539816339744830961566084582
│ │ │ +
│ │ │ +
341#define BRAHE_PI_DIV_6 0.52359877559829887307710723055
│ │ │ +
│ │ │ +
344#define BRAHE_PI_DIV_9 0.34906585039886591538473815370
│ │ │ +
│ │ │ +
347#define BRAHE_PI_DIV_12 0.26179938779914943653855361527
│ │ │ +
│ │ │ +
350#define BRAHE_PI_DIV_18 0.17453292519943295769236907685
│ │ │ +
│ │ │ +
353#define BRAHE_PI_DIV_36 0.08726646259971647884618453842
│ │ │ +
│ │ │ +
356#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141
│ │ │ +
│ │ │ +
359#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768
│ │ │ +
│ │ │ +
362#define BRAHE_SQRT_PI 1.77245385090551602729816748334
│ │ │ +
│ │ │ +
365#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312
│ │ │ +
│ │ │ +
368#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675
│ │ │ +
│ │ │ +
371#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349
│ │ │ +
│ │ │ +
374#define BRAHE_LN_10 2.30258509299404568401799145468
│ │ │ +
│ │ │ +
377#define BRAHE_LN_2 0.69314718055994530941723212146
│ │ │ +
│ │ │ +
380#define BRAHE_LOG_2 0.30102999566398119521373889472
│ │ │ +
│ │ │ +
383#define BRAHE_LN_PI 1.14472988584940017414342735135
│ │ │ +
│ │ │ +
386#define BRAHE_EULER 0.57721566490153286060651209008
│ │ │ +
│ │ │ +
388#if defined(__cplusplus)
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
double brahe_log2base(const double x, const double base)
Logarithm to a specified base.
│ │ │ +
double brahe_round_nearest(const double x)
Round to nearest value.
│ │ │ +
brahe_pretty_format_t
Formats for pretty-printing integers.
Definition mathtools.h:156
│ │ │ +
@ BRAHE_PRETTY_COMMA
comma delimited, (1,234,567,890)
Definition mathtools.h:160
│ │ │ +
@ BRAHE_PRETTY_TEXT
english text (nine thousand, two hundred eleven)
Definition mathtools.h:158
│ │ │ +
char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt)
Turn a 64-bit integer into a pretty string.
│ │ │ +
double * brahe_moving_average(const double *data, const int n, const int distance)
Moving average.
│ │ │ +
int brahe_sizepow2(const int n)
Smallest power of 2 that includes a given value.
│ │ │ +
uint64_t brahe_lcm(const uint64_t x, const uint64_t y)
Lowest common multiple.
│ │ │ +
double * brahe_simple_fft2(const double *data, const int n)
Simple real-to-real fft (power of 2 length).
│ │ │ +
double brahe_sigdig(const double x, const uint16_t n)
Set number of significant digits in a floating-point value.
│ │ │ +
double brahe_asinh(const double x)
Hyperbolic arcsine.
│ │ │ +
double brahe_acosh(const double x)
Hyperbolic arccosine.
│ │ │ +
struct brahe_statistics_t brahe_statistics
Structure containing statistical values calculate from a double array.
│ │ │ +
double brahe_atanh(const double x)
Hyperbolic arctangent.
│ │ │ +
double * brahe_simple_fft(const double *data, const int n)
Simple real-to-real fft (arbitrary length).
│ │ │ +
brahe_statistics brahe_get_statistics(double *data, size_t n)
statistics for array of double
│ │ │ +
enum brahe_pretty_format_t brahe_pretty_format
Formats for pretty-printing integers.
│ │ │ +
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.
│ │ │ +
uint64_t brahe_gcf(uint64_t x, uint64_t y)
Greatest common factor (denominator).
│ │ │ +
void brahe_add_noise(double *a, const size_t n, double noise)
Apply noise to a signal.
│ │ │ +
Structure containing statistical values calculate from a double array.
Definition mathtools.h:179
│ │ │ +
double min
minimum value from array
Definition mathtools.h:181
│ │ │ +
double mean
mean (average)
Definition mathtools.h:185
│ │ │ +
double variance
variance
Definition mathtools.h:187
│ │ │ +
double max
maximum value
Definition mathtools.h:183
│ │ │ +
double sigma
standard deviation
Definition mathtools.h:189
│ │ │ +
Sine wave definition.
Definition mathtools.h:244
│ │ │ +
double amplitude
arbitrary wave amplitude
Definition mathtools.h:248
│ │ │ +
double wavelength
wavelength
Definition mathtools.h:246
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ │
│ │ │ ├── html2text {}
│ │ │ │ @@ -1,14 +1,14 @@
│ │ │ │ ****** Brahe - a heterogenous collection of mathematical tools ******
│ │ │ │ ***** Main_Index
│ │ │ │ Home_Page *****
│ │ │ │ Created by Scott_Robert_Ladd
│ │ │ │ ===============================================================================
│ │ │ │ * src
│ │ │ │ -prng.h
│ │ │ │ +mathtools.h
│ │ │ │ Go_to_the_documentation_of_this_file.
│ │ │ │ 1/*
│ │ │ │ 2 Brahe is a heterogenous collection of mathematical tools, written in Standard
│ │ │ │ C.
│ │ │ │ 3
│ │ │ │ 4 Copyright 2011 Scott Robert Ladd. All rights reserved.
│ │ │ │ 5
│ │ │ │ @@ -73,161 +73,326 @@
│ │ │ │ 46 The author can be contacted at:
│ │ │ │ 47
│ │ │ │ 48 scott.ladd@coyotegulch.com
│ │ │ │ 49 scott.ladd@gmail.com
│ │ │ │ 50 http:www.coyotegulch.com
│ │ │ │ 51*/
│ │ │ │ 52
│ │ │ │ -53#if !defined(LIBBRAHE_PRNG_H)
│ │ │ │ -54#define LIBBRAHE_PRNG_H
│ │ │ │ +53#if !defined(LIBBRAHE_MATHTOOLS_H)
│ │ │ │ +54#define LIBBRAHE_MATHTOOLS_H
│ │ │ │ 55
│ │ │ │ -56#include "mathtools.h"
│ │ │ │ -57
│ │ │ │ -58#if defined(__cplusplus)
│ │ │ │ -59extern "C" {
│ │ │ │ -60#endif
│ │ │ │ -61
│ │ │ │ -63typedef enum
│ │ │ │ -64{
│ │ │ │ -66 BRAHE_PRNG_MARSENNE_TWISTER = 0,
│ │ │ │ -68 BRAHE_PRNG_KISS,
│ │ │ │ -70 BRAHE_PRNG_CMWC4096,
│ │ │ │ -72 BRAHE_PRNG_MWC1038,
│ │ │ │ -74 BRAHE_PRNG_ISAAC
│ │ │ │ -75} brahe_prng_type_t;
│ │ │ │ -76
│ │ │ │ -78typedef struct
│ │ │ │ -79{
│ │ │ │ -80 brahe_prng_type_t m_type; // the algorithm we're using
│ │ │ │ -81 uint32_t m_seed; // "seed" that defines the sequence
│ │ │ │ -82 void * m_data1; // array or table
│ │ │ │ -83 void * m_data2; // additional array or table
│ │ │ │ -84 size_t m_i; // only used by some algorithms
│ │ │ │ -85 size_t m_a; // only used by some algorithms
│ │ │ │ -86 size_t m_b; // only used by some algorithms
│ │ │ │ -87 size_t m_c; // only used by some algorithms
│ │ │ │ -88} brahe_prng_state_t;
│ │ │ │ +56#include
│ │ │ │ +57#include
│ │ │ │ +58#include
│ │ │ │ +59#include
│ │ │ │ +60
│ │ │ │ +61#if defined(__cplusplus)
│ │ │ │ +62extern "C" {
│ │ │ │ +63#endif
│ │ │ │ +64
│ │ │ │ +65#if defined(_MSC_VER)
│ │ │ │ +66#pragma warning (disable: 4244 4267 4996)
│ │ │ │ +67#if !defined(__cplusplus)
│ │ │ │ +68typedef char bool;
│ │ │ │ +69static const int true = 1;
│ │ │ │ +70static const int false = 0;
│ │ │ │ +71#endif
│ │ │ │ +72typedef unsigned __int64 uint64_t;
│ │ │ │ +73typedef __int64 int64_t;
│ │ │ │ +74typedef unsigned __int32 uint32_t;
│ │ │ │ +75typedef __int32 int32_t;
│ │ │ │ +76typedef unsigned __int16 uint16_t;
│ │ │ │ +77typedef __int16 int16_t;
│ │ │ │ +78typedef unsigned __int8 uint8_t;
│ │ │ │ +79typedef __int8 int8_t;
│ │ │ │ +80#else
│ │ │ │ +81// ISO C standard compilers
│ │ │ │ +82#include
│ │ │ │ +83#include
│ │ │ │ +84#endif
│ │ │ │ +85
│ │ │ │ +86//---------------------------------------------------------------------------
│ │ │ │ +--
│ │ │ │ +87// Rounding
│ │ │ │ +88//---------------------------------------------------------------------------
│ │ │ │ +--
│ │ │ │ 89
│ │ │ │ -90static uint32_t BRAHE_UNKNOWN_SEED = 0;
│ │ │ │ 91
│ │ │ │ -93
│ │ │ │ -100bool brahe_prng_init(brahe_prng_state_t * prng_state, const brahe_prng_type_
│ │ │ │ -t type, const uint32_t seed);
│ │ │ │ -101
│ │ │ │ -103
│ │ │ │ -108void brahe_prng_free(brahe_prng_state_t * prng_state);
│ │ │ │ +94double brahe_round_nearest(const double x);
│ │ │ │ +95
│ │ │ │ +97
│ │ │ │ +104double brahe_sigdig(const double x, const uint16_t n);
│ │ │ │ +105
│ │ │ │ +106//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +107// Lowest Common Multple (LCM) and Lowest Common Denominator (GCD)
│ │ │ │ +108//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ 109
│ │ │ │ 111
│ │ │ │ -116uint32_t brahe_prng_next(brahe_prng_state_t * prng_state);
│ │ │ │ -117
│ │ │ │ -119
│ │ │ │ -126uint32_t brahe_prng_range(brahe_prng_state_t * prng_state, const uint32_
│ │ │ │ -t lo, const uint32_t hi);
│ │ │ │ +117uint64_t brahe_lcm(const uint64_t x, const uint64_t y);
│ │ │ │ +118
│ │ │ │ +120
│ │ │ │ +126uint64_t brahe_gcf(uint64_t x, uint64_t y);
│ │ │ │ 127
│ │ │ │ -129
│ │ │ │ -135size_t brahe_prng_index(brahe_prng_state_t * prng_state, const size_
│ │ │ │ -t length);
│ │ │ │ -136
│ │ │ │ -138
│ │ │ │ -145double brahe_prng_real1(brahe_prng_state_t * prng_state);
│ │ │ │ -146
│ │ │ │ -148
│ │ │ │ -155double brahe_prng_real2(brahe_prng_state_t * prng_state);
│ │ │ │ -156
│ │ │ │ -158
│ │ │ │ -165double brahe_prng_real3(brahe_prng_state_t * prng_state);
│ │ │ │ -166
│ │ │ │ -168
│ │ │ │ -175double brahe_prng_real53(brahe_prng_state_t * prng_state);
│ │ │ │ +128//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +129// Logarithms
│ │ │ │ +130//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +131
│ │ │ │ +133
│ │ │ │ +140double brahe_log2base(const double x, const double base);
│ │ │ │ +141
│ │ │ │ +143
│ │ │ │ +148int brahe_sizepow2(const int n);
│ │ │ │ +149
│ │ │ │ +150//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +151// Statistical functions
│ │ │ │ +152//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +153
│ │ │ │ +155typedef enum brahe_pretty_format_t
│ │ │ │ +156{
│ │ │ │ +158 BRAHE_PRETTY_TEXT,
│ │ │ │ +160 BRAHE_PRETTY_COMMA
│ │ │ │ +161}
│ │ │ │ +162brahe_pretty_format;
│ │ │ │ +163
│ │ │ │ +165
│ │ │ │ +171char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt);
│ │ │ │ +172
│ │ │ │ +173//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +174// Statistical functions
│ │ │ │ +175//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ 176
│ │ │ │ -177#if defined(__cplusplus)
│ │ │ │ -178}
│ │ │ │ -179#endif
│ │ │ │ -180
│ │ │ │ -181#endif
│ │ │ │ -mathtools.h
│ │ │ │ -brahe_prng_index
│ │ │ │ -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.
│ │ │ │ -BRAHE_UNKNOWN_SEED
│ │ │ │ -static uint32_t BRAHE_UNKNOWN_SEED
│ │ │ │ -Definition prng.h:90
│ │ │ │ -brahe_prng_real2
│ │ │ │ -double brahe_prng_real2(brahe_prng_state_t *prng_state)
│ │ │ │ -Get the next number in the range [0,1).
│ │ │ │ -brahe_prng_range
│ │ │ │ -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].
│ │ │ │ -brahe_prng_init
│ │ │ │ -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).
│ │ │ │ -brahe_prng_free
│ │ │ │ -void brahe_prng_free(brahe_prng_state_t *prng_state)
│ │ │ │ -Free resources used by PRNG.
│ │ │ │ -brahe_prng_real1
│ │ │ │ -double brahe_prng_real1(brahe_prng_state_t *prng_state)
│ │ │ │ -Get the next number in the range [0,1].
│ │ │ │ -brahe_prng_type_t
│ │ │ │ -brahe_prng_type_t
│ │ │ │ -Defines types of prngs.
│ │ │ │ -Definition prng.h:64
│ │ │ │ -BRAHE_PRNG_ISAAC
│ │ │ │ -@ BRAHE_PRNG_ISAAC
│ │ │ │ -Indirect, Shift, Accumulate, Add, and Count (Jenkins).
│ │ │ │ -Definition prng.h:74
│ │ │ │ -BRAHE_PRNG_MARSENNE_TWISTER
│ │ │ │ -@ BRAHE_PRNG_MARSENNE_TWISTER
│ │ │ │ -Marsenne Twister (Matsumoto & Nishimura).
│ │ │ │ -Definition prng.h:66
│ │ │ │ -BRAHE_PRNG_MWC1038
│ │ │ │ -@ BRAHE_PRNG_MWC1038
│ │ │ │ -MWC1038 (Marsaglia).
│ │ │ │ -Definition prng.h:72
│ │ │ │ -BRAHE_PRNG_CMWC4096
│ │ │ │ -@ BRAHE_PRNG_CMWC4096
│ │ │ │ -CMWC4096 (Marsaglia).
│ │ │ │ -Definition prng.h:70
│ │ │ │ -BRAHE_PRNG_KISS
│ │ │ │ -@ BRAHE_PRNG_KISS
│ │ │ │ -Keep is Simple, Stupid (Marsaglia).
│ │ │ │ -Definition prng.h:68
│ │ │ │ -brahe_prng_next
│ │ │ │ -uint32_t brahe_prng_next(brahe_prng_state_t *prng_state)
│ │ │ │ -Get the next integer.
│ │ │ │ -brahe_prng_real53
│ │ │ │ -double brahe_prng_real53(brahe_prng_state_t *prng_state)
│ │ │ │ -Get the next number in the range [0,1).
│ │ │ │ -brahe_prng_real3
│ │ │ │ -double brahe_prng_real3(brahe_prng_state_t *prng_state)
│ │ │ │ -Get the next number in the range (0,1).
│ │ │ │ -brahe_prng_state_t
│ │ │ │ -Contains state variables for a PRNG.
│ │ │ │ -Definition prng.h:79
│ │ │ │ -brahe_prng_state_t::m_data2
│ │ │ │ -void * m_data2
│ │ │ │ -Definition prng.h:83
│ │ │ │ -brahe_prng_state_t::m_b
│ │ │ │ -size_t m_b
│ │ │ │ -Definition prng.h:86
│ │ │ │ -brahe_prng_state_t::m_data1
│ │ │ │ -void * m_data1
│ │ │ │ -Definition prng.h:82
│ │ │ │ -brahe_prng_state_t::m_i
│ │ │ │ -size_t m_i
│ │ │ │ -Definition prng.h:84
│ │ │ │ -brahe_prng_state_t::m_a
│ │ │ │ -size_t m_a
│ │ │ │ -Definition prng.h:85
│ │ │ │ -brahe_prng_state_t::m_c
│ │ │ │ -size_t m_c
│ │ │ │ -Definition prng.h:87
│ │ │ │ -brahe_prng_state_t::m_type
│ │ │ │ -brahe_prng_type_t m_type
│ │ │ │ -Definition prng.h:80
│ │ │ │ -brahe_prng_state_t::m_seed
│ │ │ │ -uint32_t m_seed
│ │ │ │ -Definition prng.h:81
│ │ │ │ +178typedef struct brahe_statistics_t
│ │ │ │ +179{
│ │ │ │ +181 double min;
│ │ │ │ +183 double max;
│ │ │ │ +185 double mean;
│ │ │ │ +187 double variance;
│ │ │ │ +189 double sigma;
│ │ │ │ +190}
│ │ │ │ +191brahe_statistics;
│ │ │ │ +192
│ │ │ │ +194
│ │ │ │ +200brahe_statistics brahe_get_statistics(double * data, size_t n);
│ │ │ │ +201
│ │ │ │ +203
│ │ │ │ +211double * brahe_moving_average(const double * data, const int n, const int
│ │ │ │ +distance);
│ │ │ │ +212
│ │ │ │ +213//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +214// Digital Signal Processing
│ │ │ │ +215//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +216
│ │ │ │ +218
│ │ │ │ +226double * brahe_simple_fft(const double * data, const int n);
│ │ │ │ +227
│ │ │ │ +229
│ │ │ │ +237double * brahe_simple_fft2(const double * data, const int n);
│ │ │ │ +238
│ │ │ │ +240
│ │ │ │ +243typedef struct
│ │ │ │ +244{
│ │ │ │ +246 double wavelength;
│ │ │ │ +248 double amplitude;
│ │ │ │ +249}
│ │ │ │ +250brahe_wave_factor_t;
│ │ │ │ +251
│ │ │ │ +253
│ │ │ │ +263double * brahe_make_sinusoid(const brahe_wave_factor_t * factors, const
│ │ │ │ +size_t factor_n, const size_t array_n);
│ │ │ │ +264
│ │ │ │ +266
│ │ │ │ +274void brahe_add_noise(double * a, const size_t n, double noise);
│ │ │ │ +275
│ │ │ │ +276//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +277// Trigonometry
│ │ │ │ +278//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +280
│ │ │ │ +285double brahe_asinh(const double x);
│ │ │ │ +286
│ │ │ │ +288
│ │ │ │ +293double brahe_acosh(const double x);
│ │ │ │ +294
│ │ │ │ +296
│ │ │ │ +301double brahe_atanh(const double x);
│ │ │ │ +302
│ │ │ │ +303//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +304// Constants
│ │ │ │ +305//--------------------------------------------------------------------------
│ │ │ │ +---
│ │ │ │ +306
│ │ │ │ +308#define BRAHE_E 2.71828182845904523536028747135
│ │ │ │ +309
│ │ │ │ +311#define BRAHE_LOG2_E 1.44269504088896340735992468100
│ │ │ │ +312
│ │ │ │ +314#define BRAHE_LOG10_E 0.43429448190325182765112891892
│ │ │ │ +315
│ │ │ │ +317#define BRAHE_SQRT_2 1.41421356237309504880168872421
│ │ │ │ +318
│ │ │ │ +320#define BRAHE_SQRT_HALF 0.70710678118654752440084436210
│ │ │ │ +321
│ │ │ │ +323#define BRAHE_SQRT_3 1.73205080756887729352744634151
│ │ │ │ +324
│ │ │ │ +326#define BRAHE_PI 3.14159265358979323846264338328
│ │ │ │ +327
│ │ │ │ +329#define BRAHE_TAU 6.28318530717958647692528676656
│ │ │ │ +330
│ │ │ │ +332#define BRAHE_PI_DIV_2 1.57079632679489661923132169164
│ │ │ │ +333
│ │ │ │ +335#define BRAHE_PI_DIV_3 1.04719755119659774615421446109
│ │ │ │ +336
│ │ │ │ +338#define BRAHE_PI_DIV_4 0.78539816339744830961566084582
│ │ │ │ +339
│ │ │ │ +341#define BRAHE_PI_DIV_6 0.52359877559829887307710723055
│ │ │ │ +342
│ │ │ │ +344#define BRAHE_PI_DIV_9 0.34906585039886591538473815370
│ │ │ │ +345
│ │ │ │ +347#define BRAHE_PI_DIV_12 0.26179938779914943653855361527
│ │ │ │ +348
│ │ │ │ +350#define BRAHE_PI_DIV_18 0.17453292519943295769236907685
│ │ │ │ +351
│ │ │ │ +353#define BRAHE_PI_DIV_36 0.08726646259971647884618453842
│ │ │ │ +354
│ │ │ │ +356#define BRAHE_DEG_PER_RAD 57.2957795130823208767981548141
│ │ │ │ +357
│ │ │ │ +359#define BRAHE_RAD_PER_DEG 0.01745329251994329576923690768
│ │ │ │ +360
│ │ │ │ +362#define BRAHE_SQRT_PI 1.77245385090551602729816748334
│ │ │ │ +363
│ │ │ │ +365#define BRAHE_TWO_DIV_SQRT_PI 1.12837916709551257389615890312
│ │ │ │ +366
│ │ │ │ +368#define BRAHE_ONE_DIV_PI 0.31830988618379067153776752675
│ │ │ │ +369
│ │ │ │ +371#define BRAHE_TWO_DIV_PI 0.63661977236758134307553505349
│ │ │ │ +372
│ │ │ │ +374#define BRAHE_LN_10 2.30258509299404568401799145468
│ │ │ │ +375
│ │ │ │ +377#define BRAHE_LN_2 0.69314718055994530941723212146
│ │ │ │ +378
│ │ │ │ +380#define BRAHE_LOG_2 0.30102999566398119521373889472
│ │ │ │ +381
│ │ │ │ +383#define BRAHE_LN_PI 1.14472988584940017414342735135
│ │ │ │ +384
│ │ │ │ +386#define BRAHE_EULER 0.57721566490153286060651209008
│ │ │ │ +387
│ │ │ │ +388#if defined(__cplusplus)
│ │ │ │ +389}
│ │ │ │ +390#endif
│ │ │ │ +391
│ │ │ │ +392#endif
│ │ │ │ +brahe_log2base
│ │ │ │ +double brahe_log2base(const double x, const double base)
│ │ │ │ +Logarithm to a specified base.
│ │ │ │ +brahe_round_nearest
│ │ │ │ +double brahe_round_nearest(const double x)
│ │ │ │ +Round to nearest value.
│ │ │ │ +brahe_pretty_format_t
│ │ │ │ +brahe_pretty_format_t
│ │ │ │ +Formats for pretty-printing integers.
│ │ │ │ +Definition mathtools.h:156
│ │ │ │ +BRAHE_PRETTY_COMMA
│ │ │ │ +@ BRAHE_PRETTY_COMMA
│ │ │ │ +comma delimited, (1,234,567,890)
│ │ │ │ +Definition mathtools.h:160
│ │ │ │ +BRAHE_PRETTY_TEXT
│ │ │ │ +@ BRAHE_PRETTY_TEXT
│ │ │ │ +english text (nine thousand, two hundred eleven)
│ │ │ │ +Definition mathtools.h:158
│ │ │ │ +brahe_pretty_int
│ │ │ │ +char * brahe_pretty_int(int64_t n, brahe_pretty_format fmt)
│ │ │ │ +Turn a 64-bit integer into a pretty string.
│ │ │ │ +brahe_moving_average
│ │ │ │ +double * brahe_moving_average(const double *data, const int n, const int
│ │ │ │ +distance)
│ │ │ │ +Moving average.
│ │ │ │ +brahe_sizepow2
│ │ │ │ +int brahe_sizepow2(const int n)
│ │ │ │ +Smallest power of 2 that includes a given value.
│ │ │ │ +brahe_lcm
│ │ │ │ +uint64_t brahe_lcm(const uint64_t x, const uint64_t y)
│ │ │ │ +Lowest common multiple.
│ │ │ │ +brahe_simple_fft2
│ │ │ │ +double * brahe_simple_fft2(const double *data, const int n)
│ │ │ │ +Simple real-to-real fft (power of 2 length).
│ │ │ │ +brahe_sigdig
│ │ │ │ +double brahe_sigdig(const double x, const uint16_t n)
│ │ │ │ +Set number of significant digits in a floating-point value.
│ │ │ │ +brahe_asinh
│ │ │ │ +double brahe_asinh(const double x)
│ │ │ │ +Hyperbolic arcsine.
│ │ │ │ +brahe_acosh
│ │ │ │ +double brahe_acosh(const double x)
│ │ │ │ +Hyperbolic arccosine.
│ │ │ │ +brahe_statistics
│ │ │ │ +struct brahe_statistics_t brahe_statistics
│ │ │ │ +Structure containing statistical values calculate from a double array.
│ │ │ │ +brahe_atanh
│ │ │ │ +double brahe_atanh(const double x)
│ │ │ │ +Hyperbolic arctangent.
│ │ │ │ +brahe_simple_fft
│ │ │ │ +double * brahe_simple_fft(const double *data, const int n)
│ │ │ │ +Simple real-to-real fft (arbitrary length).
│ │ │ │ +brahe_get_statistics
│ │ │ │ +brahe_statistics brahe_get_statistics(double *data, size_t n)
│ │ │ │ +statistics for array of double
│ │ │ │ +brahe_pretty_format
│ │ │ │ +enum brahe_pretty_format_t brahe_pretty_format
│ │ │ │ +Formats for pretty-printing integers.
│ │ │ │ +brahe_make_sinusoid
│ │ │ │ +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.
│ │ │ │ +brahe_gcf
│ │ │ │ +uint64_t brahe_gcf(uint64_t x, uint64_t y)
│ │ │ │ +Greatest common factor (denominator).
│ │ │ │ +brahe_add_noise
│ │ │ │ +void brahe_add_noise(double *a, const size_t n, double noise)
│ │ │ │ +Apply noise to a signal.
│ │ │ │ +brahe_statistics_t
│ │ │ │ +Structure containing statistical values calculate from a double array.
│ │ │ │ +Definition mathtools.h:179
│ │ │ │ +brahe_statistics_t::min
│ │ │ │ +double min
│ │ │ │ +minimum value from array
│ │ │ │ +Definition mathtools.h:181
│ │ │ │ +brahe_statistics_t::mean
│ │ │ │ +double mean
│ │ │ │ +mean (average)
│ │ │ │ +Definition mathtools.h:185
│ │ │ │ +brahe_statistics_t::variance
│ │ │ │ +double variance
│ │ │ │ +variance
│ │ │ │ +Definition mathtools.h:187
│ │ │ │ +brahe_statistics_t::max
│ │ │ │ +double max
│ │ │ │ +maximum value
│ │ │ │ +Definition mathtools.h:183
│ │ │ │ +brahe_statistics_t::sigma
│ │ │ │ +double sigma
│ │ │ │ +standard deviation
│ │ │ │ +Definition mathtools.h:189
│ │ │ │ +brahe_wave_factor_t
│ │ │ │ +Sine wave definition.
│ │ │ │ +Definition mathtools.h:244
│ │ │ │ +brahe_wave_factor_t::amplitude
│ │ │ │ +double amplitude
│ │ │ │ +arbitrary wave amplitude
│ │ │ │ +Definition mathtools.h:248
│ │ │ │ +brahe_wave_factor_t::wavelength
│ │ │ │ +double wavelength
│ │ │ │ +wavelength
│ │ │ │ +Definition mathtools.h:246
│ │ │ │ ===============================================================================
│ │ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ ├── ./usr/share/doc/libbrahe-dev/html/a00011.html
│ │ │ @@ -26,15 +26,15 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Structure containing statistical values calculate from a double array.
│ │ │
│ │ │
│ │ │ -
#include <mathtools.h>
│ │ │ +
#include <mathtools.h>
│ │ │
│ │ │ |
│ │ │ | double | min |
│ │ │ | | minimum value from array
|
│ │ │ | double | max |
│ │ │ | | maximum value
|
│ │ │ @@ -113,15 +113,15 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
The documentation for this struct was generated from the following file:
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/a00015.html
│ │ │ @@ -26,15 +26,15 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Sine wave definition.
│ │ │ More...
│ │ │
│ │ │ -
#include <mathtools.h>
│ │ │ +
#include <mathtools.h>
│ │ │
│ │ │ |
│ │ │ | double | wavelength |
│ │ │ | | wavelength
|
│ │ │ | double | amplitude |
│ │ │ | | arbitrary wave amplitude
|
│ │ │ @@ -67,15 +67,15 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
The documentation for this struct was generated from the following file:
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/a00019.html
│ │ │ @@ -26,19 +26,19 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Contains state variables for a PRNG.
│ │ │
│ │ │
│ │ │ -
#include <prng.h>
│ │ │ +
#include <prng.h>
│ │ │
│ │ │ |
│ │ │ -| brahe_prng_type_t | m_type |
│ │ │ +| brahe_prng_type_t | m_type |
│ │ │ | uint32_t | m_seed |
│ │ │ | void * | m_data1 |
│ │ │ | void * | m_data2 |
│ │ │ | size_t | m_i |
│ │ │ | size_t | m_a |
│ │ │ | size_t | m_b |
│ │ │ | size_t | m_c |
│ │ │ @@ -145,23 +145,23 @@
│ │ │
│ │ │ ◆ m_type
│ │ │
│ │ │
│ │ │
The documentation for this struct was generated from the following file:
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html
│ │ │ @@ -27,16 +27,16 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/doxygen_crawl.html
│ │ │ @@ -5,80 +5,80 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │
│ │ │
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/files.html
│ │ │ @@ -23,16 +23,16 @@
│ │ │
│ │ │
│ │ │
Here is a list of all files with brief descriptions:
│ │ │
[detail level 12]
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ ├── ./usr/share/doc/libbrahe-dev/html/globals.html
│ │ │ @@ -20,78 +20,78 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
│ │ │
│ │ │
- b -
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/globals_defs.html
│ │ │ @@ -18,41 +18,41 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Here is a list of all macros with links to the files they belong to:
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/globals_enum.html
│ │ │ @@ -18,16 +18,16 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Here is a list of all enums with links to the files they belong to:
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/globals_eval.html
│ │ │ @@ -18,21 +18,21 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Here is a list of all enum values with links to the files they belong to:
│ │ │ -- BRAHE_PRETTY_COMMA : mathtools.h
│ │ │ -- BRAHE_PRETTY_TEXT : mathtools.h
│ │ │ -- BRAHE_PRNG_CMWC4096 : prng.h
│ │ │ -- BRAHE_PRNG_ISAAC : prng.h
│ │ │ -- BRAHE_PRNG_KISS : prng.h
│ │ │ -- BRAHE_PRNG_MARSENNE_TWISTER : prng.h
│ │ │ -- BRAHE_PRNG_MWC1038 : prng.h
│ │ │ +- BRAHE_PRETTY_COMMA : mathtools.h
│ │ │ +- BRAHE_PRETTY_TEXT : mathtools.h
│ │ │ +- BRAHE_PRNG_CMWC4096 : prng.h
│ │ │ +- BRAHE_PRNG_ISAAC : prng.h
│ │ │ +- BRAHE_PRNG_KISS : prng.h
│ │ │ +- BRAHE_PRNG_MARSENNE_TWISTER : prng.h
│ │ │ +- BRAHE_PRNG_MWC1038 : prng.h
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/globals_func.html
│ │ │ @@ -18,39 +18,39 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Here is a list of all functions with links to the files they belong to:
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/globals_type.html
│ │ │ @@ -18,16 +18,16 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Here is a list of all typedefs with links to the files they belong to:
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │
│ │ ├── ./usr/share/doc/libbrahe-dev/html/globals_vars.html
│ │ │ @@ -18,15 +18,15 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Here is a list of all variables with links to the files they belong to:
│ │ │ -- BRAHE_UNKNOWN_SEED : prng.h
│ │ │ +- BRAHE_UNKNOWN_SEED : prng.h
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ © 2011 Scott Robert Ladd. All rights reserved.
│ │ │ HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.
│ │ │