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
).
- 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
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()