Newer
Older
#ifndef MANTID_KERNEL_FAST_EXPONENTIAL_H_
#define MANTID_KERNEL_FAST_EXPONENTIAL_H_
namespace Mantid {
namespace Kernel {
/** Based on the article: A Fast, Compact Approximation of the Exponential
*Function
* by Nicol N. Schraudolph and on the slighly modified version:
* On a Fast, Compact Approximation of the Exponential Function
* Neural Computation archive
* Volume 12 , Issue 9 (September 2000)
* Pages 2009-2012
* Author: Gavin C. Cawley University of East Anglia, Norwich, Norfolk
*NR4 7TJ, England
* This is actually a bit faster than a LookupTable with linear interpolation,
*however it seems less accurate
inline double fast_exp(double y) {
static union {
double d;
_eco.n.i = (int)(EXP_A * (y)) + (1072693248 - EXP_C);
_eco.n.j = 0;