Schleicher 2018 The Conjugate Gradient Method
Schleicher 2018 The Conjugate Gradient Method
application to geophysical problems. It is an iterative method. operator, and adjoint for the adjoint operator, which in this case
Each iteration applies the linear operator and its adjoint. The is correlation.
initial guess is often the zero vector, and computation may stop
after very few iterations. class Operator(object):
The adjoint of the operator A, denoted as A H, is defined as """A linear operator.
the operator that satisfies ⟨Ax, y〉 = ⟨x, A H y〉 for all vectors x and """
y (where ⟨u, v〉 represents the inner product between vectors u def __init__(self, wavelet):
and v). For a given matrix, the adjoint is simply the complex self.wavelet = wavelet
conjugate of the transpose of the matrix; this is also sometimes
known as the Hermitian transpose and is sometimes written as def forward(self, v):
A* or A†. Just to muddy the notation water even further, the """Defines the forward operator.
complex conjugate transpose is denoted by A.H in NumPy and """
A' in Matlab or Octave. However, we will implement the adjoint return np.convolve(v, self.wavelet, mode='same')
operator without forming any matrices.
Many linear operators can be programmed as functions that def adjoint(self, v):
are more intuitive and efficient than matrix multiplication. The """Defines the adjoint operator.
matrices for operators like migration and FWI would be huge, """
but we avoid this problem because once you have the program for return np.correlate(v, self.wavelet, mode='same')
the linear operator, you can write the adjoint operator without
computing matrices. Implementing the conjugate gradient algo- Claerbout (2012) teaches how to write this kind of symmetrical
rithm using functions to apply linear operators and their adjoints code and provides many examples of geophysical operators with
is practical and efficient. It is wonderful to see programs that adjoints (e.g., derivative versus negative derivative, causal integra-
implement linear algorithms without matrices, and the program- tion versus anticausal integration, stretch versus squeeze, truncate
ming technique is a key theme in Claerbout’s 2012 book. versus zero pad). Writing functions to apply operators is more
This tutorial provides a quick start to the conjugate gradient efficient than computing matrices.
method based on Guo’s pseudocode (2002). Those interested in Now that we have the operator, we can instantiate the class
more depth can read Claerbout (2012) and Shewchuk (1994). A with a wavelet. This wavelet will be “built in” to the instance F.
Jupyter Notebook with Python code to reproduce the figures in
this tutorial is at https://github.com/seg/tutorials. F = Operator(wavelet)
1
University of Texas, Bureau of Economic Geology, Jackson School https://doi.org/10.1190/tle37040296.1.
of Geosciences.
d = F.forward(m)
d_pred = F.forward(m_est)
Conclusions
Figure 4 compares the predicted data with the original data I described the conjugate gradient algorithm and presented
to show that we have done a good job of the estimation. This an implementation. This is an iterative method that requires
demonstrates more than one reflectivity sequence when convolved functions to apply the linear operator and its adjoint. Many
with the Ricker wavelet fits the data, in particular the original linear operators that are familiar geophysical operations like
model and the model estimated by the conjugate gradient method. convolution are more efficiently implemented without matrices.
It may be interesting to explore preconditioning operators that The reflectivity estimation problem described in Hall (2016)
promote a sparse solution. was solved using the conjugate gradient method. Convergence
The Jupyter notebook provided with this tutorial further only took four iterations. The conjugate gradient method is often
explores finding least-squares solutions using the conjugate gradi- used to solve large problems because well-known solvers like
ent method. The notebook demonstrates how preconditioning least squares are much more expensive.
Acknowledgments
The SEG Seismic Working Workshop on Reproducible Tutori-
als held 9–13 August 2017 in Houston inspired this tutorial. For
more information, visit http://ahay.org/wiki/Houston_2017.
References
Claerbout, J., and S. Fomel, 2012, Image estimation by example,
DOI:10.1190/tle37040296.1
http://sepwww.stanford.edu/sep/prof/gee1-2012.pdf, accessed
6 March 2018.
Guo, J., H. Zhou, J. Young, and S. Gray, 2002, Merits and challenges
Figure 2. The initial estimate and the first 5 iterations of conjugate gradient. The for accurate velocity model building by 3D gridded tomography:
fifth iteration almost exactly overlays the fourth. 72nd Annual International Meeting, SEG, Expanded Abstracts,
854–857, https://doi.org/10.1190/1.1817395.
Hall, M., 2016, Linear Inversion: The Leading Edge, 35, no. 12,
1085–1087, https://doi.org/10.1190/tle35121085.1.
Hestenes, M. R., and E. Stiefel, 1952, Methods of conjugate gradients
for solving linear systems: Journal of Research of the National
Bureau of Standards, 49, no. 6, https://doi.org/10.6028/jres.049.044.
Paige, C. C., and M. A. Saunders, 1982, LSQR: An algorithm for
sparse linear equations and sparse least squares: ACM Transactions
on Mathematical Software, 8, no. 1, 43–71, https://doi.org/
10.1145/355984.355989.
Shewchuk, J. R., 1994, An introduction to the conjugate gradient
method without the agonizing pain, http://www.cs.cmu.
edu/~quake-papers/painless-conjugate-gradient.pdf, accessed
Figure 3. Comparison of the model (black) and the model estimated using 6 March 2018.
conjugate gradient inversion (purple), along with the data (orange) for Witte, P, M. Louboutin, K. Lensink, M. Lange, N. Kukreja, F.
comparison. Luporini, G. Gorman, and F. J. Herrman, 2018, Full-waveform
inversion, Part 3: Optimization: The Leading Edge, 37, no. 2,
142–145, https://doi.org/10.1190/tle37020142.1.