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 because we get the same result no matter where we put the parentheses. They serve only to determine the sequence of computation. Thus,
(In general, the matrix is not square.) For the dot-product test, load the vectors and with random numbers. Compute the vector using your program for ,and compute using your program for .Inserting these into equation () should give you two equal scalars
The left and right sides of this equation will be computationally equal only if the program doing is indeed conjugate to the program doing .
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.