Back to library index.

Package convol (in convol.i) -

Index of documented functions or symbols:

boxcar

convol

convoln

fft_good

gaussm

### boxcar

```DOCUMENT boxcar(a, n)

returns array A smoothed by a boxcar of 2*N+1 pixels.
If A is multi-dimensional, N may be a vector with as many
components as A has dimensions, specifying how many pixels
to smooth in that dimension.  N may be shorter than the number
of dimensions of A; unspecified dimensions are unsmoothed
(as if N were 0).  If A is multi-dimensional and N is scalar,
that N is applied to all dimensions.

Each pixel of the result is averaged with the N pixels to
its left and N pixels to its right (so N=0 means no averaging).
For pixels less than N from the left edge, the averaging includes
fewer pixels on the left, but still N on the right, and similarly
for pixels less than N from the right edge.  Hence, the effective
smoothing is reduced and the centering is skewed, near the edges
of the array.
```

### convol

```DOCUMENT convol(a,b)

returns convolution of vector a with vector b, a vector
of length na+nb-1 where na=numberof(a), nb=numberof(b).

In detail, for i=[1 to na+nb-1]
result(i) = sum j=[max(1,1+i-nb) to min(na,i)] (a(j)*b(1+i-j))

The n0= and n1= keywords can be used to control the section of
the full array that is actually returned, 1<=n0
```

### convoln

```DOCUMENT convoln(a, b)

returns convolution of array A with array B.  This is naturally
of length na+nb-1 where na=length of A, nb=length of B.  However,
convoln returns a result the same size as A, which is extracted
from the center of this full array.  Typically, B will be a much
smaller array than A, which you are using to smooth A.  If the
dimensions of B are odd, then the elements of the returned array
will be centered as you would expect.

In detail, for i=[1 to na+nb-1]
result(i) = sum j=[max(1,1+i-nb) to min(na,i)] (A(j)*B(1+i-j))
with this operation repeated along each dimension of A and B.

The n0= and n1= keywords can be used to control the section of
the full array that is actually returned, 1<=n0
```

### fft_good

```DOCUMENT fft_good(n)

returns the smallest number of the form 2^x*3^y*5^z greater
than or equal to n.  An fft of this length will be much faster
than a number with larger prime factors; the speed difference
can be an order of magnitude or more.

For n>100, the worst cases result in a little over a 11% increase
in n; for n>1000, the worst are a bit over 6%; still larger n are
better yet.  The median increase for n<=10000 is about 1.5%.
```

### gaussm

```DOCUMENT gaussm(a, n)

returns array A smoothed by a Gaussian with a sigma of N pixels.
If A is multi-dimensional, N may be a vector with as many
components as A has dimensions, specifying how many pixels
to smooth in that dimension.  N may be shorter than the number
of dimensions of A; unspecified dimensions are unsmoothed
(as if N were 0.0).  If A is multi-dimensional and N is scalar,
that N is applied to all dimensions.

With the fwhm=1 keyword, N is the full width at half maximum
of the Guassian.  The fwhm= keyword may also be a vector of
the same length as N, 1 where N is to be interpreted as a FWHM
and 0 where N is to be interpreted as a sigma.
```