Geophysical Inversion and Modelling Library
v1.5.2-5-g042d7f36
|
Public Types | |
typedef RVector | Vec |
typedef RVector | ModelVector |
Public Types inherited from GIMLI::InversionBase< double > | |
typedef Vector< double > | ModelVector |
Public Member Functions | |
RInversion (bool verbose=false, bool dosave=false) | |
RInversion (ModellingBase &forward, bool verbose=false, bool dosave=false) | |
RInversion (const Vec &data, ModellingBase &forward, bool verbose=false, bool dosave=false) | |
RInversion (const Vec &data, ModellingBase &forward, Trans< Vec > &transData, bool verbose=true, bool dosave=false) | |
RInversion (const Vec &data, ModellingBase &forward, Trans< Vec > &transData, Trans< Vec > &transModel, bool verbose=true, bool dosave=false) | |
virtual | ~RInversion () |
void | setData (const Vec &data) |
const Vec & | data () const |
void | setRelativeError (const Vec &e) |
void | setRelativeError (double relerr) |
void | setAbsoluteError (const Vec &abserr) |
void | setAbsoluteError (double abserr) |
void | setError (const Vec &err, bool isRelative=true) |
void | setError (double err, bool isRelative=true) |
const Vec & | error () const |
void | checkError () |
Vec | errorDefault_ () |
void | setForwardOperator (ModellingBase &forward) |
ModellingBase * | forwardOperator () |
ModellingBase * | fop () |
void | setTransData (Trans< Vec > &tD) |
Trans< Vec > & | transData () |
void | setTransModel (Trans< Vec > &tM) |
Trans< Vec > & | transModel () |
uint | constraintsCount () const |
uint | dataCount () const |
void | setVerbose (bool verbose) |
bool | verbose () const |
void | setDoSave (bool d) |
bool | doSave () const |
void | saveModelHistory (bool doSaveModelHistory) |
void | setLineSearch (bool linesearch) |
bool | lineSearch () const |
void | setBlockyModel (bool isBlocky) |
bool | blockyModel () const |
void | setRobustData (bool isRobust) |
bool | robustData () const |
void | setLambda (double lambda) |
double | lambda () const |
double | getLambda () const |
void | setLambdaFactor (double lambdaFactor) |
double | lambdaFactor () const |
void | setLambdaMinimum (double l) |
double | lambdaMinimum () const |
void | setLocalRegularization (bool localReg) |
bool | localRegularization () const |
void | setOptimizeLambda (bool opt) |
bool | optimizeLambda () const |
void | setMaxIter (int maxiter) |
int | maxIter () const |
void | setMaxCGLSIter (int iter) |
int | maxCGLSIter () const |
void | setCGLSTolerance (double tol) |
double | maxCGLSTolerance () const |
uint | iter () const |
bool | isRunning () const |
void | abort () |
void | stopAtChi1 (bool stopAtChi1) |
void | setDeltaPhiAbortPercent (double dPhi) |
double | deltaPhiAbortPercent () const |
void | setMarquardtScheme (double lambdaFactor=0.8) |
void | checkTransFunctions () |
void | setRecalcJacobian (bool recalc) |
bool | recalcJacobian () const |
void | setBroydenUpdate (bool broydenUpdate) |
bool | broydenUpdate () const |
void | setModel (const Vec &model) |
const ModelVector & | model () const |
void | setReferenceModel (const Vec &model) |
void | setResponse (const Vec &response) |
void | setConstraintsH (const Vec &constraintsH) |
const Vec & | response () const |
Vec | getIRLS () const |
void | setCWeight (const Vec &cWeight) |
const Vec & | cWeight () const |
void | setMWeight (const Vec &mweight) |
const Vec & | mWeight () const |
void | robustWeighting () |
void | constrainBlocky () |
void | checkConstraints () |
void | checkJacobian (bool force=false) |
void | echoStatus () const |
void | echoStatus (const Vec &response, const Vec &model, const std::string &xtra="") const |
Vec | modelCellResolution (int iModel) |
Vec | modelCellResolution (const RVector3 &pos) |
RMatrix | modelResolutionMatrix () |
RVector | roughness (const RVector &model) const |
RVector | roughness () const |
RVector | pureRoughness (const RVector &model) const |
double | getPhiD (const Vec &response) const |
double | getPhiM (const Vec &model) const |
double | getPhi (const Vec &model, const Vec &response) const |
double | getPhiD () const |
double | getPhiM () const |
double | getPhi () const |
double | getChi2 () const |
double | getChi2 (const Vec &response) const |
double | chi2 () const |
double | absrms () const |
double | relrms () const |
double | linesearch (const Vec &modelNew, const Vec &responseNew) const |
double | linesearchQuad (const Vec &modelNew, const Vec &responseNew, const Vec &modelQuad, const Vec &responseQuad, double tauquad) const |
const std::vector< RVector > & | modelHistory () const |
Vec | invSubStep (const Vec &rhs) |
Vec | optLambda (const Vec &deltaData, const Vec &deltaModel0) |
bool | oneStep () |
!! h-variante More... | |
const Vec & | invert (const Vec &data) |
const Vec & | start () |
const Vec & | run () |
Vec | runChi1 (double acc=0.01, int maxiter=50) |
const RVector & | modelWeight () const |
const RVector & | modelRef () const |
const RVector & | dataWeight () const |
const RVector & | deltaDataIter () const |
const RVector & | deltaModelIter () const |
void | reset () |
Public Member Functions inherited from GIMLI::InversionBase< double > | |
InversionBase () | |
virtual | ~InversionBase () |
Protected Member Functions | |
void | init_ () |
Protected Attributes | |
Vec | data_ |
ModellingBase * | forward_ |
Trans< Vec > * | tD_ |
Trans< Vec > * | tM_ |
Trans< Vec > * | transModelDefault_ |
Trans< Vec > * | transDataDefault_ |
bool | verbose_ |
bool | dosave_ |
bool | saveModelHistory_ |
Vec | error_ |
Vec | response_ |
Vec | model_ |
Vec | modelRef_ |
Vec | constraintsH_ |
Vec | constraintWeights_ |
Vec | modelWeight_ |
Vec | dataWeight_ |
Vec | deltaDataIter_ |
Vec | deltaModelIter_ |
int | maxiter_ |
int | iter_ |
int | maxCGLSIter_ |
double | lambda_ |
double | lambdaFactor_ |
double | lambdaMin_ |
double | dPhiAbortPercent_ |
double | CGLStol_ |
bool | isBlocky_ |
bool | isRobust_ |
bool | isRunning_ |
bool | useLinesearch_ |
bool | optimizeLambda_ |
bool | abort_ |
bool | stopAtChi1_ |
bool | doBroydenUpdate_ |
bool | localRegularization_ |
bool | haveReferenceModel_ |
bool | recalcJacobian_ |
bool | jacobiNeedRecalc_ |
bool | activateFillConstraintWeights_ |
bool | fixError_ |
std::vector< RVector > | modelHist_ |
Inversion template using a Generalized Minimization Approach, atm fixed to Gauss-Newton solver Inversion(bool verbose, bool dosave Inversion(RVector data, FOP f, bool verbose, bool dosave Inversion(RVector data, FOP f, transData, transModel, bool verbose, bool dosave
|
inline |
Minimal constructor. verbose – gives some output and status information about the inversion progress; dosave – advanced debuging, saves alot of stuff and temporary data
|
inline |
Contructor for forward operator only
|
inline |
Usual constructor. data – vector of the given data; forward – the associated forward operator
|
inline |
Intermediate constructor including transforms and data transformation function
|
inline |
Full constructor including transforms. transData – data transformation function; transModel – model transformation function
|
inlinevirtual |
Destructor. Frees allocated memory
|
inlinevirtual |
Force abort at next iteration
Implements GIMLI::InversionBase< double >.
|
inline |
Return last absolute RMS misfit
void GIMLI::RInversion::checkConstraints | ( | ) |
Create constraints, check and compare size of constraint matrix with model/boundary control
References GIMLI::RegionManager::constraintWeights(), GIMLI::RegionManager::fillModelControl(), and GIMLI::Vector< ValueType >::resize().
Referenced by run().
|
inline |
Validate the data error. This check will be called at every new run or change of the error; Check size and content unequal to zero. If problems found, warn and set the data error to errorDefault_()
Referenced by run().
void GIMLI::RInversion::checkJacobian | ( | bool | force = false | ) |
Check size of Jacobian matrix against data and model number
References GIMLI::MatrixBase::cols(), GIMLI::ModellingBase::createJacobian(), GIMLI::Stopwatch::duration(), GIMLI::ModellingBase::jacobian(), and GIMLI::MatrixBase::rows().
|
inline |
Check if transfunctions are valid, set default if no transfunctions are given or override given functions by regionManager.transfunctions if available
Referenced by run().
|
inlinevirtual |
Return last chi-squared data misfit
Implements GIMLI::InversionBase< double >.
|
inline |
Apply blocky model constraints (see also setBlockyModel)
References GIMLI::getIRLSWeights().
Referenced by run().
|
inline |
Return number of constraints
Referenced by oneStep().
|
inlinevirtual |
Return reference to the current constraints weight vector
Implements GIMLI::InversionBase< double >.
|
inline |
Get data vector
|
inline |
Return number of data
|
inline |
Shortcut for echoStatus(response_, model_).
References echoStatus().
Referenced by echoStatus(), and oneStep().
|
inline |
Echo PhiD/PhiM/Phi and Chi^2 for given model and response
|
inline |
Return the used data error
|
inline |
Return a copy of the default data error array, [ Relative data error of 1% ]
|
inline |
Return forward operator. Shortcut for forwardOperator()
|
inlinevirtual |
Return forward operator.
Implements GIMLI::InversionBase< double >.
|
inline |
Return the chi-squared data misfit DEPRECATED wrong nameing scheme
|
inline |
Return the chi-squared data misfit for given forward response. DEPRECATED wrong nameing scheme
|
inline |
Return IRLS function of roughness vector
References GIMLI::getIRLSWeights().
|
inline |
Shortcut for getPhi(model_, response_) necessary ? DEPRECATED wrong nameing scheme
Referenced by run().
Return total objective function (data OF plus lambda times model OF) DEPRECATED wrong nameing scheme
|
inline |
Shortcut for getPhiD(response_) necessary ? DEPRECATED wrong nameing scheme
References getPhiD().
Referenced by getPhiD(), optLambda(), and run().
double GIMLI::RInversion::getPhiD | ( | const Vec & | response | ) | const |
Return data objective function (sum of squared data-weighted misfit)
References response().
|
inline |
Shortcut for getPhiM(model_) necessary ? DEPRECATED wrong nameing scheme
References getPhiM().
Referenced by getPhiM(), optLambda(), and run().
double GIMLI::RInversion::getPhiM | ( | const Vec & | model | ) | const |
Return model objective function (squared model roughness)
References model(), and roughness().
|
inlineprotected |
Internal initialization function, which is called from constructor. Set default paramater and allocate required memory
Compute model update by solving one inverse sub-step
rhs | The right-hand-side vector of the system of equation |
!! h-variante
|
inlinevirtual |
Return true if inversion is running
Implements GIMLI::InversionBase< double >.
|
inlinevirtual |
Return curent iteration number
Implements GIMLI::InversionBase< double >.
|
inline |
Return the minimum lambda value that can be reached if lambda factor is set.
Start with linear interpolation, followed by quadratic fit if linesearch parameter tau is lower than 0.03. Tries to return values between 0.03 and 1
rigorous minimization of the total objective function
parabolic line search using step 0, 1 and tauquad to fit parabola
too large
negative or nearly zero (stucked) -> use small step instead
only if not nearly one (which saves a forward run
Referenced by oneStep().
|
inline |
Compute objective function for old (tau=0), new (tau=1) and another model
|
inline |
Return whether regularization is global or local (e.g. Marquardt method)
|
inlinevirtual |
Return a const reference to the current model vector
Implements GIMLI::InversionBase< double >.
Referenced by getPhiM().
Compute cell resolution for closest cell to given position
|
inline |
Compute model cell resolution (specific column of resolution matrix) by an LSCG solver (Guenther, 2004)
|
inline |
Return the single models for each iteration. For debugging.
|
inline |
Compute whole resolution matrix by single cell resolutions
References GIMLI::Matrix< ValueType >::push_back().
|
inline |
Return reference to the current model weight vector
bool GIMLI::RInversion::oneStep | ( | ) |
!! h-variante
One iteration step. Return true if the step can be calculated successfully else false is returned.
full step possible;
normal line search parameter between 0.03 and 0.94
** temporary stuff
References GIMLI::Mesh::cellAttributes(), checkJacobian(), GIMLI::Mesh::clearData(), constraintsCount(), echoStatus(), GIMLI::ModellingBase::jacobian(), linesearch(), optLambda(), GIMLI::Vector< ValueType >::resize(), and roughness().
Referenced by run().
Optimization of regularization parameter by L-curve
References getPhiD(), getPhiM(), GIMLI::ModellingBase::jacobian(), and roughness().
Referenced by oneStep().
Return (C * m) , i.e. the pure (unweighted) roughness
|
inline |
Return last relative RMS misfit
|
inline |
|
inline |
Return a reference to the current response vector
Referenced by getPhiD().
|
inline |
Call robust date reweighting (see also setRobustData)
References GIMLI::getIRLSWeights().
Referenced by run().
|
inline |
Shortcut for roughness for the current model vector
Referenced by getPhiM(), oneStep(), and optLambda().
Return (C * m * m_w) * c_w
|
virtual |
Start the inversion procedure from the last model and return the final model vector.
Run inversion with current model.
calculation of initial modelresponse
() clear the model history
validate and rebuild the data error if necessary
validate and rebuild the constraint matrix if necessary
compute roughness constraint and correct it for inter-region constraints
validate and rebuild the jacobian if necessary
Implements GIMLI::InversionBase< double >.
References checkConstraints(), checkError(), checkJacobian(), checkTransFunctions(), constrainBlocky(), GIMLI::RegionManager::constraintCount(), getPhi(), getPhiD(), getPhiM(), GIMLI::ModellingBase::jacobian(), modelHist_, oneStep(), robustWeighting(), setModel(), GIMLI::Vector< ValueType >::setVal(), and GIMLI::ModellingBase::startModel().
|
inline |
Specialized run function that tries to reach a datafit chi^2=1 by varying the regularization paramater lambda
|
inline |
Set and get verbose behaviour
|
inline |
Set the absolute data error to the vector abserr
|
inline |
Set absolute data error to the scalar value abserr
|
inline |
Set and get blocky model behaviour (by L1 reweighting of constraints)
|
inline |
Enable/disable broyden update (which enforces scaling by transform function derivatives
|
inline |
Set and get abort tolerance for cgls solver. -1 means default scaling [default]
|
inline |
Set constraint right-hand side by hand (very special cases, so be careful)
|
inline |
Set the constraint weight (boundary control) vector
|
inlinevirtual |
|
inline |
Set and get relative objective function decrease
|
inline |
Set debug output
|
inlinevirtual |
Set the forward operator and the model-transform-function derived from fop-regionManager if not set before.
why is this so strictly necessary???
Always use a region manager
Implements GIMLI::InversionBase< double >.
|
inlinevirtual |
Set and get regularization parameter and its change over iteration
Implements GIMLI::InversionBase< double >.
|
inline |
Set the minimum lambda value that can be reached if lambda factor is set. Default is 1.
|
inline |
Set and get line search
|
inline |
Set whether regularization is global or local (e.g. Marquardt method)
|
inline |
Marquardt scheme (local damping with decreasing regularization strength
no contribution of regularization to objective function
lambda is decreased towards zero
let the solution fully converge (important for statistics)
|
inline |
Set and get maximum iteration number for inverse sub step
|
inlinevirtual |
Set and get maximum iteration number
Implements GIMLI::InversionBase< double >.
|
inlinevirtual |
Set model vector . If you call run() the inversion starts with this model, otherwise it will start with fop.startModel().
Implements GIMLI::InversionBase< double >.
Referenced by run().
|
inline |
Set the model weight vector
|
inline |
Set and get whether lambda is being optimized by Lcurve
|
inline |
Define and find out whether Jacobian is recalculated in each iteration
|
inlinevirtual |
Set reference model vector
Implements GIMLI::InversionBase< double >.
|
inline |
Set the relative data error to the vector err.
|
inline |
Set relative data error to scalar error value relerr. If you force relerr == 0 here. Data will not corrected or weighted.
|
inline |
Set current model response (e.g. to avoid time-consuming forward calculation, but be careful)
|
inline |
Set and get robust data weighting by L1 reweighting scheme
Set and get data transform. WARNING! we just store a reference to the trans .. U have to ensure that the trans is and stayes valid. TODO change this!!!
Implements GIMLI::InversionBase< double >.
Set and get Model transform WARNING! we just store a reference to the trans .. U have to ensure that the trans is and stayes valid. TODO change this!!!
Implements GIMLI::InversionBase< double >.
|
inline |
Set verbose output
const RVector & GIMLI::RInversion::start | ( | ) |
|
inline |
|
protected |
Set this to zero if u want to use absolute errors == zero