Loading [MathJax]/extensions/tex2jax.js
1.7.3
Geostatistics & Machine Learning toolbox | https://gstlearn.org
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DriftList Class Reference

This class provides the information on Drift part of the Model. The drift plays the role of the average of the target Random Function which may be constant or vary as a function with low frequency variations (by opposition to the complementary part of the Spatial Characteristics which is described by its Covariance) More...

#include <DriftList.hpp>

Inheritance diagram for DriftList:
AStringable ICloneable

Detailed Description

This class provides the information on Drift part of the Model. The drift plays the role of the average of the target Random Function which may be constant or vary as a function with low frequency variations (by opposition to the complementary part of the Spatial Characteristics which is described by its Covariance)

This class essentially contains a list of basic (active)e drift functions: see ADrift.hpp for details.

This class also carry other important informations:

  • a vector giving the status of each basic drift functions: it may be active or filtered
  • some additional information defining some relationship between the basic drift function: this is used for the special case where the different Random Functions obey to algebraic relations.

Public Member Functions

 DriftList (const CovContext &ctxt=CovContext())
 
 DriftList (const DriftList &r)
 
DriftListoperator= (const DriftList &r)
 
virtual ~DriftList ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 ICloneable interface.
 
int getNVar () const
 
int getNDrift () const
 
bool hasDrift () const
 
void addDrift (const ADrift *drift)
 
void delDrift (unsigned int rank)
 
void delAllDrifts ()
 
const VectorBoolgetFiltered () const
 
void setFiltered (const VectorBool &filtered)
 
bool isDriftFiltered (int i) const
 
void setFiltered (int i, bool filter)
 
int getNDriftEquation () const
 
bool hasExternalDrift () const
 
bool isValid () const
 
int getNExtDrift () const
 
const CovContextgetContext () const
 
const ADriftgetDrift (int il) const
 TODO : to be removed (encapsulation)
 
int getRankFex (int il) const
 
String getDriftName (int il) const
 
const VectorDoublegetBetaHats () const
 
void setDriftCLByPart (int ivar, int ib, const VectorDouble &coef)
 
void resetDriftList ()
 
bool isDriftSampleDefined (const Db *db, int ib, int nech, const VectorInt &nbgh, const ELoc &loctype) const
 
double computeDrift (const Db *db, int ib, int iech) const
 
VectorVectorDouble getDrifts (const Db *db, bool useSel=true) const
 
bool isFlagLinked () const
 
bool isFlagCombined () const
 
int getDriftMaxIRFOrder () const
 
bool isDriftDefined (const VectorInt &powers, int rank_fex=0) const
 
bool isDriftDifferentDefined (const VectorInt &powers, int rank_fex=-1) const
 
void copyCovContext (const CovContext &ctxt)
 
void setFlagLinked (bool flagLinked)
 
void setFlagCombined (bool flagCombined)
 
void setBetaHat (const VectorDouble &betaHat)
 
