gstlearn  0.3.3
CCC
Classical.hpp File Reference
#include "gstlearn_export.hpp"
#include "Enum/EStatOption.hpp"
#include "Matrix/MatrixSquareSymmetric.hpp"
#include "Basic/VectorNumT.hpp"
#include "Basic/NamingConvention.hpp"

Classes

struct  ResRegr
 

Functions

GSTLEARN_EXPORT VectorString statOptionToName (const std::vector< EStatOption > &opers)
 
GSTLEARN_EXPORT std::vector< EStatOption > KeysToStatOptions (const VectorString &opers)
 
GSTLEARN_EXPORT VectorDouble regrDeming (const VectorDouble &x, const VectorDouble &y, double delta=1)
 
GSTLEARN_EXPORT VectorDouble dbStatisticsMonoByUID (Db *db, const VectorInt &iuids, const std::vector< EStatOption > &opers=EStatOption::fromKeys({ "MEAN" }), bool flagIso=true, double proba=TEST, double vmin=TEST, double vmax=TEST)
 Compute several monovariate statistics (opers) on variables contained in a Db and produce the results in a convenient output format (Vector of values or Table). More...
 
GSTLEARN_EXPORT VectorDouble dbStatisticsMono (Db *db, const VectorString &names, const std::vector< EStatOption > &opers=EStatOption::fromKeys({"MEAN"}), bool flagIso=true, double proba=TEST, double vmin=TEST, double vmax=TEST)
 Compute several monovariate statistics (opers) on variables contained in a Db and produce the results in a convenient output format (Vector of values or Table). More...
 
GSTLEARN_EXPORT Table dbStatisticsMonoT (Db *db, const VectorString &names, const std::vector< EStatOption > &opers=EStatOption::fromKeys({ "MEAN" }), bool flagIso=true, double proba=TEST, double vmin=TEST, double vmax=TEST)
 Compute several monovariate statistics (opers) on variables contained in a Db and produce the results in a convenient output format (Vector of values or Table). More...
 
GSTLEARN_EXPORT VectorDouble dbStatisticsCorrelByUID (Db *db, const VectorInt &iuids, bool flagIso=true)
 Compute correlation matrix on variables contained in a Db and produce the results in a convenient output format (Vector or a Matrix). More...
 
GSTLEARN_EXPORT VectorDouble dbStatisticsCorrel (Db *db, const VectorString &names, bool flagIso=true)
 Compute correlation matrix on variables contained in a Db and produce the results in a convenient output format (Vector or a Matrix). More...
 
GSTLEARN_EXPORT MatrixSquareSymmetric dbStatisticsCorrelT (Db *db, const VectorString &names, bool flagIso=true)
 Compute correlation matrix on variables contained in a Db and produce the results in a convenient output format (Vector or a Matrix). More...
 
GSTLEARN_EXPORT void dbStatisticsPrintByUID (const Db *db, const VectorInt &iuids=VectorInt(), const std::vector< EStatOption > &opers=EStatOption::fromKeys({ "MEAN" }), bool flagIso=false, bool flagCorrel=false, const String &title=String(), const String &radix=String())
 Compute statistics on variables contained in a Db and print out the results. More...
 
GSTLEARN_EXPORT void dbStatisticsPrint (const Db *db, const VectorString &names, const std::vector< EStatOption > &opers=EStatOption::fromKeys({ "MEAN" }), bool flagIso=false, bool flagCorrel=false, const String &title=String(), const String &radix=String())
 Compute statistics on variables contained in a Db and print out the results. More...
 
GSTLEARN_EXPORT VectorDouble dbStatisticsMultiByColIdx (Db *db, const VectorInt &cols, const EStatOption &oper=EStatOption::MEAN, bool flagMono=true, bool verbose=false)
 Compute a Multivariate statistic on variables contained in a Db and return the results. More...
 
GSTLEARN_EXPORT VectorDouble dbStatisticsMulti (Db *db, const VectorString &names, const EStatOption &oper=EStatOption::MEAN, bool flagMono=true, bool verbose=false)
 Compute a Multivariate statistic on variables contained in a Db and return the results. More...
 
GSTLEARN_EXPORT Table dbStatisticsMultiT (Db *db, const VectorString &names, const EStatOption &oper=EStatOption::MEAN, bool flagMono=true, bool verbose=false)
 Compute a Multivariate statistic on variables contained in a Db and return the results. More...
 
GSTLEARN_EXPORT VectorDouble dbStatisticsPerCellByUID (Db *db, DbGrid *dbgrid, const EStatOption &oper, int iuid, int juid=-1, const VectorDouble &cuts=VectorDouble())
 Statistics of points per cell. More...
 
GSTLEARN_EXPORT VectorDouble dbStatisticsPerCell (Db *db, DbGrid *dbgrid, const EStatOption &oper, const String &name1, const String &name2=String(), const VectorDouble &cuts=VectorDouble())
 Statistics of points per cell. More...
 
