The rSPDE package depends on the Eigen C++ library.
To install Eigen on Ubuntu, run:
sudo apt install libeigen3-devTo install Eigen on Arch-Linux or Manjaro, run:
sudo pacman -S eigen3To install Eigen on Red Hat, Fedor or CentOS, run:
sudo yum install eigen3-develTo install Eigen on OpenSuse, run:
sudo zypper install eigen3-develWe can install Eigen on MacOS with Homebrew.
To install Homebrew, run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"To install Eigen using Homebrew, run:
brew install eigenThe Makefile has the following base form:
toInclude = ${R_LIBRARY_DIR}/INLA/include/
obj = cgeneric_mvnormdens.o cgeneric_aux_nonstat.o cgeneric_aux_nonstat_fixed.o \
cgeneric_rspde_stat_frac_model.o cgeneric_rspde_nonstat_general.o \
cgeneric_rspde_stat_general.o cgeneric_rspde_stat_parsim_gen.o \
cgeneric_rspde_stat_parsim_fixed.o cgeneric_rspde_stat_int.o \
cgeneric_rspde_nonstat_gen_fixed.o cgeneric_rspde_nonstat_int.o \
cgeneric_aux_nonstat_int.o
all : rSPDE.so
CC = clang
CXX = clang++
EIGEN_MAC = /usr/local/include/eigen3/
EIGEN_LINUX = /usr/include/eigen3/
flags = -O2 -Wall -Wextra -fpic
%.o: %.c
$(CC) $(flags) -Iinclude -I$(toInclude) -c $^ -o $@
%.o: %.cpp
$(CXX) $(flags) -I$(toInclude) -I$(EIGEN_MAC) -I$(EIGEN_LINUX) -c $^ -o $@
rSPDE.so: $(obj)
$(CXX) -shared *.o -o ../inst/shared/rspde_cgeneric_models.so -lblas -llapack
clean :
rm -f *.o
.PHONY: all cleanFor linux, we recommend to use the gcc-12 and
g++-12 compilers. To this end, one must install
gcc and g++, then change the following lines
on the Makefile:
CC = gcc
CXX = g++One should also confirm the location of the Eigen library. The
default location is /usr/include/eigen3/ and is already set
at the Makefile. If you have Eigen installed in a different location,
you will need to update the Makefile by changing the
EIGEN_LINUX variable:
EIGEN_LINUX = /correct_path/To install gcc and g++ on Ubuntu, run
sudo apt install gcc g++To install gcc and g++ on Arch-Linux or
Manjaro, run:
sudo pacman -S gcc g++To install gcc and g++ on Red Hat, Fedor or
CentOS, run:
sudo yum install gcc g++To install gcc and g++ on OpenSuse,
run:
sudo zypper install gcc g++For Mac, especially with intel processors, we found the most stable
compiler to be clang and clang++. Thus, one
must have the following lines on the Makefile:
CC = clang
CXX = clang++
One should also confirm the location of the Eigen library. The
default location is /usr/local/include/eigen3/ and is
already set at the Makefile.
If you installed Eigen using Homebrew, you can check the location of the Eigen installation by using the following command:
brew --prefix eigenYou can, then, update the EIGEN_MAC variable in the
Makefile with the correct path.