gaussMult method
This is an in-place pointwise multiplication of an array
with an
Gaussian function ("gm=Gaussian multiply"):
fidi
= fidi
* exp(ri + si*i)), i=0,..,fid.length-1.
The Gaussian is computed recursively:
- gm(0) = 1, q(0) = exp(r+s)
- q(i+1) = exp(2*s)*q(i)
- gm(i+1) = q(i)*gm(i)
If
isComplex
is true,array
is considered as a sequence of complex points,re,im,re,im, ...
where re (real) and im (imaginary) are on the same scale.
r
and s
define the Gaussian shape and are application dependent, for example:
r = -(PILB)(AQ/size1),
s = (PILB/(2GBAQ))(AQ/(td-1))*(AQ/(td-1)), td = size-1
where
LB is the "line broading", given in Hertz,for time signals which
would yield this line broadening after Fourier transform. GB determines
at which position the maximum of the Gaussian shape occurs.
Exammples: LB = -1.0, GB= 0.2. LB is often chosen negative so as to
enhance signal resolution after Fourier transform.
AQ would be the length of the time signal in seconds, and
td the "time domain size", i.e. array
.length.
Implementation
static void gaussMult(Float64List array, double r, double s, bool isComplex) {
int i = 0;
double gmi = 1.0;
double qi = math.exp(r + s);
double fact = math.exp(2 * s);
if (isComplex) {
i *= 2;
while (true) {
array[i] = gmi * array[i];
array[i + 1] = gmi * array[i + 1];
if (i + 2 >= array.length) break;
if (i + 3 >= array.length) break;
qi = fact * qi;
gmi = qi * gmi;
i += 2;
}
} else {
// TODO
while (true) {
array[i] = gmi * array[i];
if (i + 1 >= array.length) break;
qi = fact * qi;
gmi = qi * gmi;
i += 1;
}
}
}