Copyright (C) 1982, 1983, 1996, 2008, 2009, 2010, 2011 Adrienne Gaye
Thompson, Sole Author. GNU C-Graph version 2.0. Derived from BSc.
dissertation "Interactive Computer Package Demonstrating: Sampling
Convolution and the FFT", University of Aberdeen, Scotland (1983). For
the code from the dissertation, visit
<http://codeartnow.com/law-project>.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.2 or any later version published by the Free Software
     Foundation; with no Invariant Sections, with no Front-Cover Texts,
     and with no Back-Cover Texts.  A copy of the license is included
     in the section entitled "GNU Free Documentation License".

      _for_  *ALL the VICTIMS of APARTHEID STRUGGLING to be FREE*

                                 _and_

                            _to_ *REGNIER*

      _You're sending me discrete signals from across the room,_

     _I respond on impulse, reflecting on the sampling of events_

   _That were a dichotomy from the day you left your mother's womb;_

 _Multiplied in frequency, integrated in time, a weighted confluence_

_Of sliding, shifting trains of thought, alternative messages under transformation;_

_Counterpoint, duality, involution, contradistinction without confusion;_

_Independence in summation. Silence - this is convoluted conversation._

C-Graph:
********

This is a manual for GNU C-Graph version 2.0, a tool for learning about
convolution.

1 Foreword
**********

From the shadow cast by light to the echo in a cave convolution, like
the ubiquitous Fibonacci series, is a mathematical description of
naturally ocurring physical phenomena in any linear, time-invariant
system capable of responding to an input signal. Today, convolution -
the combination of two signals to produce a third - has wide ranging
applications. Edge detection in computer vision, algorithms for robot
motion, signal and image processing, crystallography, statistics and
probability theory, differential equations, linear algebra, numerical
analysis, and even recent innovations in music production - all utilise
techniques involving convolution.

GNU C-Graph (for Convolution Graph) is a tool for visualizing the
convolution of two signals. The package is a reproduction of the Fortran
77 program in my BSc. Electrical Engineering (Honours) dissertation
"Interactive Computer Program Demonstrating: Sampling Convolution and
the FFT", University of Aberdeen, Scotland, 1983. In this version I have
included pulses, scaling of the signals, and error-handling - features
that were not part of my original Thesis.

Whether student engineer or scientist, aspiring special-effects animator
or roboticist, GNU C-Graph will help you find the adventure in the
mathematics of convolution.

- _Adrienne Gaye Thompson_

2 Overview
**********

2.1 About
=========

GNU C-Graph computes the linear convolution of two signals in the time
domain then compares their circular convolution by demonstrating the
"convolution theorem" - convolution of two signals in the time domain
corresponds to multiplication in the frequency domain. Each signal is
modelled by a register of discrete values simulating samples of a
signal, and the discrete Fourier transform (DFT) computed by means of
the Fast Fourier Transform ("FFT"). See Appendix A, for an
explanation of the convolution theorem.

GNU C-Graph is interactive, prompting the user to enter single character
or numerical values from the keyboard, thereby dispensing with the
learning curve for coding formulae. The user chooses 2 from a menu of 8
signal types, and up to 5 parameters to define the waveforms. The
signals chosen may be periodic, aperiodic, or pulses. C-Graph then plots
3 graphs:

  1. The time domain representation of both signals;

  2. Their Fourier transforms;

  3. A comparison of their linear and circular convolution.

See A C-Graph Session, for a typical C-Graph session.

GNU C-Graph will be useful to students of signal theory in the study of
convolution and spectral analysis. This version (2.0) uses a simple FFT
written by Arthur Wouk and converted to Fortran 90 by Alan Miller
(see Appendix B).

2.2 Required Software
=====================

GNU C-Graph is written in contemporary Fortran. The package runs on
GNU/Linux, was developed with GFortan and G95, and uses Gnuplot 4.2 as
well as Image Magick 6.6.

Experienced users wishing to use other compilers may supply the
necessary command-line options to `configure' during installation. See
the file `INSTALL' for basic installation instructions.

3 Invoking C-Graph
******************

To run GNU C-Graph, open up a terminal in X and type `c-graph'. C-Graph
supports the following options:

`--dedicate'
`-d'
     Print the dedication and exit.

`--help'
`-h'
     Print a summary of the command line options and exit.

`--no-splash'
`-n'
     Invoke GNU C-Graph with no splash screen.

`--version'
`-v'
     Print the version number and licensing information of GNU C-Graph,
     then exit.

4 The Signals
*************

4.1 The Menu
============

C-Graph presents the following menu of signals from which the user
chooses 2:

`SIGNAL'          `CODE'
-------------------------
`Sine'            `A'
`Cosine'          `B'
`Triangle'        `C'
`Square'          `D'
`Sawtooth'        `E'
`Exponential'     `F'
`Ramp'            `G'
`Step'            `H'

Signals `A' to `E' are periodic, while `F', `G', and `H' are aperiodic.
Pulses may also be chosen; these are a half period in duration 1/2f,
where f is the frequency of the corresponding cyclical waveform.

4.2 Parameters
==============

The user enters up to 5 parameters to generate the signals, their FFTs
and their convolution:

  1. The number of samples `N'

  2. The code for the signal `A' to `H'

  3. The wave/pulse parameter `w' or `p'

  4. The frequency `f'

  5. The scaling coefficient `sc'

Both signals are constructed from the same number of samples `N'. If
the user chooses a periodic signal, then he/she is prompted to select
either the cyclical waveform or a derived pulse, i.e., `w' or `p'. For
each periodic signal chosen the user is prompted to enter its frequency
`f' and a scale factor `sc'.

Pulses are monophasic and are defined on half the period of the modulus
of the corresponding periodic waveform.

4.3 Defaults & Error Handling
=============================

