Next: Out-of-core extension
Up: Abstract Classes
Previous: Operators and combination operators
With the ease in forming complex operators, the solver becomes
a rather trivial code.
All of the linear solvers are derived from a basic
SEP.solver.solver class. This class is initialized
with a model vector, residual vector, an operator, a step function,
the number of iterations to run, and optional verbosity flag,
and whether or not the job is being restarted.
The initialization process is limited to first cloning
model vector and the residual vector to form
the gradient and the vector resulting from
.
It then initializes the
step function, calculates and stores (or in the case of restarts,
reads) the tasks it needs to perform.
Taking a linear step becomes the following trivial code fragment.
def step(self,iter):
self.op.adjoint(self.g,self.rr,self.status,iter)
self.op.forward(self.g,self.gg,self.status,iter)
self.status.update_status(str(iter)+".step",["started"])
if not self.stepper.step(self.x,self.g,self.rr,self.gg): return None
self.status.update_status(str(iter)+".step",["finished"])
return 1
Three solvers are derived from this base class:
SEP.solver.smp, SEP.solver.reg, and
SEP.solver.prec. These classes simply form
the objects needed by the solver class.
Next: Out-of-core extension
Up: Abstract Classes
Previous: Operators and combination operators
Stanford Exploration Project
10/23/2004