GSTLEARN_EXPORT String statisticsMonoPrint (const VectorDouble &tab, const std::vector< EStatOption > &opers=EStatOption::fromKeys({"MEAN"}), const VectorString &names=VectorString(), const String &title="")
 
GSTLEARN_EXPORT String statisticsMultiPrint (const VectorDouble &cov, const VectorString &names=VectorString(), const String &title="")
 
GSTLEARN_EXPORT int statisticsProportion (DbGrid *dbin, DbGrid *dbout, int pos, int nfacies, int radius)
 
GSTLEARN_EXPORT int statisticsTransition (DbGrid *dbin, DbGrid *dbout, int pos, int nfacies, int radius, int orient)
 
GSTLEARN_EXPORT ResRegr regressionByUID (Db *db1, int icol0, const VectorInt &icols=VectorInt(), int mode=0, bool flagCste=false, Db *db2=nullptr, const Model *model=nullptr, bool verbose=false)
 
GSTLEARN_EXPORT ResRegr regression (Db *db1, const String &name0, const VectorString &names=VectorString(), int mode=0, bool flagCste=false, Db *db2=nullptr, const Model *model=nullptr, bool verbose=false)
 
GSTLEARN_EXPORT int regressionApply (Db *db1, int iptr0, const String &name0, const VectorString &names, int mode=0, bool flagCste=false, Db *db2=nullptr, const Model *model=nullptr)
 
GSTLEARN_EXPORT VectorDouble dbStatisticsFacies (Db *db)
 
GSTLEARN_EXPORT double dbStatisticsIndicator (Db *db)
 
GSTLEARN_EXPORT MatrixRectangularsphering (const AMatrix *X)
 
GSTLEARN_EXPORT void dbStatisticsVariables (Db *db, const VectorString &names, const std::vector< EStatOption > &opers, int iptr0, double proba=TEST, double vmin=TEST, double vmax=TEST)
 Store several statistics calculated on a set of variables of a Db and store them in this same Db in variables already created. These functions should not be used in Target Language. More...
 
GSTLEARN_EXPORT void dbStatisticsVariablesByUID (Db *db, const VectorInt &iuids, const std::vector< EStatOption > &opers, int iptr0, double probas=TEST, double vmin=TEST, double vmax=TEST)
 Store several statistics calculated on a set of variables of a Db and store them in this same Db in variables already created. These functions should not be used in Target Language. More...
 
GSTLEARN_EXPORT int dbStatisticsInGridToolByUID (Db *db, DbGrid *dbgrid, const VectorInt &iuids, const EStatOption &oper, int radius, int iptr0)
 
GSTLEARN_EXPORT int dbStatisticsInGridTool (Db *db, DbGrid *dbgrid, const VectorString &names, const EStatOption &oper, int radius, int iptr0)
 

Function Documentation

◆ dbStatisticsFacies()

GSTLEARN_EXPORT VectorDouble dbStatisticsFacies ( Db db)

Considering that the Unique variable is a Facies (positive integer) returns the vector of proportions

Returns
The vector of proportions per Facies
Parameters
[in]dbDb structure

◆ dbStatisticsIndicator()

GSTLEARN_EXPORT double dbStatisticsIndicator ( Db db)

Considering that the Unique variable is an Indicator (0 or 1) returns the proportion of 1

Returns
The vector of proportions per Facies
Parameters
[in]dbDb structure

◆ dbStatisticsInGridTool()

GSTLEARN_EXPORT int dbStatisticsInGridTool ( Db db,
DbGrid dbgrid,
const VectorString names,
const EStatOption &  oper,
int  radius,
int  iptr0 
)

Calculates the monovariate statistics within cells of a grid

Returns
Error return code
Parameters
[in]dbDb for the points
[in]dbgridDb for the grid
[in]namesVector of target variable names
[in]operA EStatOption item
[in]radiusNeighborhood radius
[in]iptr0Storage address (first variable)

◆ dbStatisticsInGridToolByUID()

GSTLEARN_EXPORT int dbStatisticsInGridToolByUID ( Db db,
DbGrid dbgrid,
const VectorInt iuids,
const EStatOption &  oper,
int  radius,
int  iptr0 
)

Calculates the monovariate statistics within cells of a grid

Returns
Error return code
Parameters
[in]dbDb for the points
[in]dbgridDb for the grid
[in]iuidsVector of UID for target variable
[in]operA EStatOption item
[in]radiusNeighborhood radius
[in]iptr0Storage address (first variable)

◆ KeysToStatOptions()

GSTLEARN_EXPORT std::vector<EStatOption> KeysToStatOptions ( const VectorString opers)

◆ regrDeming()

GSTLEARN_EXPORT VectorDouble regrDeming ( const VectorDouble x,
const VectorDouble y,
double  delta 
)

Calculate the coefficients of the Deming regression (with 2 variables)

