gstlearn  1.0.0
CCC
Selectivity Class Reference

#include <Selectivity.hpp>

Inheritance diagram for Selectivity:
AStringable ICloneable

Public Member Functions

 Selectivity (int ncut=0)
 
 Selectivity (const VectorDouble &zcuts, double zmax=TEST, double proba=TEST, bool flag_tonnage_correct=false)
 
 Selectivity (const Selectivity &m)
 
Selectivityoperator= (const Selectivity &m)
 
virtual ~Selectivity ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 ICloneable interface. More...
 
int calculateFromDb (const Db *db, bool autoCuts=false)
 
int calculateFromArray (const VectorDouble &tab, const VectorDouble &weights=VectorDouble(), bool autoCuts=false)
 
int calculateFromAnamorphosis (AAnam *anam)
 
const Table eval (const Db *db, bool autoCuts=false)
 
const Table evalFromArray (const VectorDouble &tab, const VectorDouble &weights=VectorDouble(), bool autoCuts=false)
 
const Table evalFromAnamorphosis (AAnam *anam)
 
void resetCuts (const VectorDouble &zcuts)
 
int getNCuts () const
 
int getNQT () const
 
int getVariableNumber () const
 
String getVariableName (const ESelectivity &code, int icut, int mode) const
 
String getVariableName (int rank0) const
 
VectorString getVariableNames () const
 
void setZcut (int icut, double zcut)
 
void setBest (int icut, double best)
 
void setMest (int icut, double mest)
 
void setQest (int icut, double qest)
 
void setQstd (int icut, double qstd)
 
void setTest (int icut, double test)
 
void setTstd (int icut, double tstd)
 
double getZcut (int icut) const
 
double getBest (int icut) const
 
double getMest (int icut) const
 
double getQest (int icut) const
 
double getQstd (int icut) const
 
double getTest (int icut) const
 
double getTstd (int icut) const
 
const VectorDoublegetZcut () const
 
void calculateBenefitAndGrade ()
 
void dumpGini ()
 
void correctTonnageOrder ()
 
void defineRecoveries (const std::vector< ESelectivity > &codes, bool flag_est, bool flag_std, double proba=TEST, bool verbose=false)
 
bool isUsed (const ESelectivity &code) const
 
bool isUsedEst (const ESelectivity &code) const
 
bool isUsedStD (const ESelectivity &code) const
 
bool isNeededT () const
 
bool isNeededQ () const
 
int getAddressQTEst (const ESelectivity &code, int iptr0, int rank=0) const
 
int getAddressQTStd (const ESelectivity &code, int iptr0, int rank=0) const
 
int getNumberQTEst (const ESelectivity &code) const
 
int getNumberQTStd (const ESelectivity &code) const
 
const VectorInt getNumberQTEst () const
 
const VectorInt getNumberQTStd () const
 
void storeInDb (Db *db, int iech0, int iptr, double zestim, double zstdev)
 
void interpolateSelectivity (const Selectivity *selecin)
 
void setFlagTonnageCorrect (bool flagTonnageCorrect)
 
void setZmax (double zmax)
 
bool isFlagTonnageCorrect () const
 
double getZmax () const
 
bool isOnlyZDefined () const
 
const Table getStats () const
 
const Table getAllStats () const
 
const MatrixIntgetNumberQt () const
 
const MatrixIntgetRankQt () 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
 

Static Public Member Functions

static Selectivitycreate (int ncut)
 
static SelectivitycreateByCuts (const VectorDouble &zcut)
 
static SelectivitycreateByCodes (const std::vector< ESelectivity > &codes, const VectorDouble &zcuts=VectorDouble(), bool flag_est=true, bool flag_std=true, double proba=TEST, bool verbose=false)
 
static SelectivitycreateByKeys (const VectorString &keys, const VectorDouble &zcuts=VectorDouble(), bool flag_est=true, bool flag_std=true, double zmax=TEST, bool flag_correct=false, double proba=TEST, bool verbose=false)
 
static SelectivitycreateInterpolation (const VectorDouble &zcuts, const Selectivity &selecin, bool verbose)
 

Private Member Functions

VectorString _getAllNames () const
 
void _printQTvars (const char *title, int type, int number) const
 
void _defineVariableRanks ()
 
bool _isRecoveryDefined () const
 
bool _isValidCut (int icut) const
 
void _interpolateInterval (double zval, double zi0, double zi1, double ti0, double ti1, double qi0, double qi1, double *tval, double *qval, double tol=EPSILON3)
 
void _concatenate (VectorString &names, const ESelectivity &code, int mode) const
 
bool _isMultiplied (const ESelectivity &code) const
 
void _defineAutomaticCutoffs (const VectorDouble &tab, double eps=EPSILON3)
 

Private Attributes

VectorDouble _Zcut
 
Table _stats
 
double _zmax
 
double _proba
 
bool _flagTonnageCorrect
 
MatrixInt _numberQT
 
MatrixInt _rankQT
 
bool _flagOnlyZDefined
 

Constructor & Destructor Documentation

◆ Selectivity() [1/3]

Selectivity::Selectivity ( int  ncut = 0)

◆ Selectivity() [2/3]

Selectivity::Selectivity ( const VectorDouble zcuts,
double  zmax = TEST,
double  proba = TEST,
bool  flag_tonnage_correct = false 
)

◆ Selectivity() [3/3]

Selectivity::Selectivity ( const Selectivity m)

◆ ~Selectivity()

Selectivity::~Selectivity ( )
virtual

Member Function Documentation

◆ _concatenate()

void Selectivity::_concatenate ( VectorString names,
const ESelectivity &  code,
int  mode 
) const
private

◆ _defineAutomaticCutoffs()

void Selectivity::_defineAutomaticCutoffs ( const VectorDouble tab,
double  eps = EPSILON3 
)
private

◆ _defineVariableRanks()

void Selectivity::_defineVariableRanks ( )
private

◆ _getAllNames()

VectorString Selectivity::_getAllNames ( ) const
private

◆ _interpolateInterval()

void Selectivity::_interpolateInterval ( double  zval,
double  zi0,
double  zi1,
double  ti0,
double  ti1,
double  qi0,
double  qi1,
double *  tval,
double *  qval,
double  tol = EPSILON3 
)
private

Interpolate the QT within an interval

Parameters
[in]zvalCutoff value
[in]zi0Lower cutoff of the interval
[in]zi1Upper cutoff of the interval
[in]ti0Lower tonnage of the interval
[in]ti1Upper tonnage of the interval
[in]qi0Lower metal quantity of the interval
[in]qi1Upper metal quantity of the interval
[in]tolTolerance
[out]tvalTonnage for the current cutoff
[out]qvalMetal quantity for the current cutoff

◆ _isMultiplied()

bool Selectivity::_isMultiplied ( const ESelectivity &  code) const
private

◆ _isRecoveryDefined()

bool Selectivity::_isRecoveryDefined ( ) const
private

◆ _isValidCut()

bool Selectivity::_isValidCut ( int  icut) const
private

◆ _printQTvars()

void Selectivity::_printQTvars ( const char *  title,
int  type,
int  number 
) const
private

Print the contents of the qtvars structure

Parameters
[in]titleTitle
[in]type1 for estimation; 2 for stdev
[in]numberNumber of cutoffs

◆ calculateBenefitAndGrade()

void Selectivity::calculateBenefitAndGrade ( )

From the cutoff, tonnage and metal quantity, derive the conventional benefit and the average recovered grade

◆ calculateFromAnamorphosis()

int Selectivity::calculateFromAnamorphosis ( AAnam anam)

◆ calculateFromArray()

int Selectivity::calculateFromArray ( const VectorDouble tab,
const VectorDouble weights = VectorDouble(),
bool  autoCuts = false 
)

◆ calculateFromDb()

int Selectivity::calculateFromDb ( const Db db,
bool  autoCuts = false 
)

◆ correctTonnageOrder()

void Selectivity::correctTonnageOrder ( )

Correct the order relationship for Tonnage

◆ create()

Selectivity * Selectivity::create ( int  ncut)
static

◆ createByCodes()

Selectivity * Selectivity::createByCodes ( const std::vector< ESelectivity > &  codes,
const VectorDouble zcuts = VectorDouble(),
bool  flag_est = true,
bool  flag_std = true,
double  proba = TEST,
bool  verbose = false 
)
static

◆ createByCuts()

Selectivity * Selectivity::createByCuts ( const VectorDouble zcut)
static

◆ createByKeys()

Selectivity * Selectivity::createByKeys ( const VectorString keys,
const VectorDouble zcuts = VectorDouble(),
bool  flag_est = true,
bool  flag_std = true,
double  zmax = TEST,
bool  flag_correct = false,
double  proba = TEST,
bool  verbose = false 
)
static

◆ createInterpolation()

Selectivity * Selectivity::createInterpolation ( const VectorDouble zcuts,
const Selectivity selecin,
bool  verbose 
)
static

Interpolate the Grade-Tonnage curves

Parameters
[in]zcutsArray of cutoffs
[in]selecinInput Selectivity
[in]verboseVerbose flag

◆ defineRecoveries()

void Selectivity::defineRecoveries ( const std::vector< ESelectivity > &  codes,
bool  flag_est,
bool  flag_std,
double  proba = TEST,
bool  verbose = false 
)

Analyze the contents of the codes

Parameters
[in]codesArray of selectivity codes
[in]flag_estTrue for estimation
[in]flag_stdTrue for st. dev.
[in]probaProbability value (or TEST)
[in]verboseVerbose flag

◆ dumpGini()

void Selectivity::dumpGini ( )

Calculate and print the Gini index

◆ eval()

const Table Selectivity::eval ( const Db db,
bool  autoCuts = false 
)

◆ evalFromAnamorphosis()

const Table Selectivity::evalFromAnamorphosis ( AAnam anam)

◆ evalFromArray()

const Table Selectivity::evalFromArray ( const VectorDouble tab,
const VectorDouble weights = VectorDouble(),
bool  autoCuts = false 
)

◆ getAddressQTEst()

int Selectivity::getAddressQTEst ( const ESelectivity &  code,
int  iptr0,
int  rank = 0 
) const

◆ getAddressQTStd()

int Selectivity::getAddressQTStd ( const ESelectivity &  code,
int  iptr0,
int  rank = 0 
) const

◆ getAllStats()

const Table Selectivity::getAllStats ( ) const
inline

◆ getBest()

double Selectivity::getBest ( int  icut) const

◆ getMest()

double Selectivity::getMest ( int  icut) const

◆ getNCuts()

int Selectivity::getNCuts ( ) const
inline

◆ getNQT()

int Selectivity::getNQT ( ) const
inline

◆ getNumberQt()

const MatrixInt& Selectivity::getNumberQt ( ) const
inline

◆ getNumberQTEst() [1/2]

const VectorInt Selectivity::getNumberQTEst ( ) const

◆ getNumberQTEst() [2/2]

int Selectivity::getNumberQTEst ( const ESelectivity &  code) const

◆ getNumberQTStd() [1/2]

const VectorInt Selectivity::getNumberQTStd ( ) const

◆ getNumberQTStd() [2/2]

int Selectivity::getNumberQTStd ( const ESelectivity &  code) const

◆ getQest()

double Selectivity::getQest ( int  icut) const

◆ getQstd()

double Selectivity::getQstd ( int  icut) const

◆ getRankQt()

const MatrixInt& Selectivity::getRankQt ( ) const
inline

◆ getStats()

const Table Selectivity::getStats ( ) const

◆ getTest()

double Selectivity::getTest ( int  icut) const

◆ getTstd()

double Selectivity::getTstd ( int  icut) const

◆ getVariableName() [1/2]

String Selectivity::getVariableName ( const ESelectivity &  code,
int  icut,
int  mode 
) const

◆ getVariableName() [2/2]

String Selectivity::getVariableName ( int  rank0) const

◆ getVariableNames()

VectorString Selectivity::getVariableNames ( ) const

◆ getVariableNumber()

int Selectivity::getVariableNumber ( ) const

◆ getZcut() [1/2]

const VectorDouble& Selectivity::getZcut ( ) const
inline

◆ getZcut() [2/2]

double Selectivity::getZcut ( int  icut) const

◆ getZmax()

double Selectivity::getZmax ( ) const
inline

◆ interpolateSelectivity()

void Selectivity::interpolateSelectivity ( const Selectivity selecin)

Interpolate the QT curves (Local estimation)

Parameters
[in]selecinSelectivity

◆ isFlagTonnageCorrect()

bool Selectivity::isFlagTonnageCorrect ( ) const
inline

◆ isNeededQ()

bool Selectivity::isNeededQ ( ) const

◆ isNeededT()

bool Selectivity::isNeededT ( ) const

◆ isOnlyZDefined()

bool Selectivity::isOnlyZDefined ( ) const
inline

◆ isUsed()

bool Selectivity::isUsed ( const ESelectivity &  code) const

◆ isUsedEst()

bool Selectivity::isUsedEst ( const ESelectivity &  code) const

◆ isUsedStD()

bool Selectivity::isUsedStD ( const ESelectivity &  code) const

◆ operator=()

Selectivity & Selectivity::operator= ( const Selectivity m)

◆ resetCuts()

void Selectivity::resetCuts ( const VectorDouble zcuts)

◆ setBest()

void Selectivity::setBest ( int  icut,
double  best 
)

◆ setFlagTonnageCorrect()

void Selectivity::setFlagTonnageCorrect ( bool  flagTonnageCorrect)
inline

◆ setMest()

void Selectivity::setMest ( int  icut,
double  mest 
)

◆ setQest()

void Selectivity::setQest ( int  icut,
double  qest 
)

◆ setQstd()

void Selectivity::setQstd ( int  icut,
double  qstd 
)

◆ setTest()

void Selectivity::setTest ( int  icut,
double  test 
)

◆ setTstd()

void Selectivity::setTstd ( int  icut,
double  tstd 
)

◆ setZcut()

void Selectivity::setZcut ( int  icut,
double  zcut 
)

◆ setZmax()

void Selectivity::setZmax ( double  zmax)
inline

◆ storeInDb()

void Selectivity::storeInDb ( Db db,
int  iech0,
int  iptr,
double  zestim,
double  zstdev 
)

Store the local results of the recovery

Parameters
[in]dbDb structure containing the factors (Z-locators)
[in]iech0Rank of the target sample
[in]iptrRank for storing the results
[in]zestimEstimated grade
[in]zstdevSt. dev.

◆ toString()

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

ICloneable interface.

AStringable Interface

Reimplemented from AStringable.

Member Data Documentation

◆ _flagOnlyZDefined

bool Selectivity::_flagOnlyZDefined
private

◆ _flagTonnageCorrect

bool Selectivity::_flagTonnageCorrect
private

◆ _numberQT

MatrixInt Selectivity::_numberQT
private

◆ _proba

double Selectivity::_proba
private

◆ _rankQT

MatrixInt Selectivity::_rankQT
private

◆ _stats

Table Selectivity::_stats
private

◆ _Zcut

VectorDouble Selectivity::_Zcut
private

◆ _zmax

double Selectivity::_zmax
private

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