Guide to Madagascar programs |
file | dat= | auxiliary input file name | |
---|---|---|---|
file | mod= | auxiliary input file name |
sfdottest is a generic dot-product test program for testing linear operators. Suppose there is an executable program <prog> that takes an RSF file from the standard input and produces an RSF file in the standard output. It may take any number of additional parameters but one of them must be adj= that sets the forward (adj=0) or adjoint (adj=1) operations. The program <prog> is typically an RSF program but it could be anything (a script, a multiprocessor MPI program, etc.) as long as it implements a linear operator and its adjoint . The sfdottest program is testing the equality
bash$ sfdottest <prog> [optional aruments] mod=mod.rsf dat=dat.rsfwhere mod.rsf and dat.rsf are RSF files that represent vectors from the model and data spaces. sfdottest does not create any temporary files and does not have any restrictive limitations on the size of the vectors.
Here is an example. We first setup a vector with 100 elements using sfspike and then run sfdottest to test the sfcausint program. sfcausint implements a linear operator of causal integration and its adjoint, the anti-causal integration.
bash$ sfspike n1=100 > vec.rsf bash$ sfdottest sfcausint mod=vec.rsf dat=vec.rsf sfdottest: L[m]*d=1410.2 sfdottest: L'[d]*m=1410.2 bash$ sfdottest sfcausint mod=vec.rsf dat=vec.rsf sfdottest: L[m]*d=1165.87 sfdottest: L'[d]*m=1165.87The numbers are different on subsequent runs because of changing seed in the random number generator.
Here is a somewhat more complicated example. The sfhelicon program implements Claerbout's multidimensional helical filtering (Claerbout, 1998). It requires a filter to be specified in addition to the input and output vectors. We create a helical 2-D filter using the Unix echo command.
bash$ echo 1 19 20 n1=3 n=20,20 data_format=ascii_int in=lag.rsf > lag.rsf bash$ echo 1 1 1 a0=-3 n1=3 data_format=ascii_float in=flt.rsf > flt.rsfNext, we create an example 2-D model and data vector with sfspike.
bash$ sfspike n1=50 n2=50 > vec.rsfNow the sfdottest program can perform the dot product test.
bash$ sfdottest sfhelicon filt=flt.rsf lag=lag.rsf \ > mod=vec.rsf dat=vec.rsf sfdottest: L[m]*d=8.97375 sfdottest: L'[d]*m=8.97375Here is the same program tested in the inverse filtering mode:
bash$ sfdottest sfhelicon filt=flt.rsf lag=lag.rsf \ > mod=vec.rsf dat=vec.rsf div=y sfdottest: L[m]*d=15.0222 sfdottest: L'[d]*m=15.0222
Guide to Madagascar programs |