Install Dependencies
Firstly you will need to ensure that you have the Canopy's dependencies installed, this includes:
- C++11: A C++ compiler that supports the C++11 standard or later. This includes recent versions of all the major compilers on all the major platforms. Additionally, you may find Canopy easier to use if you can use features from the more recent C++14 standard (such as generic lambdas).
- OpenMP: A compiler that supports the OpenMP standard for multi-threading. Again this includes the major compilers on major systems. Canopy will compile and run in single-threaded mode without this, but will be much slower.
- Boost: The open-source Boost special functions and iterator libraries. These can be easily installed from package managers on most GNU/Linux distributions as well as MacPorts or Homebrew on MacOS. Typically it is easier to install all the Boost libraries at once. E.g. on Ubuntu
1 sudo apt-get install libboost-all-dev
- Eigen: The open-source Eigen library for linear algebra. Again this can be easily installed from standard package managers. E.g. on Ubuntu:
1 sudo apt-get install libeigen3-dev
If you do not intend to use canopy's circularRegressor
class, you do not need to have Eigen installed.
Get Canopy
Once you have these dependencies installed, you can go ahead and install canopy by cloning the repository on github. E.g.
1 cd /path/where/you/want/canopy
2 git clone https://github.com/CPBridge/canopy.git
And that's it! Since canopy is a header-only library, you don't need to build anything.
Compiling User Code
In order to compile your own code using canopy, you need to make sure you are compiling with c++11 (or later), are using OpenMP, and list canopy's include directory in the include dependencies. E.g. to compile a programme in user_code.cpp
with the g++
compiler:
1 g++ -std=c++11 -fopenmp -I /path/to/canopy/include user_code.cpp