double evalDrift (const Db *db, int iech, int il, const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
double evalDriftCoef (const Db *db, int iech, const VectorDouble &coeffs) const
 
VectorDouble evalDriftCoefs (const Db *db, const VectorDouble &coeffs, bool useSel=false) const
 
VectorDouble evalDriftBySample (const Db *db, int iech, const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
void evalDriftBySampleInPlace (const Db *db, int iech, const ECalcMember &member, VectorDouble &drftab) const
 
MatrixDense evalDriftMat (const Db *db, const VectorInt &nbgh=VectorInt(), const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
int evalDriftMatByRanks (MatrixDense &mat, const Db *db, const VectorVectorInt &sampleranks, const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 Calculate the Drift matrix.
 
int evalDriftMatByTarget (MatrixDense &mat, const Db *db, int iech2, const KrigOpt &krigopt=KrigOpt()) const
 
double evalDriftValue (const Db *db, int iech, int ivar, int ib, const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
void setMeans (const VectorDouble &mean)
 
void setMean (const double mean, int ivar=0)
 
double getMean (int ivar) const
 
const VectorDoublegetMeans () const
 
const DriftListcreateReduce (const VectorInt &validVars) const
 
double evalDriftVarCoef (const Db *db, int iech, int ivar, const VectorDouble &coeffs) const
 
VectorDouble evalDriftVarCoefs (const Db *db, const VectorDouble &coeffs, bool useSel=false) const
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 
- Public Member Functions inherited from ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 

Constructor & Destructor Documentation

◆ DriftList() [1/2]

DriftList::DriftList ( const CovContext ctxt = CovContext())

◆ DriftList() [2/2]

DriftList::DriftList ( const DriftList r)

◆ ~DriftList()

DriftList::~DriftList ( )
virtual

Member Function Documentation

◆ addDrift()

void DriftList::addDrift ( const ADrift drift)

◆ computeDrift()

double DriftList::computeDrift ( const Db db,
int  ib,
int  iech 
) const

◆ copyCovContext()

void DriftList::copyCovContext ( const CovContext ctxt)

◆ createReduce()

const DriftList * DriftList::createReduce ( const VectorInt validVars) const

◆ delAllDrifts()

void DriftList::delAllDrifts ( )

◆ delDrift()

void DriftList::delDrift ( unsigned int  rank)

◆ evalDrift()

double DriftList::evalDrift ( const Db db,
int  iech,
int  il,
const ECalcMember &  member = ECalcMember::fromKey("LHS") 
) const

Evaluate a given drift function for a given sample

Parameters
dbDb structure
iechRank of the target sample
ilRank of the drift function
memberMember type (used to check filtering)
Returns

◆ evalDriftBySample()

VectorDouble DriftList::evalDriftBySample ( const Db db,
int  iech,
const ECalcMember &  member = ECalcMember::fromKey("LHS") 
) const

◆ evalDriftBySampleInPlace()

void DriftList::evalDriftBySampleInPlace ( const Db db,
int  iech,
const ECalcMember &  member,
VectorDouble drftab 
) const

◆ evalDriftCoef()

double DriftList::evalDriftCoef ( const Db db,
int  iech,
const VectorDouble coeffs 
) const

◆ evalDriftCoefs()

VectorDouble DriftList::evalDriftCoefs ( const Db db,
const VectorDouble coeffs,
bool  useSel = false 
) const

Evaluate the Linear combination of drift terms at each sample of a Db

Parameters
dbTarget Db
coeffsVector of coefficients (must have dimension of number of drift elements)
useSelTrue if the selection must be taken into account
Returns

◆ evalDriftMat()

MatrixDense DriftList::evalDriftMat ( const Db db,
const VectorInt nbgh = VectorInt(),
const ECalcMember &  member = ECalcMember::fromKey("LHS") 
) const

Establish the drift rectangular matrix for a given Db

Returns
Returned matrix (Dimension/ nrows = nvar * nech; ncols = nfeq * nvar)
Parameters
[in]dbDb structure
[in]nbghVector of indices of active samples in db (optional)
[in]memberMember of the Kriging System (ECalcMember)

◆ evalDriftMatByRanks()

int DriftList::evalDriftMatByRanks ( MatrixDense mat,
const Db db,
const VectorVectorInt sampleRanks,
const ECalcMember &  member = ECalcMember::fromKey("LHS") 
) const

Calculate the Drift matrix.

Parameters
matDrift matrix (possibly resized)
dbData Db
sampleRanksVector of sample ranks in 'db'
memberCalcMember
Returns
int Error returned code

◆ evalDriftMatByTarget()

int DriftList::evalDriftMatByTarget ( MatrixDense mat,
const Db db,
int  iech2,
const KrigOpt krigopt = KrigOpt() 
) const

Establish the drift rectangular matrix for a given Db

Returns
Returned matrix (Dimension/ nrows = nvar * nech; ncols = nfeq * nvar)
Parameters
[in]matDrift matrix (possibly resized)
[in]dbDb structure
[in]iech2Index of active samples in db
[in]krigoptKrigOpt structure

◆ evalDriftValue()

double DriftList::evalDriftValue ( const Db db,
int  iech,
int  ivar,
int  ib,
const ECalcMember &  member = ECalcMember::fromKey("LHS") 
) const

Returns the Drift value for a given variable and a given drift function

Parameters
dbDb structure
iechRank of the sample
ivarRank of the variable
ibRank of the Drift function
memberECalcMember characteristics

◆ evalDriftVarCoef()

double DriftList::evalDriftVarCoef ( const Db db,
int  iech,
int  ivar,
const VectorDouble coeffs 
) const

Evaluate the drift with a given sample and a given variable The value is scaled by 'coeffs'

Parameters
[in]dbDb structure
[in]iechRank of the sample
[in]ivarRank of the variable
[in]coeffsVector of coefficients

◆ evalDriftVarCoefs()

VectorDouble DriftList::evalDriftVarCoefs ( const Db db,
const VectorDouble coeffs,
bool  useSel = false 
) const

A vector of the drift evaluation (for all samples)

Parameters
dbDb structure
coeffsVector of drift coefficients
useSelWhen TRUE, only non masked samples are returned
Returns
The vector of values
Remarks
When no drift is defined, a vector is returned filled with the variable mean

◆ getBetaHats()

const VectorDouble & DriftList::getBetaHats ( ) const
inline

◆ getContext()

const CovContext & DriftList::getContext ( ) const
inline

◆ getDrift()

const ADrift * DriftList::getDrift ( int  il) const

TODO : to be removed (encapsulation)

◆ getDriftMaxIRFOrder()

int DriftList::getDriftMaxIRFOrder ( ) const
Returns
Maximum IRF-order (-1 for order-2 stationarity)

◆ getDriftName()

String DriftList::getDriftName ( int  il) const

◆ getDrifts()

VectorVectorDouble DriftList::getDrifts ( const Db db,
bool  useSel = true 
) const

◆ getFiltered()

const VectorBool & DriftList::getFiltered ( ) const
inline

◆ getMean()

double DriftList::getMean ( int  ivar) const

◆ getMeans()

const VectorDouble & DriftList::getMeans ( ) const
inline

◆ getNDrift()

int DriftList::getNDrift ( ) const
inline

◆ getNDriftEquation()

int DriftList::getNDriftEquation ( ) const

◆ getNExtDrift()

int DriftList::getNExtDrift ( ) const

◆ getNVar()

int DriftList::getNVar ( ) const
inline

◆ getRankFex()

int DriftList::getRankFex ( int  il) const

◆ hasDrift()

bool DriftList::hasDrift ( ) const
inline

◆ hasExternalDrift()

bool DriftList::hasExternalDrift ( ) const

◆ isDriftDefined()

bool DriftList::isDriftDefined ( const VectorInt powers,
int  rank_fex = 0 
) const

Check if a given drift type is defined among the drift functions

Parameters
powersVector of exponents for monomials
rank_fexRank of the variable for external dift
Returns

◆ isDriftDifferentDefined()

bool DriftList::isDriftDifferentDefined ( const VectorInt powers,
int  rank_fex = -1 
) const

Check if at least one drift function exists whose type is different from the target type

Parameters
powersVector of exponent for monomials of a polynomial drift
rank_fexRank of the variable for external Drift
Returns

◆ isDriftFiltered()

bool DriftList::isDriftFiltered ( int  i) const

◆ isDriftSampleDefined()

bool DriftList::isDriftSampleDefined ( const Db db,
int  ib,
int  nech,
const VectorInt nbgh,
const ELoc &  loctype 
) const

Check that the drift 'ib' is defined for at least one variable one sample

Parameters
dbData file used for reading the drift contents (depends on its type)
ibRank of the drift function
nechNumber of samples to be checked
nbghVector of sample indices within the data base
loctypeLocator to be checked

◆ isFlagCombined()

bool DriftList::isFlagCombined ( ) const
inline

◆ isFlagLinked()

bool DriftList::isFlagLinked ( ) const
inline

◆ isValid()

bool DriftList::isValid ( ) const

Check that the set of drift functions is valid

Returns

◆ operator=()

DriftList & DriftList::operator= ( const DriftList r)

◆ resetDriftList()

void DriftList::resetDriftList ( )

◆ setBetaHat()

void DriftList::setBetaHat ( const VectorDouble betaHat)
inline

◆ setDriftCLByPart()

void DriftList::setDriftCLByPart ( int  ivar,
int  ib,
const VectorDouble coef 
)

Set the values of the internal array 'driftCL' This feature is used when the drift equation does not coincide with a drift function (when working with the gradient of the target variable, for example)

Parameters
ivarRank of the variable (_nVar)
ibRank of the drift equation (_driftEquationNumber)
coefVector of coefficients

◆ setFiltered() [1/2]

void DriftList::setFiltered ( const VectorBool filtered)
inline

◆ setFiltered() [2/2]

void DriftList::setFiltered ( int  i,
bool  filter 
)

◆ setFlagCombined()

void DriftList::setFlagCombined ( bool  flagCombined)
inline

◆ setFlagLinked()

void DriftList::setFlagLinked ( bool  flagLinked)
inline

◆ setMean()

void DriftList::setMean ( const double  mean,
int  ivar = 0 
)

Define the Mean for one variable

Parameters
meanValue for the mean
ivarRank of the variable (starting from 0)

◆ setMeans()

void DriftList::setMeans ( const VectorDouble mean)

◆ toString()

String DriftList::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

ICloneable interface.

AStringable Interface

Reimplemented from AStringable.


The documentation for this class was generated from the following files: