Warning: There are no guarantees for the robustness of the GeoCalcLib! Please report any malfunction.

The LRS library works on both Mac and Linux and can be made to work on Windows.

In order to work you will need the GMP Library installed on your system. During the build of the GMP library, make sure you install it with the same ABI as your Matlab, i.e. if you have a 64-bit Matlab make sure you select ABI=64 during your build. If you are unsure which Matlab version you have, run

>>ver matlab

and check which Java version is linked, they are installed compatibly. The GeoCalcLib is untested on 32-bit installations.

To install the GeoCalcLib open your Terminal navigate to your desired directory and clone the repository by typing

git clone https://github.com/worc4021/GeoCalcLib.git
cd GeoCalcLib

Create a text file named User.make in which you define the absolute path to your Matlab installation MATLABROOT and the desired installation directory INSTALLDIR (a directory on your Matlab path), e.g.

# Specify the absolute path to your Matlab installation
MATLABROOT = /Applications/MATLAB_R2016a.app

# Path to which everything should be installed, has to be on Matlab path!
INSTALLDIR = /Users/Username/Documents/MATLAB/Functions

If you do not yet have a directory on your Matlab path to store your functions and want to add one, run edit startup in Matlab and add

addpath('/absolute/path/to/your/directory');

or find alternative ways of setting up your path here.

Now you can run

make

to build the interface.

Next you have to load the library in Matlab, for this you need to specify the location of the header file containing the information Matlab needs to call the individual functions, see here for details. You can load the interface on startup, to do this run Matlab and edit the startup.m file:

>> edit startup

If it already exists add the lines

[~,~] = loadlibrary('libgeocalc','PATH/mainFunctions.h');
display('GeoCalc library loaded.');

where you replace PATH with the absolute path to the directory containing the header file mainFunctions.h.

Once the library is loaded you need to unload it before you can exit Matlab! So exit Matlab from the session in which you modified startup.m (it has not been executed, therefore GeoCalcLib has not been loaded).

Run Matlab again and edit finish.m by typing

edit finish

add the line

unloadlibrary('libgeocalc');

If you do not wish to load the GeoCalcLib every time you run Matlab, load the library by calling

[~,~] = loadlibrary('libgeocalc','PATH/mainFunctions.h');

at the beginning of your session and

unloadlibrary('libgeocalc');

at the end of your session.