1.8.0
CCC
 
Loading...
Searching...
No Matches
gstlrn::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 gstlrn::DriftList:
gstlrn::AStringable gstlrn::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 ()
 
String toString (const AStringFormat *strfmt=nullptr) const override
 ICloneable interface.
 
Id getNVar () const
 
Id getNDrift () const
 
bool hasDrift () const
 
void addDrift (const ADrift *drift)
 
void delDrift (size_t rank)
 
void delAllDrifts ()
 
const VectorBoolgetFiltered () const
 
void setFiltered (const VectorBool &filtered)
 
bool isDriftFiltered (Id i) const
 
void setFiltered (Id i, bool filter)
 
Id getNDriftEquation () const
 
bool hasExternalDrift () const
 
bool isValid () const
 
Id getNExtDrift () const
 
const CovContextgetContext () const
 
const ADriftgetDrift (Id il) const
 TODO : to be removed (encapsulation)
 
Id getRankFex (Id il) const
 
String getDriftName (Id il) const
 
const & getBetaHats () const
 
void setDriftCLByPart (Id ivar, Id ib, const 1 &coef)
 
void resetDriftList ()
 
bool isDriftSampleDefined (const Db *db, Id ib, Id nech, const 1 &nbgh, const ELoc &loctype) const
 
double computeDrift (const Db *db, Id ib, Id iech) const
 
 getDrifts (const Db *db, bool useSel=true) const
 
bool isFlagLinked () const
 
bool isFlagCombined () const
 
Id getDriftMaxIRFOrder () const
 
bool isDriftDefined (const 1 &powers, Id rank_fex=0) const
 
bool isDriftDifferentDefined (const 1 &powers, Id rank_fex=-1) const
 
void copyCovContext (const CovContext &ctxt)
 
void setFlagLinked (bool flagLinked)
 
void setFlagCombined (bool flagCombined)
 
void setBetaHat (const 1 &betaHat)
 
