# libSQUIC
This section provides instructions for compiling and installing the `libSQUIC` shared library, along with its R and Python interfaces. The default and recommended location for `libSQUIC` is `~/`.

## Compiling from Source
The library can be compiled from source by first fulfilling the prerequisites and following the instructions listed below. The following packages are required for compiling:
- BLAS,LAPACK and OpenMP
- C/C++/Fortran Compilers and Cmake

Mac users are recommended to use Homebrew to install the GNU Fortran compilers, OpenMP, and Cmake by running `brew install gcc libomp cmake`. The default Mac distribution includes both the C/C++ compilers and the BLAS/LAPACK libraries. Linux users should install the required packages using their respective system's package manager; e.g., on Ubuntu via `sudo apt-get install build-essential libblas-dev liblapack-dev cmake`. Note that these packages are all standard on HPC infrastructures.

_If different types of BLAS or LAPACK are used, the `LDFLAGS` in `Src/lib/makefile` must be adjusted accordingly. To compile `libSQUIC` with the Intel Math Kernal Library (MKL), set the `MKLROOT` environment variable using `source /opt/intel/oneapi/mkl/latest/env/vars.sh intel64` (this command may vary based on your MKL version). Afterward, adjust your compiler and linker flags for your system. For specific flag details, refer to the [Intel MKL Link Line Advisor](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html)._


#### Step 1: Compile libSQUIC
Navigate to the `Src/lib` directory within the source code to compile `CHOLMOD`, its dependencies, and `libSQUIC`.
```bash
cd Src/lib
make
```

#### Step 2: Install libSQUIC
Install `libSQUIC` in the default `~\` directory.
```bash
make install
```

#### Step 3: Install Interfqace Packagee R or Python
Install the R and Python interface packages, and run a simple test for each. By default, the interface packages are installed in a local user directory. For R, this is `~\R`, and for Python, it's the platform-specific user install directory (see, `pip3 help` and `--user` flag for details).

The R interface library dependencies include ``Matrix``,``Rcpp`` and ``RcppArmadillo``, and the Python interface dependencies include the ``pip3`` package manager, ``NumPy`` and ``SciPy``. Note that, with the exception of ``pip3``, which is included with Python version 3, all dependencies for both R and Python are automatically installed as part of the setup process described below.

```bash
make install_r
make install_py
```
_If you wish to perform a global installation of the R and Python packages (which may require sudo access), use, .e.g, the command `make install_r R_PYTHON_INTERFACE_GLOBAL_INSTALL=true`._