Parameters
xVector for the first variable
yVector for the second variable
deltaratio of error variances (s_y^2 / s_x^2)
Returns
Vector of coefficients for the equation
y = beta[0] + beta[1] * x
Remarks
Both input vectors are assumed to contain valid values
From: https://en.wikipedia.org/wiki/Deming_regression

◆ regression()

GSTLEARN_EXPORT ResRegr regression ( Db db1,
const String name0,
const VectorString names = VectorString(),
int  mode = 0,
bool  flagCste = false,
Db db2 = nullptr,
const Model model = nullptr,
bool  verbose = false 
)

◆ regressionApply()

GSTLEARN_EXPORT int regressionApply ( Db db1,
int  iptr0,
const String name0,
const VectorString names,
int  mode,
bool  flagCste,
Db db2,
const Model model 
)

Evaluate the regression

Returns
Error return code
Parameters
[in,out]db1Db descriptor (for target variable)
[in]iptr0Storing address
[in]name0Name of the target variable
[in]namesVector of names of the explanatory variables
[in]modeType of calculation
  • 0 : standard multivariate case
  • 1 : using external drifts
  • 2 : using standard drift functions (mode==2)
[in]flagCsteThe constant is added as explanatory variable]
[in]db2Db descriptor (for auxiliary variables)
[in]modelModel structure (used for mode==2)
Remarks
The flag_mode indicates the type of regression calculation:
0 : V[icol] as a function of V[icols[i]]
1 : Z1 as a function of the different Fi's
The Db1 structure is modified: the column (iptr0) of the Db1
is added by this function; it contains the value
of the residuals at each datum (or TEST if the residual has not
been calculated).

◆ regressionByUID()

GSTLEARN_EXPORT ResRegr regressionByUID ( Db db1,
int  icol0,
const VectorInt icols,
int  mode,
bool  flagCste,
Db db2,
const Model model,
bool  verbose 
)

Evaluate the regression

Returns
Error return code
Parameters
[in,out]db1Db descriptor (for target variable)
[in]icol0Rank of the target variable
[in]icolsVector of ranks of the explanatory variables
[in]modeType of calculation
  • 0 : standard multivariate case
  • 1 : using external drifts
  • 2 : using standard drift functions (in 'model')
[in]flagCsteThe constant is added as explanatory variable
[in]db2Db descriptor (for auxiliary variables)
[in]modelModel (only used for Drift functions if mode==2)
[in]verboseVerbose option
Remarks
The flag_mode indicates the type of regression calculation:
0 : V[icol] as a function of V[icols[i]]
1 : Z1 as a function of the different Fi's

◆ sphering()

GSTLEARN_EXPORT MatrixRectangular* sphering ( const AMatrix X)

Sphering procedure

Parameters
XInput Data vector
Returns
The Sphering matrix (or nullptr if problem)
Remarks
When performing the (forward) sphering, you must perform the following operation
X <- prodMatrix(X, S)

◆ statisticsMonoPrint()

GSTLEARN_EXPORT String statisticsMonoPrint ( const VectorDouble stats,
const std::vector< EStatOption > &  opers,
const VectorString names,
const String title 
)

Print the monovariate statistics between different variables of a Db

Returns
Error Return code
Parameters
[in]statsArray of statistics (organized by variable)
[in]opersList of the operator ranks
[in]namesList of variables
[in]titleTitle for the printout (optional)

◆ statisticsMultiPrint()

GSTLEARN_EXPORT String statisticsMultiPrint ( const VectorDouble stats,
const VectorString names,
const String title 
)

Print the multivariate statistics between different variables of a Db

Returns
Error Return code
Parameters
[in]statsMatrix of variance-covariance
[in]namesVector of variable names
[in]titleTitle for the printout (optional)

◆ statisticsProportion()

GSTLEARN_EXPORT int statisticsProportion ( DbGrid dbin,
DbGrid dbout,
int  pos,
int  nfacies,
int  radius 
)

Calculates the "montee" from a grid into a 1-D grid

Returns
Error return code
Parameters
[in]dbinDb for the input grid
[in]dboutDb for the output grid
[in]posRank of the montee axis (starting from 0)
[in]nfaciesNumber of facies
[in]radiusRadius of the neighborhood

◆ statisticsTransition()

GSTLEARN_EXPORT int statisticsTransition ( DbGrid dbin,
DbGrid dbout,
int  pos,
int  nfacies,
int  radius,
int  orient 
)

Calculates the transition from a grid into a 1-D grid

Returns
Error return code
Parameters
[in]dbinDb for the input grid
[in]dboutDb for the output grid
[in]posRank of the montee axis (starting from 0)
[in]nfaciesNumber of facies
[in]radiusRadius of the neighborhood
[in]orientOrientation (+1 or -1)

◆ statOptionToName()

GSTLEARN_EXPORT VectorString statOptionToName ( const std::vector< EStatOption > &  opers)