double evalDrift (const Db *db, Id iech, Id il, const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
double evalDriftCoef (const Db *db, Id iech, const 1 &coeffs) const
 
 evalDriftCoefs (const Db *db, const 1 &coeffs, bool useSel=false) const
 
 evalDriftBySample (const Db *db, Id iech, const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
void evalDriftBySampleInPlace (const Db *db, Id iech, const ECalcMember &member, 1 &drftab) const
 
MatrixDense evalDriftMat (const Db *db, const 1 &nbgh=1(), const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
Id evalDriftMatInPlace (MatrixDense &mat, const Db *db, const 1 &nbgh=1(), const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
Id evalDriftMatByRanksInPlace (MatrixDense &mat, const Db *db, const 1 &sampleranks=1(), const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 Calculate the Drift matrix.
 
MatrixDense evalDriftMatByRanks (const Db *db, const 1 &sampleRanks=1(), const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 Returns the Matrix of the Drift elements.
 
 evalMeanVecByRanks (const Db *db, const 1 &sampleRanks=1()) const
 
Id evalDriftMatByTargetInPlace (MatrixDense &mat, const Db *db, Id iech2, const KrigOpt &krigopt=KrigOpt()) const
 
double evalDriftValue (const Db *db, Id iech, Id ivar, Id ib, const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
void setMeans (const 1 &mean)
 
void setMean (const double mean, Id ivar=0)
 
double getMean (Id ivar) const
 
const & getMeans () const
 
const DriftListcreateReduce (const 1 &validVars) const
 
double evalDriftVarCoef (const Db *db, Id iech, Id ivar, const 1 &coeffs) const
 
 evalDriftVarCoefs (const Db *db, const 1 &coeffs, bool useSel=false) const
 
virtual void appendParams (ListParams &listParams)
 
void updateDriftList ()
 
- Public Member Functions inherited from gstlrn::AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (Id level) const final
 
- Public Member Functions inherited from gstlrn::ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 
std::shared_ptr< ICloneablecloneShared () const
 
std::unique_ptr< ICloneablecloneUnique () const
 

Static Public Member Functions

static void initParams (const MatrixSymmetric &vars, double href=1.)
 

Constructor & Destructor Documentation

◆ DriftList() [1/2]

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

◆ DriftList() [2/2]

gstlrn::DriftList::DriftList ( const DriftList r)

◆ ~DriftList()

gstlrn::DriftList::~DriftList ( )
virtual

Member Function Documentation

◆ addDrift()

void gstlrn::DriftList::addDrift ( const ADrift drift)

◆ appendParams()

virtual void gstlrn::DriftList::appendParams ( ListParams listParams)
inlinevirtual

◆ computeDrift()

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

◆ copyCovContext()

void gstlrn::DriftList::copyCovContext ( const CovContext ctxt)

◆ createReduce()

const DriftList * gstlrn::DriftList::createReduce ( const 1 &  validVars) const

◆ delAllDrifts()

void gstlrn::DriftList::delAllDrifts ( )

◆ delDrift()

void gstlrn::DriftList::delDrift ( size_t  rank)

◆ evalDrift()

double gstlrn::DriftList::evalDrift ( const Db db,
Id  iech,
Id  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()

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

◆ evalDriftBySampleInPlace()

void gstlrn::DriftList::evalDriftBySampleInPlace ( const Db db,
Id  iech,
const ECalcMember &  member,
1 &  drftab 
) const

◆ evalDriftCoef()

double gstlrn::DriftList::evalDriftCoef ( const Db db,
Id  iech,
const 1 &  coeffs 
) const

◆ evalDriftCoefs()

gstlrn::DriftList::evalDriftCoefs ( const Db db,
const 1 &  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 gstlrn::DriftList::evalDriftMat ( const Db db,
const 1 &  nbgh = 1(),
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()

MatrixDense gstlrn::DriftList::evalDriftMatByRanks ( const Db db,
const 1 &  sampleRanks = 1(),
const ECalcMember &  member = ECalcMember::fromKey("LHS") 
) const

Returns the Matrix of the Drift elements.

Parameters
db
sampleRanks
member
Returns
MatrixDense

◆ evalDriftMatByRanksInPlace()

Id gstlrn::DriftList::evalDriftMatByRanksInPlace ( MatrixDense mat,
const Db db,
const 1 &  sampleRanks = 1(),
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
Id Error returned code

◆ evalDriftMatByTargetInPlace()

Id gstlrn::DriftList::evalDriftMatByTargetInPlace ( MatrixDense mat,
const Db db,
Id  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

◆ evalDriftMatInPlace()

Id gstlrn::DriftList::evalDriftMatInPlace ( MatrixDense mat,
const Db db,
const 1 &  nbgh = 1(),
const ECalcMember &  member = ECalcMember::fromKey("LHS") 
) const

◆ evalDriftValue()

double gstlrn::DriftList::evalDriftValue ( const Db db,
Id  iech,
Id  ivar,
Id  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 gstlrn::DriftList::evalDriftVarCoef ( const Db db,
Id  iech,
Id  ivar,
const 1 &  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()

gstlrn::DriftList::evalDriftVarCoefs ( const Db db,
const 1 &  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

◆ evalMeanVecByRanks()

gstlrn::DriftList::evalMeanVecByRanks ( const Db db,
const 1 &  sampleRanks = 1() 
) const

◆ getBetaHats()

const & gstlrn::DriftList::getBetaHats ( ) const
inline

◆ getContext()

const CovContext & gstlrn::DriftList::getContext ( ) const
inline

◆ getDrift()

const ADrift * gstlrn::DriftList::getDrift ( Id  il) const

TODO : to be removed (encapsulation)

◆ getDriftMaxIRFOrder()

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

◆ getDriftName()

String gstlrn::DriftList::getDriftName ( Id  il) const

◆ getDrifts()

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

◆ getFiltered()

const VectorBool & gstlrn::DriftList::getFiltered ( ) const
inline

◆ getMean()

double gstlrn::DriftList::getMean ( Id  ivar) const

◆ getMeans()

const & gstlrn::DriftList::getMeans ( ) const
inline

◆ getNDrift()

Id gstlrn::DriftList::getNDrift ( ) const
inline

◆ getNDriftEquation()

Id gstlrn::DriftList::getNDriftEquation ( ) const

◆ getNExtDrift()

Id gstlrn::DriftList::getNExtDrift ( ) const

◆ getNVar()

Id gstlrn::DriftList::getNVar ( ) const
inline

◆ getRankFex()

Id gstlrn::DriftList::getRankFex ( Id  il) const

◆ hasDrift()

bool gstlrn::DriftList::hasDrift ( ) const
inline

◆ hasExternalDrift()

bool gstlrn::DriftList::hasExternalDrift ( ) const

◆ initParams()

static void gstlrn::DriftList::initParams ( const MatrixSymmetric vars,
double  href = 1. 
)
inlinestatic

◆ isDriftDefined()

bool gstlrn::DriftList::isDriftDefined ( const 1 &  powers,
Id  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 gstlrn::DriftList::isDriftDifferentDefined ( const 1 &  powers,
Id  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 gstlrn::DriftList::isDriftFiltered ( Id  i) const

◆ isDriftSampleDefined()

bool gstlrn::DriftList::isDriftSampleDefined ( const Db db,
Id  ib,
Id  nech,
const 1 &  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 gstlrn::DriftList::isFlagCombined ( ) const
inline

◆ isFlagLinked()

bool gstlrn::DriftList::isFlagLinked ( ) const
inline

◆ isValid()

bool gstlrn::DriftList::isValid ( ) const

Check that the set of drift functions is valid

Returns

◆ operator=()

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

◆ resetDriftList()

void gstlrn::DriftList::resetDriftList ( )

◆ setBetaHat()

void gstlrn::DriftList::setBetaHat ( const 1 &  betaHat)
inline

◆ setDriftCLByPart()

void gstlrn::DriftList::setDriftCLByPart ( Id  ivar,
Id  ib,
const 1 &  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 gstlrn::DriftList::setFiltered ( const VectorBool filtered)
inline

◆ setFiltered() [2/2]

void gstlrn::DriftList::setFiltered ( Id  i,
bool  filter 
)

◆ setFlagCombined()

void gstlrn::DriftList::setFlagCombined ( bool  flagCombined)
inline

◆ setFlagLinked()

void gstlrn::DriftList::setFlagLinked ( bool  flagLinked)
inline

◆ setMean()

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

Define the Mean for one variable

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

◆ setMeans()

void gstlrn::DriftList::setMeans ( const 1 &  mean)

◆ toString()

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

ICloneable interface.

AStringable Interface

Reimplemented from gstlrn::AStringable.

◆ updateDriftList()

void gstlrn::DriftList::updateDriftList ( )
inline

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