If the required parameter is a number and the user has erroneously
entered character data, C-Graph generates an error message and gives the
user another try to enter a number. Otherwise, for input outside the
expected ranges C-Graph assumes default values.

`Number of samples `N''
     `N' must lie in the range [64, 1024]. Values entered outside of
     this range will default to 512. `N' is defined to be a power of 2.
     If the user enters a value that is not a power of 2 C-Graph will
     choose the nearest power of 2.

`Signal code `A' to `H''
     For input outside the range `A' to `H', the default codes are `C'
     for the first signal, and `D' for the second.

`Wave/Pulse parameter `w' or `p''
     The default waveform is a pulse.

`Frequency `f''
     C-Graph assumes a default frequency of 1Hz for values of `f'
     entered outside the range [0.5, N/4].

`Scaling coefficient `sc''
     The scaling coefficient `sc' may be positive or negative. The
     maximum absolute value of `sc' for signals a, b, f, and h is
     `N',while that for signals c,d,e, and g is 1. All signals will be
     scaled to unity for input values of `sc' outside the permitted
     range.

     With the default scaling coefficient of 1, signals a, b, f, and h
     are unit functions; signals d (square) an e (sawtooth) have a
     maximum amplitude of half the period (1/(2f)) while that of c
     (triangle) is one-quarter the period (1/(4f)).

4.4 Frequency Selection
=======================

We can express the period P of a periodic signal as
     P   = N/(number of cycles)
         = T/(N/n)

where T is the duration ofthe signal register in seconds, N is the
number of samples in the register (window length), and n is the number
of samples in 1 period.

The frequency of the signal f is the reciprocal of the period, so
     f   = N/(nT) samples/seconds or Hz

C=Graph assumes that the duration of the signal register is 1 second, so
     f   = N/n) Hz

The sampling rate f_s is given by
     f_s   = N/T Hz

The interval h between successive samples being the reciprocal
     h   = 1/f_s seconds

If the window length and frequency chosen are 512 and 20 Hz
(approximately the lower limit of the human audible range) then the
number of samples n in each period would therefore be

     n   = N/f
         = 512/20
         = 25.6

C-Graph requires that n be a multiple of 4. For each periodic signal,
the frequency entered by the user is accordingly adjusted so that n
approximates to the nearest multiple of 4. So the frequency of the
signal used by C-Graph would become

     f   = N/n
         = 512/26
         = 19.7 Hz

5 A C-Graph Session
*******************

In this session, we run C-Graph twice to compare the convolution of 2
signals of equal length:

  1. When the signals are finite sequences and the remaining interval
     is zero padded to the `N' with at least the same number of zeros
     as samples in each signal;

  2. When both signals extend across the full register of `N' samples.

We use a sawtooth pulse for the first signal, and a rectangular pulse
half the amplitude of the sawtooth for the second signal. We also
demonstrate the use of default values for unexpected input. The keychord
`ALT-<TAB>' is used to toggle the terminal and the Gnuplot window.

In X, type `c-graph'. The splash screen will appear for a few seconds.
Pressing `ESC' will kill the display, but you may invoke C-Graph
without the splash screen with the `--no-splash' option. When the
splash screen disappears, the following text will appear:

     GNU C-Graph version 2.0

     Dedicated to Eliezer Regnier and all victims of apartheid.'

     Copyright (C) 1982, 1983, 1996, 2008, 2009, 2010, 2011 Adrienne
     Gaye Thompson, Sole Author. GNU C-Graph version 2.0. Derived from
     BSc. dissertation "Interactive Computer Package Demonstrating: Sampling
     Convolution and the FFT", University of Aberdeen, Scotland (1983). For
     the code from the dissertation, visit
     <http://codeartnow.com/law-project>.

     GNU C-Graph is free software licensed under the terms of the GNU General
     Public License (the GPL) version 3 or later. You are welcome to
     distribute it under certain conditions.

     GNU C-Graph is distributed WITHOUT ANY WARRANTY
     without even the implied warranty of MERCHANTABILITY
     or FITNESS FOR A PARTICULAR PURPOSE.

     See the GPL section 15 regarding disclaimer of warranty.

     Press <g> then <ENTER> to display the GPL, or just press <ENTER> to
     continue.
     C-Graph:>> RET

     THIS IS GNU C-Graph - a tool for visualizing convolution.

     Compare the linear convolution of two signals with their circular
     convolution.

     Signal             Code
     ======             ====
     Sine               A
     Cosine             B
     Triangle           C
     Square             D
     Sawtooth           E
     Unit-Exponential   F
     Unit-Ramp          G
     Unit-Step          H

     Generate 2 signals from the above menu with up to 5 parameters:

     1. Number of samples `N'
     2. Signal code `A' to `H'
     3. Whether the signal, ifperiodic, is a wave `w' or a pulse `p'
     4. The frequency `f'
     5. The scaling coefficient `sc'

     Choose a value for "N" between 64 and 1024.
     C-Graph:>> 51

     The number of samples "N" is: 512

     Signal             Code
     ======             ====
     Sine               A
     Cosine             B
     Triangle           C
     Square             D
     Sawtooth           E
     Unit-Exponential   F
     Unit-Ramp          G
     Unit-Step          H

     Enter code for first signal
     C-Graph:>> e

     Is the signal periodic or is it a pulse?
     Type "w" for periodic wave, or "p" for pulse
     C-Graph:>> p

     Select the frequency "f" of this signal.
     C-Graph:>> 1.0

     The frequency of this signal is 1.00 Hz.

     Do you wish to scale this signal?
     Enter a value for the scaling coefficient "sc".
     A coefficient of 1 will give the unit function.
     C-Graph:>> 1

     Signal             Code
     ======             ====
     Sine               A
     Cosine             B
     Triangle           C
     Square             D
     Sawtooth           E
     Unit-Exponential   F
     Unit-Ramp          G
     Unit-Step          H

     Enter code for second signal
     C-Graph:>> s

     Is the signal periodic or is it a pulse?
     Type "w" for periodic wave, or "p" for pulse
     C-Graph:>> p

     Select the frequency "f" of this signal.
     C-Graph:>> 1

     The frequency of this signal is 1.00 Hz.

     Do you wish to scale this signal?
     Enter a value for the scaling coefficient "sc".
     A coefficient of 1 will give the unit function.
     C-Graph:>> .5

     You selected a square signal by default.

     Press <Enter> to see the signals in the time domain:>> <RET>

     ALT-<TAB>

     Hit <Enter> to continue:>> <RET>

     View the frequency-domain representation of the signals.
     Press <Enter> to see their FFTs:>> <RET>

     ALT-<TAB>

     Hit <Enter> to continue:>> <RET>

     Press <Enter> to compare linear and circular convolution:>> <RET>

     ALT-<TAB>

     Hit <Enter> to continue:>> <RET>

     Exiting GNU C-Graph ...
     Bye.

     galactica@regnier:~$ `c-graph --no-splash'

     GNU C-Graph version 2.0

     Dedicated to Eliezer Regnier and all victims of apartheid.'

     Copyright (C) 1982, 1983, 1996, 2008, 2009, 2010, 2011 Adrienne
     Gaye Thompson, Sole Author. GNU C-Graph version 2.0. Derived from
     BSc. dissertation "Interactive Computer Package Demonstrating: Sampling
     Convolution and the FFT", University of Aberdeen, Scotland (1983). For
     the code from the dissertation, visit
     <http://codeartnow.com/law-project>.

     GNU C-Graph is free software licensed under the terms of the GNU General
     Public License (the GPL) version 3 or later. You are welcome to
     distribute it under certain conditions.

     GNU C-Graph is distributed WITHOUT ANY WARRANTY
     without even the implied warranty of MERCHANTABILITY
     or FITNESS FOR A PARTICULAR PURPOSE.

     See the GPL section 15 regarding disclaimer of warranty.

     Press <g> then <ENTER> to display the GPL, or just press <ENTER> to
     continue.
     C-Graph:>> RET

     THIS IS GNU C-Graph - a tool for visualizing convolution.

     Compare the linear convolution of two signals with their circular
     convolution.

     Signal             Code
     ======             ====
     Sine               A
     Cosine             B
     Triangle           C
     Square             D
     Sawtooth           E
     Unit-Exponential   F
     Unit-Ramp          G
     Unit-Step          H

     Generate 2 signals from the above menu with up to 5 parameters:

     1. Number of samples `N'
     2. Signal code `A' to `H'
     3. Whether the signal, ifperiodic, is a wave `w' or a pulse `p'
     4. The frequency `f'
     5. The scaling coefficient `sc'

     Choose a value for "N" between 64 and 1024.
     C-Graph:>> 521

     The number of samples "N" is: 512.

     Signal             Code
     ======             ====
     Sine               A
     Cosine             B
     Triangle           C
     Square             D
     Sawtooth           E
     Unit-Exponential   F
     Unit-Ramp          G
     Unit-Step          H

     Enter code for first signal
     C-Graph:>> g

     Do you wish to scale this signal?
     Enter a value for the scaling coefficient "sc".
     A coefficient of 1 will give the unit function.
     C-Graph:>> 1

     Signal             Code
     ======             ====
     Sine               A
     Cosine             B
     Triangle           C
     Square             D
     Sawtooth           E
     Unit-Exponential   F
     Unit-Ramp          G
     Unit-Step          H

     Enter code for second signal
     C-Graph:>> h

     Do you wish to scale this signal?
     Enter a value for the scaling coefficient "sc".
     A coefficient of 1 will give the unit function.
     C-Graph:>> q56

     That was not a number. Try again!
     C-Graph:>> 256

     Press <Enter> to see the signals in the time domain:>> <RET>

     ALT-<TAB>

     Hit <Enter> to continue:>> <RET>

     View the frequency-domain representation of the signals.
     Press <Enter> to see their FFTs:>> <RET>

     ALT-<TAB>

     Hit <Enter> to continue:>> <RET>

     Press <Enter> to compare linear and circular convolution:>> <RET>

     ALT-<TAB>

     Hit <Enter> to continue:>> <RET>

     Exiting GNU C-Graph ...
     Bye.

On exit, the directory `c-graphs' will be created. Directory `c-graphs'
will have 2 subdirectories containing the graphs, Gnuplot command
files, and the data used for plotting generated by the last run. The
subdirectories and files are:

   * c-graphs/graphs: signals.png, transforms.png, convolutions.png

   * c-graphs/coms: signals.cg, transforms.cg, convolutions.cg time.dat
     trans.dat

One can then print the graphs and display them either by using a
graphics editor like Image Magick, or by executing the command files
with Gnuplot.

6 Reporting Bugs
****************

To report bugs or suggest enhancements for GNU C-Graph, please send
electronic mail to <agt@codeartnow.com>.

