According to the documentation of the Eigen library, it is sufficient to set the appropriate compiler flag to enable the generation of vectorized code. Let us look at CMakeLists.txt:
- We declare a C++11 project:
cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(recipe-06 LANGUAGES CXX)set(CMAKE_CXX_STANDARD 11)set(CMAKE_CXX_EXTENSIONS OFF)set(CMAKE_CXX_STANDARD_REQUIRED ON)
- Since we wish to use the Eigen library, we need to find its header files on the system:
find_package(Eigen3 3.3 REQUIRED CONFIG)
- We include the CheckCXXCompilerFlag.cmake standard module file:
include(CheckCXXCompilerFlag)
- We check that the -march=native compiler flag works:
check_cxx_compiler_flag("-march=native" _march_native_works)
- The alternative ...