39 # define PI2 6.28318530717958623
40 # define CE_TYPE float
47 CExp3() { Size = 0; ITable=RTable=NULL; };
48 CExp3(
int n) { Size = n; build(Size); };
54 ITable = (T*)malloc(
sizeof(T)*Size);
55 RTable = (T*)malloc(
sizeof(T)*Size);
57 for (
int i=0; i<Size; i++) {
58 ITable[i] =
sin(i*Step);
59 RTable[i] =
cos(i*Step);
62 inline int f(
register T
arg)
64 return (
int)((arg<0)?((arg+1-(
int)arg)*Size):((arg-(
int)arg)*Size));
76 int N=hashFunction(arg);
77 return std::complex<T>(RTable[
N],ITable[
N]);
80 inline T
imag(T
arg) {
return ITable[hashFunction(arg)]; }
81 inline T
real(T
arg) {
return RTable[hashFunction(arg)]; }
83 {
int N = hashFunction(arg);
84 re = RTable[
N]; im = ITable[
N];
LatticeExprNode arg(const LatticeExprNode &expr)
LatticeExprNode cos(const LatticeExprNode &expr)
void reim(T &arg, T &re, T &im)
T * RTable
vector<T> RTable, ITable;
std::complex< T > operator()(T &arg)
LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.