This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Rcpp) | |
# set the compiler flags in ~/Documents/.R/Makevars or ~/Documents/.R/Makevars | |
# by adding the following line to it | |
# CXXFLAGS=-O3 -Wall -mtune=native -funroll-loops -mavx -mfma | |
sourceCpp("avx_test.cc") | |
curve(approximate_sigmoid(x) - 1/(1 + exp(-x)), -12, 12, n = 1000); grid() | |
# the exp4096 mostly underestimates the exp | |
curve(log(exp4096(x)) - x, -9, 9, n = 1000); grid() |