#include "geoslib_f.h"
#include "geoslib_old_f.h"
#include "geoslib_f_private.h"
#include "geoslib_define.h"
#include "Enum/EAnam.hpp"
#include "Enum/ECalcMember.hpp"
#include "Polynomials/Hermite.hpp"
#include "Db/Db.hpp"
#include "Db/DbGrid.hpp"
#include "Db/DbStringFormat.hpp"
#include "Model/Model.hpp"
#include "Model/CovInternal.hpp"
#include "Neigh/NeighMoving.hpp"
#include "Neigh/NeighImage.hpp"
#include "Neigh/NeighUnique.hpp"
#include "Neigh/ANeigh.hpp"
#include "Anamorphosis/AnamDiscreteDD.hpp"
#include "Anamorphosis/AnamDiscreteIR.hpp"
#include "Anamorphosis/AnamHermite.hpp"
#include "Basic/String.hpp"
#include "Basic/NamingConvention.hpp"
#include "Basic/Utilities.hpp"
#include "Basic/Law.hpp"
#include "Basic/File.hpp"
#include "Basic/OptDbg.hpp"
#include "Basic/OptCustom.hpp"
#include "Covariances/CovContext.hpp"
#include "Drifts/DriftList.hpp"
#include "Estimation/KrigingSystem.hpp"
#include "Space/SpaceRN.hpp"
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
Classes | |
struct | Disc_Structure |
Functions | |
int | is_flag_data_disc_defined (void) |
void | set_DBIN (Db *dbin) |
void | set_DBOUT (Db *dbout) |
int | krige_koption_manage (int mode, int flag_check, const EKrigOpt &calcul, int flag_rand, const VectorInt &ndiscs) |
void | krige_lhs_print (int nech, int neq, int nred, int *flagloc, double *lhs) |
void | krige_rhs_print (int nvar, int nech, int neq, int nred, int *flag, double *rhs) |
void | krige_dual_print (int nech, int neq, int nred, int *flag, double *dual) |
int | _krigsim (Db *dbin, Db *dbout, const Model *model, ANeigh *neigh, bool flag_bayes, const VectorDouble &dmean, const MatrixSquareSymmetric &dcov, int icase, int nbsimu, bool flag_dgm) |
int | global_transitive (DbGrid *dbgrid, Model *model, int flag_verbose, int flag_regular, int ndisc, double *abundance, double *sse, double *cvtrans) |
int | anakexp_f (DbGrid *db, double *covdd, double *covd0, double top, double bot, int cov_radius, int neigh_radius, int flag_sym, int nfeq) |
int | anakexp_3D (DbGrid *db, double *cov_ref, int cov_radius, int neigh_ver, int neigh_hor, int flag_sym, Model *model, double nugget, int nfeq, int dbg_ix, int dbg_iy) |
int | bayes_simulate (Model *model, int nbsimu, const VectorDouble &rmean, const VectorDouble &rcov, VectorDouble &smean) |
int | krigsum (Db *dbin, Db *dbout, Model *model, ANeigh *neigh, bool flag_positive, const NamingConvention &namconv) |
int | st_krige_data (Db *db, Model *model, double beta, int nsize1, int *ranks1, int nsize2, int *ranks2, int *rother, int flag_abs, double *data_est, double *data_var) |
int | st_crit_global (Db *db, Model *model, int nsize1, int *ranks1, int *rother, double *crit) |
int | sampling_f (Db *db, Model *model, double beta, int method1, int nsize1_max, int nsize1, int *ranks1, int method2, int nsize2_max, int nsize2, int *ranks2, int verbose) |
int | krigsampling_f (Db *dbin, Db *dbout, Model *model, double beta, int nsize1, int *ranks1, int nsize2, int *ranks2, bool flag_std, int verbose) |
int | declustering (Db *dbin, Model *model, int method, ANeigh *neigh, DbGrid *dbgrid, const VectorDouble &radius, const VectorInt &ndiscs, int flag_sel, bool verbose) |
int | inhomogeneous_kriging (Db *dbdat, Db *dbsrc, Db *dbout, double power, int flag_source, Model *model_dat, Model *model_src) |
void | _image_smoother (DbGrid *dbgrid, const NeighImage *neigh, int type, double range, int iptr0) |
void _image_smoother | ( | DbGrid * | dbgrid, |
const NeighImage * | neigh, | ||
int | type, | ||
double | range, | ||
int | iptr0 | ||
) |
Smooth a regular grid
[in] | dbgrid | input and output Db grid structure |
[in] | neigh | Neigh structure |
[in] | type | 1 for Uniform; 2 for Gaussian |
[in] | range | Range (used for Gaussian only) |
[in] | iptr0 | Storage address |
int _krigsim | ( | Db * | dbin, |
Db * | dbout, | ||
const Model * | model, | ||
ANeigh * | neigh, | ||
bool | flag_bayes, | ||
const VectorDouble & | dmean, | ||
const MatrixSquareSymmetric & | dcov, | ||
int | icase, | ||
int | nbsimu, | ||
bool | flag_dgm | ||
) |
Conditioning Kriging
[in] | dbin | input Db structure |
[in] | dbout | output Db structure |
[in] | model | Model structure |
[in] | neigh | ANeigh structure |
[in] | flag_bayes | 1 if Bayes option is switched ON |
[in] | dmean | Array giving the prior means for the drift terms |
[in] | dcov | Array containing the prior covariance matrix for the drift terms |
[in] | icase | Case for PGS and GRF (or -1) |
[in] | nbsimu | Number of simulations |
[in] | flag_dgm | 1 if the DGM version of kriging should be used |
int anakexp_3D | ( | DbGrid * | db, |
double * | cov_ref, | ||
int | cov_radius, | ||
int | neigh_ver, | ||
int | neigh_hor, | ||
int | flag_sym, | ||
Model * | model, | ||
double | nugget, | ||
int | nfeq, | ||
int | dbg_ix, | ||
int | dbg_iy | ||
) |
Factorial Kriging analysis on a grid file using discretized covariances for the target variable. The discretized covariance of the total variable is calculated on the fly
[in] | db | input Db structure |
[in] | cov_ref | Array of discretized covariance for target variable |
[in] | cov_radius | Radius of the covariance array |
[in] | neigh_ver | Radius of the Neighborhood along Vertical |
[in] | neigh_hor | Radius of the Neighborhood along Horizontal |
[in] | flag_sym | 1 for symmetrized covariance |
[in] | model | Model structure (only used for horizontal) |
[in] | nugget | Additional Nugget Effect component |
[in] | nfeq | 0 or 1 drift function(s) |
[in] | dbg_ix | Rank of the trace along X for variogram debug |
[in] | dbg_iy | Rank of the trace along Y for variogram debug |
int anakexp_f | ( | DbGrid * | db, |
double * | covdd, | ||
double * | covd0, | ||
double | top, | ||
double | bot, | ||
int | cov_radius, | ||
int | neigh_radius, | ||
int | flag_sym, | ||
int | nfeq | ||
) |
Factorial Kriging analysis on a 1-D grid file using discretized covariances for total and partial variables
[in] | db | input Db structure |
[in] | covdd | Array of discretized cov. for total variable |
[in] | covd0 | Array of discretized cov. for partial variable |
[in] | top | Elevation of the Top variable |
[in] | bot | Elevation of the bottom variable |
[in] | cov_radius | Radius of the Covariance arrays |
[in] | neigh_radius | Radius of the Neighborhood |
[in] | flag_sym | 1 for symmetrized covariance |
[in] | nfeq | 0 or 1 drift function(s) |
int bayes_simulate | ( | Model * | model, |
int | nbsimu, | ||
const VectorDouble & | rmean, | ||
const VectorDouble & | rcov, | ||
VectorDouble & | smean | ||
) |
Simulate the drift coefficients from the posterior distributions
[in] | model | Model structure |
[in] | nbsimu | Number of simulation (0 for kriging) |
[in] | rmean | Array giving the posterior means for the drift terms |
[in] | rcov | Array containing the posterior covariance matrix for the drift terms |
[out] | smean | Array for simulated posterior mean for the drift means |
int declustering | ( | Db * | dbin, |
Model * | model, | ||
int | method, | ||
ANeigh * | neigh, | ||
DbGrid * | dbgrid, | ||
const VectorDouble & | radius, | ||
const VectorInt & | ndiscs, | ||
int | flag_sel, | ||
bool | verbose | ||
) |
Perform the Declustering task
[in] | dbin | input Db structure |
[in] | model | Model structure |
[in] | method | Method for declustering |
[in] | neigh | ANeigh structure |
[in] | dbgrid | Grid auxiliary Db structure |
[in] | radius | Array of neighborhood radius |
[in] | ndiscs | Array of discretization |
[in] | flag_sel | 1 to mask off samples with zero weight |
[in] | verbose | Verbose option |
int global_transitive | ( | DbGrid * | dbgrid, |
Model * | model, | ||
int | flag_verbose, | ||
int | flag_regular, | ||
int | ndisc, | ||
double * | abundance, | ||
double * | sse, | ||
double * | cvtrans | ||
) |
Estimation of the variance by transitive method
[in] | dbgrid | Db structure containing the dicretization grid |
[in] | model | Model structure |
[in] | flag_verbose | 1 for a verbose output |
[in] | flag_regular | 1 for regular; 0 for stratified |
[in] | ndisc | Number of Discretization steps |
[out] | abundance | Global estimated abundance |
[out] | sse | Global standard deviation |
[out] | cvtrans | CV transitive |
int inhomogeneous_kriging | ( | Db * | dbdat, |
Db * | dbsrc, | ||
Db * | dbout, | ||
double | power, | ||
int | flag_source, | ||
Model * | model_dat, | ||
Model * | model_src | ||
) |
Inhomogeneous Kriging with Sources
[in] | dbdat | Db structure containing Data |
[in] | dbsrc | Db structure containing Sources |
[in] | dbout | Output Db structure |
[in] | power | Power of the Distance decay |
[in] | flag_source | If the result is the source, rather than diffusion |
[in] | model_dat | Model structure for the data |
[in] | model_src | Model structure for the sources |
int is_flag_data_disc_defined | ( | void | ) |
void krige_dual_print | ( | int | nech, |
int | neq, | ||
int | nred, | ||
int * | flag, | ||
double * | dual | ||
) |
Print the Dual matrix
[in] | nech | Number of active points (optional) |
[in] | neq | Number of equations |
[in] | nred | Reduced number of equations |
[in] | flag | Flag array (optional) |
[in] | dual | Kriging Dual matrix |
int krige_koption_manage | ( | int | mode, |
int | flag_check, | ||
const EKrigOpt & | calcul, | ||
int | flag_rand, | ||
const VectorInt & | ndiscs | ||
) |
Management of Kriging option
[in] | mode | 1 for allocation; -1 for deallocation |
[in] | flag_check | 1 if the file should be checked |
[in] | calcul | Type of calculation (EKrigOpt) |
[in] | flag_rand | 0 if the second discretization is regular 1 if the second point must be randomized |
[in] | ndiscs | Discretization parameters (or NULL) |
void krige_lhs_print | ( | int | nech, |
int | neq, | ||
int | nred, | ||
int * | flagloc, | ||
double * | lhs | ||
) |
Print the L.H.S. matrix
[in] | nech | Number of active points (optional) |
[in] | neq | Number of equations |
[in] | nred | Reduced number of equations |
[in] | flagloc | Flag array (optional) |
[in] | lhs | Kriging L.H.S |
void krige_rhs_print | ( | int | nvar, |
int | nech, | ||
int | neq, | ||
int | nred, | ||
int * | flag, | ||
double * | rhs | ||
) |
Print the R.H.S. matrix
[in] | nvar | Number of variables |
[in] | nech | Number of active points (optional) |
[in] | neq | Number of equations |
[in] | nred | Reduced number of equations |
[in] | flag | Flag array (optional) |
[in] | rhs | Kriging R.H.S. matrix |
int krigsampling_f | ( | Db * | dbin, |
Db * | dbout, | ||
Model * | model, | ||
double | beta, | ||
int | nsize1, | ||
int * | ranks1, | ||
int | nsize2, | ||
int * | ranks2, | ||
bool | flag_std, | ||
int | verbose | ||
) |
Perform the Kriging procedure using the parcimonious search within the whole input data set
[in] | dbin | Input Db structure |
[in] | dbout | Output Db structure |
[in] | model | Model structure |
[in] | beta | Thresholding value |
[in] | nsize1 | Number of exact pivots currently selected |
[in] | ranks1 | Ranks of exact pivots |
[in] | nsize2 | Number of ACP pivots currently selected |
[in] | ranks2 | Ranks of ACP pivots |
[in] | flag_std | Option for storing the standard deviation |
[in] | verbose | Verbose flag |
int krigsum | ( | Db * | dbin, |
Db * | dbout, | ||
Model * | model, | ||
ANeigh * | neigh, | ||
bool | flag_positive, | ||
const NamingConvention & | namconv | ||
) |
Punctual Multivariate Kriging under a constraint
[in] | dbin | input Db structure |
[in] | dbout | output Db structure |
[in] | model | Model structure (univariate) |
[in] | neigh | ANeigh structure |
[in] | flag_positive | 1 for a positive constraints |
[in] | namconv | Naming convention |
int sampling_f | ( | Db * | db, |
Model * | model, | ||
double | beta, | ||
int | method1, | ||
int | nsize1_max, | ||
int | nsize1, | ||
int * | ranks1, | ||
int | method2, | ||
int | nsize2_max, | ||
int | nsize2, | ||
int * | ranks2, | ||
int | verbose | ||
) |
Optimize the sampling design
[in] | db | Db structure |
[in] | model | Model structure |
[in] | beta | Thresholding value |
[in] | method1 | Criterion for choosing exact pivots 1 : Local evaluation 2 : Global evaluation |
[in] | nsize1_max | Maximum number of exact pivots |
[in] | nsize1 | Number of exact pivots currently selected |
[in] | ranks1 | Ranks of exact pivots |
[in] | method2 | Criterion for choosing ACP pivots 1 : Local evaluation 2 : Global evaluation |
[in] | nsize2_max | Maximum number of ACP pivots |
[in] | nsize2 | Number of ACP pivots currently selected |
[in] | ranks2 | Ranks of ACP pivots |
[in] | verbose | 1 for a verbose output |
void set_DBIN | ( | Db * | dbin | ) |
void set_DBOUT | ( | Db * | dbout | ) |
int st_krige_data | ( | Db * | db, |
Model * | model, | ||
double | beta, | ||
int | nsize1, | ||
int * | ranks1, | ||
int | nsize2, | ||
int * | ranks2, | ||
int * | rother, | ||
int | flag_abs, | ||
double * | data_est, | ||
double * | data_var | ||
) |
Perform the estimation at the data points
[in] | db | Db structure |
[in] | model | Model structure |
[in] | beta | Thresholding value |
[in] | nsize1 | Number of exact pivots currently selected |
[in] | ranks1 | Ranks of exact pivots |
[in] | nsize2 | Number of ACP pivots currently selected |
[in] | ranks2 | Ranks of ACP pivots |
[in] | rother | Ranks of the idle samples |
[in] | flag_abs | 1 Modify 'daata_est' to store the estimation error |
[out] | data_est | Array of estimation at samples |
[out] | data_var | Array of estimation variance at samples |