Skip to content

C++ library for generating fractional Brownian motion (technically a fractional Brownian bridge)

License

Notifications You must be signed in to change notification settings

alsvinn/fractional_brownian_motion

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Fractional Brownian motion

A header only C++ library for generating fractional Brownian motion in 1D, 2D and 3D (the latter two are technically variants of a fractional Brownian bridge).

We focus on fast implementation, therefore, we can only generate for lengths that are a power of 2.

This library is mainly used from within the Alsvinn simulator.

Also comes with a Python library (requiresboost::python and boost::numpy).

Requirements

  • A C++11 compatible compiler (tested with GCC and Clang)
  • cmake >= 3.10.0 (optional)
  • boost >= 1.67.0 (optional) only for python and tests
  • python (optional) for python bindings
  • doxygen (optional) for documentation

Running from Python

Make sure the folder fbmpy from the build folder is in your PYTHONPATH. Then from Python you can do something like:

import fbmpy
import numpy as np
import matplotlib.pyplot as plt

# Plain old Brownian motion
Hurst_index = 0.5

N = 128
X = np.random.normal(0, 1, N)
d = fbmpy.fractional_brownian_motion_1d(Hurst_index, N, X)
x = np.linspace(0, 1, N+1)
plt.plot(x, d)
plt.show()

About

C++ library for generating fractional Brownian motion (technically a fractional Brownian bridge)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 87.6%
  • Python 8.9%
  • CMake 3.5%