previous up next print clean
Next: About this document ... Up: REFERENCES Previous: REFERENCES

The dot product test

To test whether a program pair behaves as a linear operator should, we do a dot-product test. The current working version of PVI says:

The dot-product test is a simple test for verifying that the two procedures are conjugate to each other.

The associative property of linear algebra says that we do not need parentheses in a vector-matrix-vector product like $\bold y^{\dagger} \bold A \bold x $ because we get the same result no matter where we put the parentheses. They serve only to determine the sequence of computation. Thus,
   \begin{eqnarray}
\bold y^{\dagger} ( \bold A \bold x ) &=& ( \bold y^{\dagger} \...
 ...ld A \bold x ) &=& ( \bold A^{\dagger} \bold y )^{\dagger} \bold x\end{eqnarray} (2)
(3)
(In general, the matrix is not square.) For the dot-product test, load the vectors $\bold x$ and $\bold y$ with random numbers. Compute the vector $\tilde \bold y = \bold A\bold x$using your program for $\bold A$,and compute $\tilde \bold x = \bold A^{\dagger}\bold y$using your program for $\bold A^{\dagger}$.Inserting these into equation ([*]) should give you two equal scalars

\begin{displaymath}
\bold y^{\dagger} ( \bold A \bold x ) \quad = \quad
\bold y^...
 ... x
\quad = \quad( \bold A^{\dagger} \bold y )^{\dagger} \bold x\end{displaymath} (4)
The left and right sides of this equation will be computationally equal only if the program doing $\bold A^{\dagger}$ is indeed conjugate to the program doing $\bold A$.

Using the C++ classes we can write a single dot product test routine that all new operators can be tested with. We need only supply the operator and sample data and model spaces as arguments. The test routine will generate spaces of random numbers and check that the dot product test condition is satisfied. Here is the code for the version of the routine for floatop operators. Equivalent routines are available for complex operators and array operators.

 


previous up next print clean
Next: About this document ... Up: REFERENCES Previous: REFERENCES
Stanford Exploration Project
11/17/1997