#include "geoslib_enum.h"
#include "geoslib_f.h"
#include "geoslib_old_f.h"
#include "Drifts/DriftFactory.hpp"
#include "Drifts/DriftList.hpp"
#include "Drifts/ADrift.hpp"
#include "Basic/AException.hpp"
#include "Basic/Utilities.hpp"
#include "Basic/File.hpp"
#include "Covariances/CovLMC.hpp"
#include "Covariances/CovLMGradient.hpp"
#include "Covariances/CovLMCTapering.hpp"
#include "Covariances/CovLMCConvolution.hpp"
#include "Covariances/ACovAnisoList.hpp"
#include "Covariances/CovAniso.hpp"
#include "Covariances/CovCalcMode.hpp"
#include "Covariances/CovFactory.hpp"
#include "Covariances/CovGradientNumerical.hpp"
#include "Model/CovInternal.hpp"
#include "Model/Model.hpp"
#include "Model/NoStatArray.hpp"
#include "Anamorphosis/AnamHermite.hpp"
#include "Anamorphosis/AnamDiscreteDD.hpp"
#include "Anamorphosis/AnamDiscreteIR.hpp"
#include "Variogram/Vario.hpp"
#include "Space/SpaceRN.hpp"
#include "Basic/Law.hpp"
#include "Basic/String.hpp"
#include "Db/Db.hpp"
#include "Db/DbGrid.hpp"
#include "Matrix/MatrixSquareGeneral.hpp"
#include "Matrix/NF_Triplet.hpp"
#include <math.h>
Functions | |
void | model_nostat_update (CovInternal *covint, Model *model) |
void | model_covtab_init (int flag_init, Model *model, double *covtab) |
void | model_calcul_cov (CovInternal *covint, Model *model, const CovCalcMode *mode, int flag_init, double weight, VectorDouble d1, double *covtab) |
const CovInternal * | get_external_covariance () |
int | is_model_nostat_param (Model *model, const EConsElem &type0) |
int | model_add_cova (Model *model, const ECov &type, int flag_aniso, int flag_rotation, double range, double param, const VectorDouble &aniso_ranges, const VectorDouble &aniso_rotmat, const VectorDouble &sill, double) |
double | cova_get_scale_factor (const ECov &type, double param) |
int | model_update_coreg (Model *model, double *aic, double *valpro, double *vecpro) |
int | model_evaluate (Model *model, int ivar, int jvar, const CovCalcMode *mode, int nh, VectorDouble &codir, const double *h, double *g) |
int | model_evaluate_nostat (Model *model, int ivar, int jvar, const CovCalcMode *mode, Db *db1, int iech1, Db *db2, int iech2, int nh, VectorDouble &codir, double *h, double *g) |
int | model_grid (Model *model, Db *db, int ivar, int jvar, const CovCalcMode *mode, double *g) |
int | model_nfex (Model *model) |
double | model_cxx (Model *model, Db *db1, Db *db2, int ivar, int jvar, int seed, double eps, const CovCalcMode *mode) |
double * | model_covmat_by_ranks (Model *model, Db *db1, int nsize1, const int *ranks1, Db *db2, int nsize2, const int *ranks2, int ivar0, int jvar0, const CovCalcMode *mode) |
int | model_drift_mat (Model *model, const ECalcMember &member, Db *db, double *drfmat) |
int | model_drift_vector (Model *model, const ECalcMember &member, Db *db, int iech, double *vector) |
Model * | model_duplicate_for_gradient (const Model *model, double ball_radius) |
void | model_covupdt (Model *model, double *c0, int flag_verbose, int *flag_nugget, double *nugget) |
double | model_drift_evaluate (int, Model *model, const Db *db, int iech, int ivar, double *coef) |
void | model_cova_characteristics (const ECov &type, char cov_name[STRING_LENGTH], int *flag_range, int *flag_param, int *min_order, int *max_ndim, int *flag_int_1d, int *flag_int_2d, int *flag_aniso, int *flag_rotation, double *scale, double *parmax) |
int | model_sample (Vario *vario, Model *model, const CovCalcMode *mode) |
Model * | model_combine (const Model *model1, const Model *model2, double r) |
int | model_regularize (Model *model, Vario *vario, DbGrid *dbgrid, const CovCalcMode *mode) |
int | model_covmat_inchol (int verbose, Db *db, Model *model, double eta, int npivot_max, int nsize1, int *ranks1, double *center, int flag_sort, int *npivot_arg, int **Pret, double **Gret, const CovCalcMode *mode) |
double | model_calcul_stdev (Model *model, Db *db1, int iech1, Db *, int iech2, int verbose, double factor, const CovCalcMode *mode) |
MatrixSparse * | model_covmat_by_ranks_Mat (Model *model, Db *db1, int nsize1, const VectorInt &ranks1, Db *db2, int nsize2, const VectorInt &ranks2, int ivar0, int jvar0, const CovCalcMode *mode) |
int | model_covmat (Model *model, Db *db1, Db *db2, int ivar0, int jvar0, double *covmat, const CovCalcMode *mode) |
MatrixSquareSymmetric | model_covmatM (Model *model, Db *db1, Db *db2, int ivar0, int jvar0, const CovCalcMode *mode) |
Variables | |
int | NDIM_LOCAL = 0 |
VectorDouble | X1_LOCAL = VectorDouble() |
VectorDouble | X2_LOCAL = VectorDouble() |
double cova_get_scale_factor | ( | const ECov & | type, |
double | param | ||
) |
For a given basic structure, get the reduction factor to convert the theoretical to practical scale
[in] | type | Type of the basic structure |
[in] | param | Value of the third parameter |
const CovInternal* get_external_covariance | ( | ) |
Identify the coordinates of the two end-points (used by the external covariance function)
int is_model_nostat_param | ( | Model * | model, |
const EConsElem & | type0 | ||
) |
int model_add_cova | ( | Model * | model, |
const ECov & | type, | ||
int | flag_aniso, | ||
int | flag_rotation, | ||
double | range, | ||
double | param, | ||
const VectorDouble & | aniso_ranges, | ||
const VectorDouble & | aniso_rotmat, | ||
const VectorDouble & | sill, | ||
double | |||
) |
Add a basic covariance
[in] | model | Pointer to the Model structure |
[in] | type | Type of the basic structure |
[in] | flag_aniso | 1 if the basic structure is anisotropic |
[in] | flag_rotation | 1 if the basic structure is rotated (only when anisotropic) |
[in] | range | Isotropic range of the basic structure |
[in] | param | Auxiliary parameter |
[in] | aniso_ranges | Array giving the anisotropy ranges Only used when flag_aniso (Dimension = ndim) |
[in] | aniso_rotmat | Anisotropy rotation matrix Only used when flag_aniso && flag_rotation (Dimension = ndim * ndim) |
[in] | sill | Sill matrix (optional) (Dimension = nvar * nvar) |
void model_calcul_cov | ( | CovInternal * | covint, |
Model * | model, | ||
const CovCalcMode * | mode, | ||
int | flag_init, | ||
double | weight, | ||
VectorDouble | d1, | ||
double * | covtab | ||
) |
Returns the covariances for an increment This is the generic internal function It can be called for stationary or non-stationary case
[in] | covint | Internal structure for non-stationarityAddress for the next term after the drift or NULL (for stationary case) |
[in] | model | Model structure |
[in] | mode | CovCalcMode structure |
[in] | flag_init | Initialize the array beforehand |
[in] | weight | Multiplicative weight |
[out] | d1 | Working array (dimension = ndim) or NULL |
[out] | covtab | output covariance (dimension = nvar * nvar) |
double model_calcul_stdev | ( | Model * | model, |
Db * | db1, | ||
int | iech1, | ||
Db * | , | ||
int | iech2, | ||
int | verbose, | ||
double | factor, | ||
const CovCalcMode * | mode | ||
) |
Returns the standard deviation at a given increment for a given model
[in] | model | Structure containing the model |
[in] | db1 | First Db |
[in] | iech1 | Rank in the first Db |
[in] | iech2 | Rank in the second Db |
[in] | verbose | Verbose flag |
[in] | factor | Multiplicative factor for standard deviation |
[in] | mode | CovCalcMode structure |
Combine two monovariate models into a bivariate model (residuals model)
void model_cova_characteristics | ( | const ECov & | type, |
char | cov_name[STRING_LENGTH], | ||
int * | flag_range, | ||
int * | flag_param, | ||
int * | min_order, | ||
int * | max_ndim, | ||
int * | flag_int_1d, | ||
int * | flag_int_2d, | ||
int * | flag_aniso, | ||
int * | flag_rotation, | ||
double * | scale, | ||
double * | parmax | ||
) |
Returns the characteristics of the covariance
[in] | type | Type of the covariance |
[out] | cov_name | Name of the covariance |
[out] | flag_range | range definition
|
[out] | flag_param | 1 if the third parameter is defined |
[out] | min_order | Minimum IRF order for validity |
[out] | max_ndim | Maximum dimension for validity |
[out] | flag_int_1d | Integral range in 1-D |
[out] | flag_int_2d | Integral range in 2-D |
[out] | flag_aniso | 1 if anisotropy is meaningful |
[out] | flag_rotation | 1 if an anisotropy rotation is meaningful |
[out] | scale | Scaling parameter |
[out] | parmax | Maximum value for the third parameter |
int model_covmat | ( | Model * | model, |
Db * | db1, | ||
Db * | db2, | ||
int | ivar0, | ||
int | jvar0, | ||
double * | covmat, | ||
const CovCalcMode * | mode | ||
) |
Establish the covariance matrix between two Dbs
[in] | model | Model structure |
[in] | db1 | First Db |
[in] | db2 | Second Db |
[in] | ivar0 | Rank of the first variable (-1: all variables) |
[in] | jvar0 | Rank of the second variable (-1: all variables) |
[in] | mode | CovCalcMode structure |
[out] | covmat | The covariance matrix (Dimension = (nactive * nvar) [squared]) nactive: Number of samples active nvar : Number of selected variables (1 or nvar) |
double* model_covmat_by_ranks | ( | Model * | model, |
Db * | db1, | ||
int | nsize1, | ||
const int * | ranks1, | ||
Db * | db2, | ||
int | nsize2, | ||
const int * | ranks2, | ||
int | ivar0, | ||
int | jvar0, | ||
const CovCalcMode * | mode | ||
) |
Establish the covariance matrix between two Dbs where samples are selected by ranks
[in] | model | Model structure |
[in] | db1 | First Db |
[in] | nsize1 | Number of selected samples |
[in] | ranks1 | Array giving ranks of selected samples (optional) |
[in] | db2 | Second Db |
[in] | nsize2 | Number of selected samples |
[in] | ranks2 | Array giving ranks of selected samples (optional) |
[in] | ivar0 | Rank of the first variable (-1: all variables) |
[in] | jvar0 | Rank of the second variable (-1: all variables) |
[in] | mode | CovCalcMode structure |
MatrixSparse* model_covmat_by_ranks_Mat | ( | Model * | model, |
Db * | db1, | ||
int | nsize1, | ||
const VectorInt & | ranks1, | ||
Db * | db2, | ||
int | nsize2, | ||
const VectorInt & | ranks2, | ||
int | ivar0, | ||
int | jvar0, | ||
const CovCalcMode * | mode | ||
) |
Establish the covariance matrix between two Dbs where samples are selected by ranks The output is stored in a Sparse Matrix
[in] | model | Model structure |
[in] | db1 | First Db |
[in] | nsize1 | Number of selected samples |
[in] | ranks1 | Array giving ranks of selected samples (optional) |
[in] | db2 | Second Db |
[in] | nsize2 | Number of selected samples |
[in] | ranks2 | Array giving ranks of selected samples (optional) |
[in] | ivar0 | Rank of the first variable (-1: all variables) |
[in] | jvar0 | Rank of the second variable (-1: all variables) |
[in] | mode | CovCalcMode structure |
int model_covmat_inchol | ( | int | verbose, |
Db * | db, | ||
Model * | model, | ||
double | eta, | ||
int | npivot_max, | ||
int | nsize1, | ||
int * | ranks1, | ||
double * | center, | ||
int | flag_sort, | ||
int * | npivot_arg, | ||
int ** | Pret, | ||
double ** | Gret, | ||
const CovCalcMode * | mode | ||
) |
Establish and invert a covariance matrix using Incomplete Cholesky method
[in] | verbose | Verbose option |
[in] | db | Db structure |
[in] | model | Model structure |
[in] | npivot_max | Maximum number of pivots (or 0) |
[in] | eta | Precision (or TEST) |
[in] | nsize1 | Number of pivots already selected |
[in] | ranks1 | Ranks of pivots already selected |
[in] | center | Optional Centering point (for increments) |
[in] | flag_sort | Reordering flag (see remarks) |
[in] | mode | CovCalcMode structure |
[out] | npivot_arg | Number of pivots |
[out] | Pret | Array of indices of the retained samples (from 1) Dimension: nech |
[out] | Gret | Rectangular matrix Dimension: nech * npivot_arg |
MatrixSquareSymmetric model_covmatM | ( | Model * | model, |
Db * | db1, | ||
Db * | db2, | ||
int | ivar0, | ||
int | jvar0, | ||
const CovCalcMode * | mode | ||
) |
void model_covtab_init | ( | int | flag_init, |
Model * | model, | ||
double * | covtab | ||
) |
void model_covupdt | ( | Model * | model, |
double * | c0, | ||
int | flag_verbose, | ||
int * | flag_nugget, | ||
double * | nugget | ||
) |
double model_cxx | ( | Model * | model, |
Db * | db1, | ||
Db * | db2, | ||
int | ivar, | ||
int | jvar, | ||
int | seed, | ||
double | eps, | ||
const CovCalcMode * | mode | ||
) |
Evaluate the average model between two Dbs
[in] | model | Model structure |
[in] | db1 | First Db |
[in] | db2 | Second Db |
[in] | ivar | Rank of the first variable |
[in] | jvar | Rank of the second variable |
[in] | seed | Seed for the random number generator |
[in] | eps | Epsilon used for randomization in calculation of CVV |
[in] | mode | CovCalcMode structure |
int model_evaluate | ( | Model * | model, |
int | ivar, | ||
int | jvar, | ||
const CovCalcMode * | mode, | ||
int | nh, | ||
VectorDouble & | codir, | ||
const double * | h, | ||
double * | g | ||
) |
Calculate the value of the model for a set of distances
[in] | model | Model structure |
[in] | ivar | Rank of the first variable |
[in] | jvar | Rank of the second variable |
[in] | mode | CovCalcMode structure |
[in] | nh | Number of increments |
[in] | codir | Array giving the direction coefficients |
[in] | h | Vector of increments |
[out] | g | Array containing the model values |
int model_evaluate_nostat | ( | Model * | model, |
int | ivar, | ||
int | jvar, | ||
const CovCalcMode * | mode, | ||
Db * | db1, | ||
int | iech1, | ||
Db * | db2, | ||
int | iech2, | ||
int | nh, | ||
VectorDouble & | codir, | ||
double * | h, | ||
double * | g | ||
) |
Calculate the value of the model for a set of distances (non stationary)
[in] | model | Model structure |
[in] | ivar | Rank of the first variable |
[in] | jvar | Rank of the second variable |
[in] | mode | CovCalcMode structure |
[in] | db1 | First Db structure |
[in] | iech1 | First sample |
[in] | db2 | Second Db structure |
[in] | iech2 | Second sample |
[in] | nh | Number of increments |
[in] | codir | Array giving the direction coefficients |
[in] | h | Vector of increments |
[out] | g | Array containing the model values |
int model_grid | ( | Model * | model, |
Db * | db, | ||
int | ivar, | ||
int | jvar, | ||
const CovCalcMode * | mode, | ||
double * | g | ||
) |
Evaluate the model on a regular grid
[in] | model | Model structure |
[in] | db | Db structure |
[in] | ivar | Rank of the first variable |
[in] | jvar | Rank of the second variable |
[in] | mode | CovCalcMode structure |
[out] | g | Array containing the model values |
int model_nfex | ( | Model * | model | ) |
Returns the number of external drift functions
[in] | model | Model structure |
void model_nostat_update | ( | CovInternal * | covint, |
Model * | model | ||
) |
int model_regularize | ( | Model * | model, |
Vario * | vario, | ||
DbGrid * | dbgrid, | ||
const CovCalcMode * | mode | ||
) |
Calculate the regularized model as an experimental variogram
[in] | model | Model structure |
[in] | vario | Vario structure |
[in] | dbgrid | Db discretization grid structure |
[in] | mode | CovCalcMode structure |
int model_sample | ( | Vario * | vario, |
Model * | model, | ||
const CovCalcMode * | mode | ||
) |
Calculates variogram values by sampling a model
[in] | vario | Vario structure |
[in] | model | Model structure |
[in] | mode | CovCalcMode structure |
int model_update_coreg | ( | Model * | model, |
double * | aic, | ||
double * | valpro, | ||
double * | vecpro | ||
) |
Calculate the linear model of coregionalization starting from the coregionalization matrix
[in] | model | Model structure |
[out] | aic | array of 'aic' values |
[out] | valpro | array of eigen values |
[out] | vecpro | array of eigen vectors |
int NDIM_LOCAL = 0 |
VectorDouble X1_LOCAL = VectorDouble() |
VectorDouble X2_LOCAL = VectorDouble() |