This supplement contains the C++ source code for the numerical simulations and periodogram analysis of the non-cyclic and cyclic OUSS and population models.

What you need to run this code:
You will need a C++ compiler (e.g. GCC) to compile the code, as well as the ALGLIB library (C++ version). The latter is needed for the L-BFGS optimization algorithm.
Due to copyright reasons, we do not include the ALGLIB library with this supplement. A free version of ALGLIB is adequate and available here: http://www.alglib.net (as of January 15, 2014)

This code was tested using ALGLIB 3.8.2 (C++ version, free edition) and GCC 4.7.4 on Mac OS 10.6.8.

Where to put ALGLIB: 
Replace the empty ALGLIB directory with the downloaded ALGLIB package. Make sure you end up with the following source files:
	DataAnalysis.cpp
	DataAnalysis.h 
	ap.cpp
	ap.h
	alglibinternal.cpp
	alglibinternal.h 
	linalg.cpp
	linalg.h
	statistics.cpp 
	statistics.h 
	alglibmisc.cpp 
	alglibmisc.h 
	specialfunctions.cpp
	specialfunctions.h
	solvers.cpp
	solvers.h 
	optimization.cpp
	optimization.h 
	interpolation.cpp
	interpolation.h
	integration.cpp
	integration.h

all located in ALGLIB/src/

How to compile:
The Makefile contains all necessary commands for compilation using GCC. Use "make" in your terminal/command line to execute it.

How to run:
Run the compiled program (cycles) in your terminal without any additional parameters. Alternatively, use "make run" to compile and run. 

How to choose simulation parameters:
Modify the entries in the source file Config.h located in the source directory. Do not modify any of the other source files. After choosing your parameter values, you need to re-compile cycles before executing it. By default, the cyclic logistic growth model will be examined using Monte Carlo simulations.

Example: A typical use would proceed as follows:
	1. Download ALGLIB and install its source code as described above.
	2. Compile program using "make" in the terminal.
	3. Execute program using "./cycles" in the terminal.
	4. Wait for execution to finish, read results from terminal.
Running this code will create output files in the directory 'output' (relative to the current working directory).

Source code description:
	Config.h						Configuration file. Edit this to choose parameters.
	Auxiliary.cpp					Technical auxiliary functions
	FitOU.cpp, FitOUSS.cpp			Functions describing the OUSS process (used for fitting).
	InternalDefs.h					Definitions and macros, not to be modified.
	GridMultilinearInterpolator.cpp	Multilinear interpolation on a multidimensional grid. Used for FAP correction.
	LogisticGrowthModel.h			Class file for the logistic growth model (non-cyclic and cyclic).
	OrnsteinUhlenbeckModel.h		Class file for the OU model (with non-cyclic and cyclic equilibrium).
	LombScargleSpectrum.h			Contains function for calculating Lomb-Scargle periodogram for a time series.
	main.cpp						Main simulation code. Good starting point if you want to mess around with the code.
	PeakSignificance.cpp			Code for calculating the statistical significance of a periodogram peak.
	Points.h						Auxiliary collection of classes for multidimensional points.
	StochasticRungeKutta.h			Template code for running stochastic Runge-Kutta simulations.
	VectorArithmetics.h				Auxiliary collection of functions for multidimensional arithmetic.

Disclaimer
This code is provided as is. Use at your own risk and discretion. The authors of this code can not be held responsible for any damage or costs resulting from using this code.

Stilianos Louca
October 30, 2014