For bug reports, please include enough information for the maintainers
to reproduce the problem.  Generally speaking, that means:

   * The version numbers of GNU C-Graph (which you can find by running
         `c-graph --version') and any other program(s) or
     manual(s) involved.

   * Hardware and operating system names and versions.

   * The contents of any input files necessary to reproduce the bug.

   * The expected behavior and/or output.

   * A description of the problem and samples of any erroneous output.

   * Options you gave to `configure' other than specifying
     installation directories.

   * Anything else that you think would be helpful.

When in doubt whether something is needed or not, include it.  It's
better to include too much than to leave out something important.

Patches are welcome. Please follow the existing coding style.

Appendix A Sketch of Convolution Theory
***************************************

A.1 Introductory Ideas
======================

GNU C-Graph compares the linear and circular convolution of two
signals. Subroutine `convo' computes the linear convolution directly in
the time domain, while the FFT is exploited to compute circular
convolution through the convolution theorem, which is defined below
(see The Convolution Theorem).

Convolution is an operation by which two functions combine to produce a
third that represents a kind of moving average. This is a naturally
ocurring phenomenon that presents itself whenever there is a linear
system obeying the principles of superposition and shift/time
invariance. Accordingly, the mathematics of convolution has found
application to much of science and engineering in areas ranging from
statistics to computer vision.

The output of any linear shift invariant system may be described as the
convolution of the input with the impulse response of the system. In
computer vision, for example, where the system being considered is a
2-dimensional image, the output of the system may be blurred as a result
of the relative motion of the camera and the object. This blurred image
can be modelled by convolution of the static image with the
2-dimensional impulse response.

The 2-dimensional impulse response is called a "pointspread function"
(PSF). Each pixel in the image produces a copy of the PSF, scaled
according to the strength of the pixel and spatially shifted.
Superposition of these copies form the resultant output signal, the
system being linear and shift invariant.  The output blurred image is
then a convolution that is, in fact, a linear combination of the PSFs.
The design of a filter for image restoration must then rely on inverse
convolution.

A thorough treatment of the mathematics of convolution is beyond the
scope of this manual. See Appendix B, for some references on the
subject, and related engineering theory.

A.2 The Mathematics
===================

Consideration of the 1-dimensional case simplifies the arithmetic. To
prove the convolution theorem, we first derive an expression for the
convolution of 2 signals, then apply the Fourier transform to this
expansion.

A.2.1 Deriving the Convolution Sum
----------------------------------

A discrete-time signal may be modelled as a series of piecewise
rectangular pulses. The summation of all such rectangular pulses
approximates the signal f:

     f(n)   = \sum_m f(m) rect(n - m)

where n - m denotes the rectangle whose base on the n axis is centred
at sample n=m.

In the limit, the series of rectangular pulses approaches a continuous
signal as the pulse width tends to zero and each pulse becomes an
impulse signal. Each impulse signal can then be represented as a scaled
and shifted unit impulse simulating one sample of the discrete signal.

     f(n)   = \sum_m f(m) \delta(n - m)

Applying a system transform M that maps the input signal f to the
output signal g,

     g(n)   = M[f(n)]
     g(n)   = M [f(n) = \sum_m f(m) \delta(n - m)]
            = \sum_m f(m) M[\delta(n - m)]

Since the system transforms a delta function to the system "impulse
response" h

              ___
              \
     g[n] =   /__ f[m] h[n - m]     (1)
                m

The above expression called the "convolution sum", denoted by f(*)h,
defines the output g(n) of the system.

A.2.2 The Convolution Theorem
-----------------------------

GNU C-Graph demonstrates the "convolution theorem". The convolution of 2
signals in the time domain is equal to the inverse Fourier transform of
the product of their transforms in the frequency domain.

Just as a signal can be represented by a linear combination of scaled
and shifted impulses, we can also describe the signal as a linear
combination of sinusoidal basis functions. The Fourier transform
exploits this representation to deconstruct the signal into frequency
components, each corresponding to a basis sinusoid.

Using Euler's identity

     e^j\theta   = cos(\theta) + j \sin(\theta)

The sinusoidal sum representing the discrete time signal may be written
in the form

     f(n)  = 1/N \sum\limits_k=0^N-1 F(k) e^j\omega_kn

where \omega_k = 2k\pi/N, and the F(k) are Fourier transform
coefficients indicating the strength of the kth spectral sample of
frequency \omega_k (how much of the each basis sinusoid is present in
the signal).(1)

Accordingly, the F(k) may be computed from the signal

     F(k)  = \sum\limits_n=0^N-1 f(n) e^-j\omega_kn

This is the Fourier transform description of the signal as a function of
frequency.

From eqn (1), the convolution of an input signal f with the system
impulse response h to give an output g is defined as:

     g(n)   = f(*)h = \sum_m f(m) h(n - m)

Let the Fourier transform of g(n) be denoted by

     \Gamma[g(n)]= g(n) e^-j\omegan, then
     \Gamma[f(*)g]= \sum_n [f(*)g] e^-j\omegan
     \Gamma[f(*)h]= \sum_n \sum_m f(m) h(n - m)] e^-j\omegan
           = \sum_m f(m) \sum_n h(n - m) e^-j\omegan

Changing the variable to p = n - m

     \Gamma[g(n)]= \sum_m f(m) \sum_p h(p) e^-j\omega(m+p)
           = \sum_m f(m)e^-jm\omega \sum_p h(p)e^-j\omegap

Taking the inverse Fourier transform,

     f(*)g   = \Gamma^-1[ \Gamma[f] \Gamma[h]

This is the convolution theorem.

---------- Footnotes ----------

(1) For a periodic signal, these coefficients are the \delta functions
of the Fourier transform.

A.3 Linear and Circular Convolution
===================================

The simulation of actual or linear convolution requires a sequence of
multiplications and additions that are computationally too slow for high
speed operations such as deblurring filters for precision robotic
vision control systems. The "FFT", an algorithm for efficiently
computing the DFT, dramatically overcomes the computational load by
successively decomposing the multiplication of two sequences into
subsequences of half the length thereby reducing the number of
artithmetic operations by roughly N/logN.

The cost of this additional computational power is the treatment of the
convolving signals as periodic with N samples per period. The resulting
convolution is termed _circular convolution_. It can be shown that
circular convolution and linear convolution are equivalent if N \ge L +
P -1 where L, M are the unpadded lengths of the sequences being
convolved.

We illustrate the difference between linear and circular convolution
using abbreviated sequences for the pulses demonstrated in A C-Graph Session

A.3.1 Linear Convolution
------------------------

As noted above (see Introductory Ideas), in linear convolution,
each sample of f contributes a scaled and shifted copy of the h. This
is accomplished by the multiplication of the particular sample m of f
by each sample of h.

This sequential multiplication can be visualized as a physical
reflection of h(m)) about the vertical axis to obtain h(-m) followed by
discrete shifts of 1 sample interval (\delta n = 1) along the time axis
with no overlap of the signals at the beginning and end of the
translation. As the impulse response moves along the time axis, the
point by point multiplication of coincident samples is summed. The sum
at each point in the translation is the value of the convolution sum
g(n) at that point, and the length of the convolution is L + M.

For the sequences

     f(m)   = [1,1,1], and
     h(m)   = [0,1,2]

The series of operations for linear convolution

     f(*)h    = [0 1 3 3 2], are:

     0.                         1 1 1
                            2 1 0
                            ---------
     g(0) = f(m)h(0-m)      0+0+0+0+0 = 0

     1.                         1 1 1
                              2 1 0
                              -------
     g(1) = f(m)h(1-m)        0+1+0+0 = 1

     2.                         1 1 1
                                2 1 0
                                -----
     g(2) = f(m)h(2-m) =        2+1+0 = 3

     3.                         1 1 1
                                  2 1 0
                                -------
     g(3) = f(m)h(3-m) =        0+2+1+0 = 3

     4.                         1 1 1
                                    2 1 0
                                ---------
     g(4) = f(m)h(4-m) =        0+0+2+0+0 = 2

A.3.2 Circular Convolution
--------------------------

We can imagine circular convolution in terms of the relative rotation of
two concentric cylinders whose circumferences are of length N. A copy
of the N samples comprising f is wrapped anticlockwise round one
cylinder, while a copy of h is wrapped clockwise round the other
cylinder, reflecting h . Rotating the second cylinder anticlockwise by
1 sample interval each time, multiplying the coincident samples and
summing will give corresponding values of the convolved signal g.

     f(m)   = [1,1,1], and
     h(m)   = [0,1,2]

The series of operations for circular convolution

     f(*)h   = [0 1 3 3 2], are:

     0.                     1 1 1
                            0 2 1
                            -----
     g(0) = f(m)h(0-m)      0+2+1 = 3

     1.                     1 1 1
                            1 0 2
                            -----
     g(1) = f(m)h(1-m)      1+0+2 = 3

     2.                     1 1 1
                            2 1 0
                            -----
     g(2) = f(m)h(2-m)      2+1+0 = 3

By zero-padding each sequence of length L = 3 to length N so that N\ge
L + L -1 (see Linear and Circular Convolution), we obtain the
sequences

     f(m)   = [1,1,1,0,0]
     h(m)   = [0,1,2,0,0]

Circular convolution then achieves the same as result as linear
convolution:

     f(*)h   = [0 1 3 3 2]

The operations are:

     0.                     1 1 1 0 0
                            0 0 0 2 1
                            ---------
     g(0) = f(m)h(0-m)      0+0+0+2+1 = 0

     1.                     1 1 1 0 0
                            1 0 0 0 2
                            -----
     g(1) = f(m)h(1-m)      1+0+0+0+2 = 1

     2.                     1 1 1 0 0
                            2 1 0 0 0
                            ---------
     g(2) = f(m)h(2-m)      2+1+0+0+0 = 3

     3.                     1 1 1 0 0
                            0 2 1 0 0
                            ---------
     g(3) = f(m)h(3-m)      0+2+1+0+0 = 3

     4.                     1 1 1 0 0
                            0 0 2 1 0
                            ---------
     g(4) = f(m)h(4-m)      0+0+2+1+0 = 2

Appendix B References
*********************

The sources below were consulted in the preparation of GNU C-Graph
and/or the 1983 dissertation [1] from which GNU C-Graph is derived.

  1. Thompson, Adrienne G. "Interactive Computer Package Demonstrating:
     Sampling Convolution and the FFT", BSc. Engineering Honours
     thesis, University of Aberdeen (Scotland), 1983, see
     `http://codeartnow.com/law-project'.

  2. Horn, Berthold, K. P. _Robot Vision_. MIT Press, Cambridge,
     Massachusetts, 1986.

  3. McGillem, Clare D., and Cooper, George R. _Continuous and Discrete
     Signal and System Analysis_. Holt, Rinehart and Winston, Inc.,
     1990.

  4. Oppenheim, Alan V., and Schafer, Ronald W. _Digital Signal
     Processing_. Prentice-Hall, Englewood Cliffs, N.J., 1975.

  5. Smith, Steven W. _The Scientist and Engineer's Guide to Digital
     Signal Processing_ `http://www.dspguide.com'

  6. Stremler, Ferrel G. _Introduction to Communication Systems_.
     Addison-Wesley Publishing Co. Inc, 1977.

  7. Wouk, Arthur. _fft-simple.f90_. Ed. Alan Miller. 2003. Retrieved
     from `http://jblevins.org/mirror/amiller/fft_simple.f90'

  8. Yuen, C. K. and Fraser, D. _Digital Spectral Analysis_.
     CSIRO/Pitman, East Melbourne, Australia, 1979.

  9. Ziemer, Rodger E., Tranter, William H., Fannin, D. Ronald.
     _Signals Systems Continuous and Discrete_. 4th ed. Prentice Hall,
     Upper Saddle River, NJ 07458 1998.

Appendix C GNU Free Documentation License
*****************************************

                     Version 1.3, 3 November 2008

     Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
     `http://fsf.org/'

     Everyone is permitted to copy and distribute verbatim copies
     of this license document, but changing it is not allowed.

  0. PREAMBLE

     The purpose of this License is to make a manual, textbook, or other
     functional and useful document "free" in the sense of freedom: to
     assure everyone the effective freedom to copy and redistribute it,
     with or without modifying it, either commercially or
     noncommercially.  Secondarily, this License preserves for the
     author and publisher a way to get credit for their work, while not
     being considered responsible for modifications made by others.

     This License is a kind of "copyleft", which means that derivative
     works of the document must themselves be free in the same sense.
     It complements the GNU General Public License, which is a copyleft
     license designed for free software.

     We have designed this License in order to use it for manuals for
     free software, because free software needs free documentation: a
     free program should come with manuals providing the same freedoms
     that the software does.  But this License is not limited to
     software manuals; it can be used for any textual work, regardless
     of subject matter or whether it is published as a printed book.
     We recommend this License principally for works whose purpose is
     instruction or reference.

  1. APPLICABILITY AND DEFINITIONS

     This License applies to any manual or other work, in any medium,
     that contains a notice placed by the copyright holder saying it
     can be distributed under the terms of this License.  Such a notice
     grants a world-wide, royalty-free license, unlimited in duration,
     to use that work under the conditions stated herein.  The
     "Document", below, refers to any such manual or work.  Any member
     of the public is a licensee, and is addressed as "you".  You
     accept the license if you copy, modify or distribute the work in a
     way requiring permission under copyright law.

     A "Modified Version" of the Document means any work containing the
     Document or a portion of it, either copied verbatim, or with
     modifications and/or translated into another language.

     A "Secondary Section" is a named appendix or a front-matter section
     of the Document that deals exclusively with the relationship of the
     publishers or authors of the Document to the Document's overall
     subject (or to related matters) and contains nothing that could
     fall directly within that overall subject.  (Thus, if the Document
     is in part a textbook of mathematics, a Secondary Section may not
     explain any mathematics.)  The relationship could be a matter of
     historical connection with the subject or with related matters, or
     of legal, commercial, philosophical, ethical or political position
     regarding them.

     The "Invariant Sections" are certain Secondary Sections whose
     titles are designated, as being those of Invariant Sections, in
     the notice that says that the Document is released under this
     License.  If a section does not fit the above definition of
     Secondary then it is not allowed to be designated as Invariant.
     The Document may contain zero Invariant Sections.  If the Document
     does not identify any Invariant Sections then there are none.

     The "Cover Texts" are certain short passages of text that are
     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
     that says that the Document is released under this License.  A
     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
     be at most 25 words.

     A "Transparent" copy of the Document means a machine-readable copy,
     represented in a format whose specification is available to the
     general public, that is suitable for revising the document
     straightforwardly with generic text editors or (for images
     composed of pixels) generic paint programs or (for drawings) some
     widely available drawing editor, and that is suitable for input to
     text formatters or for automatic translation to a variety of
     formats suitable for input to text formatters.  A copy made in an
     otherwise Transparent file format whose markup, or absence of
     markup, has been arranged to thwart or discourage subsequent
     modification by readers is not Transparent.  An image format is
     not Transparent if used for any substantial amount of text.  A
     copy that is not "Transparent" is called "Opaque".

     Examples of suitable formats for Transparent copies include plain
     ASCII without markup, Texinfo input format, LaTeX input format,
     SGML or XML using a publicly available DTD, and
     standard-conforming simple HTML, PostScript or PDF designed for
     human modification.  Examples of transparent image formats include
     PNG, XCF and JPG.  Opaque formats include proprietary formats that
     can be read and edited only by proprietary word processors, SGML or
     XML for which the DTD and/or processing tools are not generally
     available, and the machine-generated HTML, PostScript or PDF
     produced by some word processors for output purposes only.

     The "Title Page" means, for a printed book, the title page itself,
     plus such following pages as are needed to hold, legibly, the
     material this License requires to appear in the title page.  For
     works in formats which do not have any title page as such, "Title
     Page" means the text near the most prominent appearance of the
     work's title, preceding the beginning of the body of the text.

     The "publisher" means any person or entity that distributes copies
     of the Document to the public.

     A section "Entitled XYZ" means a named subunit of the Document
     whose title either is precisely XYZ or contains XYZ in parentheses
     following text that translates XYZ in another language.  (Here XYZ
     stands for a specific section name mentioned below, such as
     "Acknowledgements", "Dedications", "Endorsements", or "History".)
     To "Preserve the Title" of such a section when you modify the
     Document means that it remains a section "Entitled XYZ" according
     to this definition.

     The Document may include Warranty Disclaimers next to the notice
     which states that this License applies to the Document.  These
     Warranty Disclaimers are considered to be included by reference in
     this License, but only as regards disclaiming warranties: any other
     implication that these Warranty Disclaimers may have is void and
     has no effect on the meaning of this License.

  2. VERBATIM COPYING

     You may copy and distribute the Document in any medium, either
     commercially or noncommercially, provided that this License, the
     copyright notices, and the license notice saying this License
     applies to the Document are reproduced in all copies, and that you
     add no other conditions whatsoever to those of this License.  You
     may not use technical measures to obstruct or control the reading
     or further copying of the copies you make or distribute.  However,
     you may accept compensation in exchange for copies.  If you
     distribute a large enough number of copies you must also follow
     the conditions in section 3.

     You may also lend copies, under the same conditions stated above,
     and you may publicly display copies.

  3. COPYING IN QUANTITY

     If you publish printed copies (or copies in media that commonly
     have printed covers) of the Document, numbering more than 100, and
     the Document's license notice requires Cover Texts, you must
     enclose the copies in covers that carry, clearly and legibly, all
     these Cover Texts: Front-Cover Texts on the front cover, and
     Back-Cover Texts on the back cover.  Both covers must also clearly
     and legibly identify you as the publisher of these copies.  The
     front cover must present the full title with all words of the
     title equally prominent and visible.  You may add other material
     on the covers in addition.  Copying with changes limited to the
     covers, as long as they preserve the title of the Document and
     satisfy these conditions, can be treated as verbatim copying in
     other respects.

     If the required texts for either cover are too voluminous to fit
     legibly, you should put the first ones listed (as many as fit
     reasonably) on the actual cover, and continue the rest onto
     adjacent pages.

     If you publish or distribute Opaque copies of the Document
     numbering more than 100, you must either include a
     machine-readable Transparent copy along with each Opaque copy, or
     state in or with each Opaque copy a computer-network location from
     which the general network-using public has access to download
     using public-standard network protocols a complete Transparent
     copy of the Document, free of added material.  If you use the
     latter option, you must take reasonably prudent steps, when you
     begin distribution of Opaque copies in quantity, to ensure that
     this Transparent copy will remain thus accessible at the stated
     location until at least one year after the last time you
     distribute an Opaque copy (directly or through your agents or
     retailers) of that edition to the public.

     It is requested, but not required, that you contact the authors of
     the Document well before redistributing any large number of
     copies, to give them a chance to provide you with an updated
     version of the Document.

  4. MODIFICATIONS

     You may copy and distribute a Modified Version of the Document
     under the conditions of sections 2 and 3 above, provided that you
     release the Modified Version under precisely this License, with
     the Modified Version filling the role of the Document, thus
     licensing distribution and modification of the Modified Version to
     whoever possesses a copy of it.  In addition, you must do these
     things in the Modified Version:

       A. Use in the Title Page (and on the covers, if any) a title
          distinct from that of the Document, and from those of
          previous versions (which should, if there were any, be listed
          in the History section of the Document).  You may use the
          same title as a previous version if the original publisher of
          that version gives permission.

       B. List on the Title Page, as authors, one or more persons or
          entities responsible for authorship of the modifications in
          the Modified Version, together with at least five of the
          principal authors of the Document (all of its principal
          authors, if it has fewer than five), unless they release you
          from this requirement.

       C. State on the Title page the name of the publisher of the
          Modified Version, as the publisher.

       D. Preserve all the copyright notices of the Document.

       E. Add an appropriate copyright notice for your modifications
          adjacent to the other copyright notices.

       F. Include, immediately after the copyright notices, a license
          notice giving the public permission to use the Modified
          Version under the terms of this License, in the form shown in
          the Addendum below.

       G. Preserve in that license notice the full lists of Invariant
          Sections and required Cover Texts given in the Document's
          license notice.

       H. Include an unaltered copy of this License.

       I. Preserve the section Entitled "History", Preserve its Title,
          and add to it an item stating at least the title, year, new
          authors, and publisher of the Modified Version as given on
          the Title Page.  If there is no section Entitled "History" in
          the Document, create one stating the title, year, authors,
          and publisher of the Document as given on its Title Page,
          then add an item describing the Modified Version as stated in
          the previous sentence.

       J. Preserve the network location, if any, given in the Document
          for public access to a Transparent copy of the Document, and
          likewise the network locations given in the Document for
          previous versions it was based on.  These may be placed in
          the "History" section.  You may omit a network location for a
          work that was published at least four years before the
          Document itself, or if the original publisher of the version
          it refers to gives permission.

       K. For any section Entitled "Acknowledgements" or "Dedications",
          Preserve the Title of the section, and preserve in the
          section all the substance and tone of each of the contributor
          acknowledgements and/or dedications given therein.

       L. Preserve all the Invariant Sections of the Document,
          unaltered in their text and in their titles.  Section numbers
          or the equivalent are not considered part of the section
          titles.

       M. Delete any section Entitled "Endorsements".  Such a section
          may not be included in the Modified Version.

       N. Do not retitle any existing section to be Entitled
          "Endorsements" or to conflict in title with any Invariant
          Section.

       O. Preserve any Warranty Disclaimers.

     If the Modified Version includes new front-matter sections or
     appendices that qualify as Secondary Sections and contain no
     material copied from the Document, you may at your option
     designate some or all of these sections as invariant.  To do this,
     add their titles to the list of Invariant Sections in the Modified
     Version's license notice.  These titles must be distinct from any
     other section titles.

     You may add a section Entitled "Endorsements", provided it contains
     nothing but endorsements of your Modified Version by various
     parties--for example, statements of peer review or that the text
     has been approved by an organization as the authoritative
     definition of a standard.

     You may add a passage of up to five words as a Front-Cover Text,
     and a passage of up to 25 words as a Back-Cover Text, to the end
     of the list of Cover Texts in the Modified Version.  Only one
     passage of Front-Cover Text and one of Back-Cover Text may be
     added by (or through arrangements made by) any one entity.  If the
     Document already includes a cover text for the same cover,
     previously added by you or by arrangement made by the same entity
     you are acting on behalf of, you may not add another; but you may
     replace the old one, on explicit permission from the previous
     publisher that added the old one.

     The author(s) and publisher(s) of the Document do not by this
     License give permission to use their names for publicity for or to
     assert or imply endorsement of any Modified Version.

  5. COMBINING DOCUMENTS

     You may combine the Document with other documents released under
     this License, under the terms defined in section 4 above for
     modified versions, provided that you include in the combination
     all of the Invariant Sections of all of the original documents,
     unmodified, and list them all as Invariant Sections of your
     combined work in its license notice, and that you preserve all
     their Warranty Disclaimers.

     The combined work need only contain one copy of this License, and
     multiple identical Invariant Sections may be replaced with a single
     copy.  If there are multiple Invariant Sections with the same name
     but different contents, make the title of each such section unique
     by adding at the end of it, in parentheses, the name of the
     original author or publisher of that section if known, or else a
     unique number.  Make the same adjustment to the section titles in
     the list of Invariant Sections in the license notice of the
     combined work.

     In the combination, you must combine any sections Entitled
     "History" in the various original documents, forming one section
     Entitled "History"; likewise combine any sections Entitled
     "Acknowledgements", and any sections Entitled "Dedications".  You
     must delete all sections Entitled "Endorsements."

  6. COLLECTIONS OF DOCUMENTS

     You may make a collection consisting of the Document and other
     documents released under this License, and replace the individual
     copies of this License in the various documents with a single copy
     that is included in the collection, provided that you follow the
     rules of this License for verbatim copying of each of the
     documents in all other respects.

     You may extract a single document from such a collection, and
     distribute it individually under this License, provided you insert
     a copy of this License into the extracted document, and follow
     this License in all other respects regarding verbatim copying of
     that document.

  7. AGGREGATION WITH INDEPENDENT WORKS

     A compilation of the Document or its derivatives with other
     separate and independent documents or works, in or on a volume of
     a storage or distribution medium, is called an "aggregate" if the
     copyright resulting from the compilation is not used to limit the
     legal rights of the compilation's users beyond what the individual
     works permit.  When the Document is included in an aggregate, this
     License does not apply to the other works in the aggregate which
     are not themselves derivative works of the Document.

     If the Cover Text requirement of section 3 is applicable to these
     copies of the Document, then if the Document is less than one half
     of the entire aggregate, the Document's Cover Texts may be placed
     on covers that bracket the Document within the aggregate, or the
     electronic equivalent of covers if the Document is in electronic
     form.  Otherwise they must appear on printed covers that bracket
     the whole aggregate.

  8. TRANSLATION

     Translation is considered a kind of modification, so you may
     distribute translations of the Document under the terms of section
     4.  Replacing Invariant Sections with translations requires special
     permission from their copyright holders, but you may include
     translations of some or all Invariant Sections in addition to the
     original versions of these Invariant Sections.  You may include a
     translation of this License, and all the license notices in the
     Document, and any Warranty Disclaimers, provided that you also
     include the original English version of this License and the
     original versions of those notices and disclaimers.  In case of a
     disagreement between the translation and the original version of
     this License or a notice or disclaimer, the original version will
     prevail.

     If a section in the Document is Entitled "Acknowledgements",
     "Dedications", or "History", the requirement (section 4) to
     Preserve its Title (section 1) will typically require changing the
     actual title.

  9. TERMINATION

     You may not copy, modify, sublicense, or distribute the Document
     except as expressly provided under this License.  Any attempt
     otherwise to copy, modify, sublicense, or distribute it is void,
     and will automatically terminate your rights under this License.

     However, if you cease all violation of this License, then your
     license from a particular copyright holder is reinstated (a)
     provisionally, unless and until the copyright holder explicitly
     and finally terminates your license, and (b) permanently, if the
     copyright holder fails to notify you of the violation by some
     reasonable means prior to 60 days after the cessation.

     Moreover, your license from a particular copyright holder is
     reinstated permanently if the copyright holder notifies you of the
     violation by some reasonable means, this is the first time you have
     received notice of violation of this License (for any work) from
     that copyright holder, and you cure the violation prior to 30 days
     after your receipt of the notice.

     Termination of your rights under this section does not terminate
     the licenses of parties who have received copies or rights from
     you under this License.  If your rights have been terminated and
     not permanently reinstated, receipt of a copy of some or all of
     the same material does not give you any rights to use it.

 10. FUTURE REVISIONS OF THIS LICENSE

     The Free Software Foundation may publish new, revised versions of
     the GNU Free Documentation License from time to time.  Such new
     versions will be similar in spirit to the present version, but may
     differ in detail to address new problems or concerns.  See
     `http://www.gnu.org/copyleft/'.

     Each version of the License is given a distinguishing version
     number.  If the Document specifies that a particular numbered
     version of this License "or any later version" applies to it, you
     have the option of following the terms and conditions either of
     that specified version or of any later version that has been
     published (not as a draft) by the Free Software Foundation.  If
     the Document does not specify a version number of this License,
     you may choose any version ever published (not as a draft) by the
     Free Software Foundation.  If the Document specifies that a proxy
     can decide which future versions of this License can be used, that
     proxy's public statement of acceptance of a version permanently
     authorizes you to choose that version for the Document.

 11. RELICENSING

     "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
     World Wide Web server that publishes copyrightable works and also
     provides prominent facilities for anybody to edit those works.  A
     public wiki that anybody can edit is an example of such a server.
     A "Massive Multiauthor Collaboration" (or "MMC") contained in the
     site means any set of copyrightable works thus published on the MMC
     site.

     "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
     license published by Creative Commons Corporation, a not-for-profit
     corporation with a principal place of business in San Francisco,
     California, as well as future copyleft versions of that license
     published by that same organization.

     "Incorporate" means to publish or republish a Document, in whole or
     in part, as part of another Document.

     An MMC is "eligible for relicensing" if it is licensed under this
     License, and if all works that were first published under this
     License somewhere other than this MMC, and subsequently
     incorporated in whole or in part into the MMC, (1) had no cover
     texts or invariant sections, and (2) were thus incorporated prior
     to November 1, 2008.

     The operator of an MMC Site may republish an MMC contained in the
     site under CC-BY-SA on the same site at any time before August 1,
     2009, provided the MMC is eligible for relicensing.

ADDENDUM: How to use this License for your documents
====================================================

To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and license
notices just after the title page:

       Copyright (C)  YEAR  YOUR NAME.
       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU Free Documentation License, Version 1.3
       or any later version published by the Free Software Foundation;
       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
       Texts.  A copy of the license is included in the section entitled ``GNU
       Free Documentation License''.

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:

         with the Invariant Sections being LIST THEIR TITLES, with
         the Front-Cover Texts being LIST, and with the Back-Cover Texts
         being LIST.

If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.

If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License, to
permit their use in free software.