Comparison of calculation speed for recurrence plots/ recurrence quantification analysis for MATLAB, R, Python, and Julia
Measuring the calculation time for creating a recurrence plot (RP) and calculation of the standard recurrence quantification measures for the Rössler system with the standard parameters (a = 0.25, b = 0.25, and c = 4) and a sampling time of Δt = 0.05. The RPs were calculated using Euclidean norm and a threshold of ε = 1.2.
Only the x-component of the Rössler system is used, after removing the first 1,000 points as transients. A simple time delay embedding with m = 3 and τ = 6 is applied. The RP and RQA calculations are implemented for MATLAB, R, Julia, and Python using the following packages/ tools
Software | Package/ URL |
---|---|
MATLAB | simple rp.m v1.2 code https://github.com/pucicu/rp |
R | crqa v2.0.2 https://github.com/morenococo/crqa |
Julia | DynamicalSystems.jl v1.4.0 https://juliadynamics.github.io/DynamicalSystems.jl/dev/ |
Python | simple RP and RQA implementation (included) |
Python | pyunicorn v0.6.1 https://pypi.org/project/pyunicorn/ |
Python | PyRQA v8.0.0 https://pypi.org/project/PyRQA/ |
The CRP Toolbox for MATLAB is not used, because the implementation is interwoven with a graphical user interface and, thus, the new rendering engine of MATLAB is strongly interfering and slowering the calculations since its introduction in 2014 (see https://tocsy.pik-potsdam.de/CRPtoolbox/).
Software | Requirements |
---|---|
MATLAB | install the code from https://github.com/pucicu/rp as a subfolder rp |
R | packages nonlinearTseries , crqa , abind , tictoc |
Julia | packages OrdinaryDiffEq , DelayEmbeddings , DynamicalSystems , DelimitedFiles |
Python | packages PyRQA , pyunicorn , numpy , scipy |
The recurrence analysis is performed on the time series obtained from the Rössler system with growing length, starting with N = 200, increasing in steps to provide equidistant points along the x-axis in a log-log plot. The increase of length will be stopped when the calculation time exceeds 30 sec. For each selected length, the calculation time is measured 10 times and then averaged.
Not for all implementations all RQA measures are available (e.g., for simple Python code). The calculation of network measures were disabled in all code.
The results presented here are from calculations performed on a 2.3 GHz Quad-Core Intel Core i7 with 16GB RAM, except the calculations using the PyRQA package, which were performed on a Nvidia GPU Tesla V100 with OpenCL 1.2. For crqa (R) and PyRQA the calculation cannot be separated into RP and RQA calculations, therefore, both appear only in the figure on the total computation time.