/* SOWaveFunction.h -- Functions defined in terms of waves */ /* Last edited on 2003-07-03 19:49:38 by ra014852 */ #ifndef SOWaveFunction_H #define SOWaveFunction_H #include #include #include #include /* FUNCTIONS DEFINED IN TERMS OF WAVES */ /* An {SOWaveFunction} object describes a real-valued function {w_k} from {R^m} to {R}. The function is characterized by an integer /frequency vector/ {k[0..m-1]}, and is such that {w_k(x) = sin(PI*x[0]) * ... * sin(PI*x[m-1]) * h_k(x) } where {h_k(x) is a Hartley wave with integer frequency {k} in the unit cube, i.e. { h_k(x) = sin( PI/4 + 2 * PI * SUM { x[i]*k[i] : i=0..m } ) } For any frequency vector {k}, the function {w_k} has value zero on the boundary of the unit cube, and can be expressed as the sum of ordinary sine and cosine waves whose frequency vectors {r} are half-integers with {|r[i]| <= |k[i]| + 1/2}, for all {i}. */ typedef struct SOWaveFunction_Methods /* Methods for SOWaveFunction: */ { SOFunction_Methods fn; /* Methods inherited from superclass, with some overrides. The {copy} method will also copy the frequency vector {f->d->freq}. */ WriteMth *write; /* Writes the function's def to {wr}, as an {SOWaveFunction}. */ } SOWaveFunction_Methods; typedef struct SOWaveFunction_Data /* Data fields for SOWaveFunction: */ { SOFunction_Data fn; /* Data fields inherited from superclass. */ int freq[MAX_PDIM]; /* Frequency vector. */ } SOWaveFunction_Data; typedef struct SOWaveFunction /* Logically a subclass of SOFunction. */ { char *type; /* Type identifier. */ SOWaveFunction_Methods *m; /* Function methods. */ SOWaveFunction_Data *d; /* Function parameters. */ } SOWaveFunction; #define SOWaveFunction_TypeId "SOF.Wave." SOWaveFunction *SOWaveFunction_Cast(OBJ *f); /* If {f} (according to {f->type}) is a subclass of {SOWaveFunction}, returns {f} cast to that type; otherwise returns NULL. */ /* ====================================================================== */ SOWaveFunction *SOWaveFunction_FromFreq(nat pDim, int *freq); /* Returns a wave function with frequency vector {k[0..pDim-1] = freq[0..pDim-1]}. The function will have domain {R^pDim} and range {R} (i.e. {f->d->fDim = 1}). */ SOWaveFunction *SOWaveFunction_Read(FILE *rd, nat pDim); /* Reads a {SOWaveFunction} from {rd}. It must have been created by calling the {write} method of an {SOWaveFunction}. The domain dimension {pDim} must be provided by the caller, and must be that of the original function that was written to the file. */ #endif