Skip to content

Instantly share code, notes, and snippets.

View RAMitchell's full-sized avatar

Rory Mitchell RAMitchell

  • Nvidia
  • Cologne, Germany
View GitHub Profile
@RAMitchell
RAMitchell / avx.R
Last active November 15, 2018 12:02 — forked from khotilov/avx.R
AVX sigmoid test
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()