Merge branch 'optexp'
Merge branch 'master' into optexp
small changes on g2e.c
small optimization for gradients
small optimization