#include "gstlearn_export.hpp"
#include "geoslib_define.h"
#include "Basic/VectorNumT.hpp"
#include "Matrix/MatrixSquareGeneral.hpp"
#include "Enum/EOperator.hpp"
#include <map>
#include <cmath>
#include <math.h>
Classes | |
struct | StatResults |
Macros | |
#define | DOUBLE_NA TEST |
#define | INT_NA ITEST |
#define | STRING_NA "NA" |
#define | FLOAT_NA static_cast<float>(TEST) |
Typedefs | |
typedef double(* | operate_function) (double) |
Functions | |
GSTLEARN_EXPORT bool | isInteger (double value, double eps=EPSILON10) |
GSTLEARN_EXPORT int | getClosestInteger (double value) |
GSTLEARN_EXPORT bool | isMultiple (int nbig, int nsmall) |
GSTLEARN_EXPORT bool | isOdd (int number) |
GSTLEARN_EXPORT bool | isEven (int number) |
GSTLEARN_EXPORT bool | isZero (double value, double eps=EPSILON10) |
GSTLEARN_EXPORT bool | isOne (double value, double eps=EPSILON10) |
GSTLEARN_EXPORT bool | areEqual (double v1, double v2, double eps=EPSILON10) |
GSTLEARN_EXPORT double | getMin (double val1, double val2) |
GSTLEARN_EXPORT double | getMax (double val1, double val2) |
GSTLEARN_EXPORT double | ut_deg2rad (double angle) |
GSTLEARN_EXPORT double | ut_rad2deg (double angle) |
GSTLEARN_EXPORT bool | FFFF (double value) |
GSTLEARN_EXPORT bool | IFFFF (int value) |
GSTLEARN_EXPORT double | getTEST () |
GSTLEARN_EXPORT int | getITEST () |
template<typename T > | |
T | getNA () |
template<> | |
double | getNA () |
template<typename T > | |
bool | isNA (const T &v) |
template<> | |
bool | isNA (const double &v) |
template<> | |
bool | isNA (const int &v) |
template<> | |
bool | isNA (const String &v) |
template<> | |
bool | isNA (const float &v) |
GSTLEARN_EXPORT void | ut_sort_double (int safe, int nech, int *ind, double *value) |
GSTLEARN_EXPORT StatResults | ut_statistics (int nech, const double *tab, const double *sel=nullptr, const double *wgt=nullptr) |
GSTLEARN_EXPORT void | ut_stats_mima_print (const char *title, int nech, double *tab, double *sel) |
GSTLEARN_EXPORT void | ut_facies_statistics (int nech, double *tab, double *sel, int *nval, int *mini, int *maxi) |
GSTLEARN_EXPORT void | ut_classify (int nech, const double *tab, double *sel, int nclass, double start, double pas, int *nmask, int *ntest, int *nout, int *classe) |
GSTLEARN_EXPORT double | ut_median (double *tab, int ntab) |
GSTLEARN_EXPORT double | ut_cnp (int n, int k) |
GSTLEARN_EXPORT MatrixSquareGeneral | ut_pascal (int ndim) |
GSTLEARN_EXPORT int * | ut_combinations (int n, int maxk, int *ncomb) |
GSTLEARN_EXPORT void | ut_shuffle_array (int nrow, int ncol, double *tab) |
GSTLEARN_EXPORT VectorInt | getListActiveToAbsolute (const VectorDouble &sel) |
GSTLEARN_EXPORT std::map< int, int > | getMapAbsoluteToRelative (const VectorDouble &sel, bool verbose=false) |
GSTLEARN_EXPORT int | getRankMapAbsoluteToRelative (const std::map< int, int > &map, int iabs) |
GSTLEARN_EXPORT int | getRankMapRelativeToAbsolute (const std::map< int, int > &map, int irel) |
GSTLEARN_EXPORT operate_function | operate_Identify (int oper) |
GSTLEARN_EXPORT double | operate_Identity (double x) |
GSTLEARN_EXPORT double | operate_Inverse (double x) |
GSTLEARN_EXPORT double | operate_Square (double x) |
GSTLEARN_EXPORT double | operate_InverseSquare (double x) |
GSTLEARN_EXPORT double | operate_Sqrt (double x) |
GSTLEARN_EXPORT double | operate_InverseSqrt (double x) |
GSTLEARN_EXPORT double | modifyOperator (const EOperator &oper, double oldval, double value) |
GSTLEARN_EXPORT double | roundZero (double value, double eps=EPSILON6) |
GSTLEARN_EXPORT double | truncateDecimals (double value, int ndec=0) |
GSTLEARN_EXPORT double | truncateDigits (double value, int ndigits) |
GSTLEARN_EXPORT void | setInternalDebug (bool status) |
GSTLEARN_EXPORT bool | isInternalDebug () |
GSTLEARN_EXPORT void | print_range (const char *title, int ntab, const double *tab, const double *sel) |
GSTLEARN_EXPORT void | convertIndptrToIndices (int ncumul, const int *cumul, int *tab) |
TODO: transfer this in swig_inc.i. More... | |
#define DOUBLE_NA TEST |
#define FLOAT_NA static_cast<float>(TEST) |
#define INT_NA ITEST |
#define STRING_NA "NA" |
typedef double(* operate_function) (double) |
GSTLEARN_EXPORT bool areEqual | ( | double | v1, |
double | v2, | ||
double | eps = EPSILON10 |
||
) |
GSTLEARN_EXPORT void convertIndptrToIndices | ( | int | ncumul, |
const int * | cumul, | ||
int * | tab | ||
) |
TODO: transfer this in swig_inc.i.
GSTLEARN_EXPORT bool FFFF | ( | double | value | ) |
Checks if a double value is TEST
[in] | value | Value to be tested |
GSTLEARN_EXPORT int getClosestInteger | ( | double | value | ) |
GSTLEARN_EXPORT int getITEST | ( | ) |
GSTLEARN_EXPORT VectorInt getListActiveToAbsolute | ( | const VectorDouble & | sel | ) |
Returns the list of absolute indices for the only active samples A sample is active if its 'sel' value is equal to 1
sel | Vector giving the status of all samples (Dimension: absolute) |
GSTLEARN_EXPORT std::map<int, int> getMapAbsoluteToRelative | ( | const VectorDouble & | sel, |
bool | verbose | ||
) |
Returns the map such that MAP[iabs] = iact. A sample is active if its 'sel' value is equal to 1
sel | Vector giving the status of all samples (Dimension: absolute) |
verbose | Verbose flag |
GSTLEARN_EXPORT double getMax | ( | double | val1, |
double | val2 | ||
) |
GSTLEARN_EXPORT double getMin | ( | double | val1, |
double | val2 | ||
) |
|
inline |
|
inline |
GSTLEARN_EXPORT int getRankMapAbsoluteToRelative | ( | const std::map< int, int > & | map, |
int | iabs | ||
) |
Returns the rank of the relative grid node from its absolute index using the Map
map | The <int,int> map |
iabs | Absolute rank of the grid node |
GSTLEARN_EXPORT int getRankMapRelativeToAbsolute | ( | const std::map< int, int > & | map, |
int | irel | ||
) |
GSTLEARN_EXPORT double getTEST | ( | ) |
GSTLEARN_EXPORT bool IFFFF | ( | int | value | ) |
Checks if an integer value is TEST
[in] | value | Value to be tested |
GSTLEARN_EXPORT bool isEven | ( | int | number | ) |
GSTLEARN_EXPORT bool isInteger | ( | double | value, |
double | eps = EPSILON10 |
||
) |
GSTLEARN_EXPORT bool isInternalDebug | ( | ) |
GSTLEARN_EXPORT bool isMultiple | ( | int | nbig, |
int | nsmall | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
GSTLEARN_EXPORT bool isOdd | ( | int | number | ) |
GSTLEARN_EXPORT bool isOne | ( | double | value, |
double | eps = EPSILON10 |
||
) |
GSTLEARN_EXPORT bool isZero | ( | double | value, |
double | eps = EPSILON10 |
||
) |
GSTLEARN_EXPORT double modifyOperator | ( | const EOperator & | oper, |
double | oldval, | ||
double | value | ||
) |
Update an Old by a New value according to 'oper'
oper | A keywork of EOperator enum |
oldval | Old value |
value | New value |
GSTLEARN_EXPORT operate_function operate_Identify | ( | int | oper | ) |
Identify the pointer to a function with following functionality: y = f(x)
oper | Gives the type of operation to be performed 1: returns the value itslef (no change) -1: returns its inverse 2: returns the squared value -2: returns the inverse of the squared value 3: returns its square root -3: returns the inverse of the square root |
GSTLEARN_EXPORT double operate_Identity | ( | double | x | ) |
GSTLEARN_EXPORT double operate_Inverse | ( | double | x | ) |
GSTLEARN_EXPORT double operate_InverseSqrt | ( | double | x | ) |
GSTLEARN_EXPORT double operate_InverseSquare | ( | double | x | ) |
GSTLEARN_EXPORT double operate_Sqrt | ( | double | x | ) |
GSTLEARN_EXPORT double operate_Square | ( | double | x | ) |
GSTLEARN_EXPORT void print_range | ( | const char * | title, |
int | ntab, | ||
const double * | tab, | ||
const double * | sel | ||
) |
Print the range of values in an array
[in] | title | optional title (NULL if not defined) |
[in] | ntab | number of values |
[in] | tab | array of values |
[in] | sel | (optional) selection |
GSTLEARN_EXPORT double roundZero | ( | double | value, |
double | eps | ||
) |
Round off the value if close enough to zero. This ensures that the printout of a very small value does not come out with a non-significant negative sign This trick should only serve to make printouts similar on different platforms.
value | Input value |
eps | Tolerance to check that the value is considered as small |
GSTLEARN_EXPORT void setInternalDebug | ( | bool | status | ) |
GSTLEARN_EXPORT double truncateDecimals | ( | double | value, |
int | ndec | ||
) |
Rounding a double to a given number of decimals (from: https://stackoverflow.com/questions/304011/truncate-a-decimal-value-in-c/304013#304013)
value | Value to be rounded up |
ndec | Number of significant decimals |
GSTLEARN_EXPORT double truncateDigits | ( | double | value, |
int | ndigits | ||
) |
Rounding a double to a given number of decimals
value | Value to be rounded up |
ndigits | Number of significant digits |
GSTLEARN_EXPORT void ut_classify | ( | int | nech, |
const double * | tab, | ||
double * | sel, | ||
int | nclass, | ||
double | start, | ||
double | pas, | ||
int * | nmask, | ||
int * | ntest, | ||
int * | nout, | ||
int * | classe | ||
) |
Classify the samples into integer sieves
[in] | nech | Number of samples |
[in] | tab | Array of values |
[in] | sel | Array containing the Selection or NULL |
[in] | nclass | Number of sieve classes |
[in] | start | Starting sieve value |
[in] | pas | Width of the sieve |
[out] | nmask | Number of masked values |
[out] | ntest | Number of undefined values |
[out] | nout | Number of values outside the classes |
[out] | classe | Array for number of samples per sieve |
GSTLEARN_EXPORT double ut_cnp | ( | int | n, |
int | k | ||
) |
Compute combinations(n,k)
[in] | n | Total number of objects (>= 1) |
[in] | k | Selected number of objects (>= 1) |
GSTLEARN_EXPORT int* ut_combinations | ( | int | n, |
int | maxk, | ||
int * | ncomb | ||
) |
Return all the combinations of k within n
[in] | n | Total number of objects (>1) |
[in] | maxk | Selected number of objects (1<=maxk<n) |
[out] | ncomb | Number of combinations |
GSTLEARN_EXPORT double ut_deg2rad | ( | double | angle | ) |
Translates from degree to radian
[in] | angle | Angle in degrees |
GSTLEARN_EXPORT void ut_facies_statistics | ( | int | nech, |
double * | tab, | ||
double * | sel, | ||
int * | nval, | ||
int * | mini, | ||
int * | maxi | ||
) |
GSTLEARN_EXPORT double ut_median | ( | double * | tab, |
int | ntab | ||
) |
Calculate the median from a table of values
[in] | tab | Array of values |
[in] | ntab | Number of samples |
GSTLEARN_EXPORT MatrixSquareGeneral ut_pascal | ( | int | ndim | ) |
Create the matrix containing the Pascal Triangle coefficients
[in] | ndim | Size of the matrix |
GSTLEARN_EXPORT double ut_rad2deg | ( | double | angle | ) |
Translates from radian to degree
[in] | angle | Angle in radian |
GSTLEARN_EXPORT void ut_shuffle_array | ( | int | nrow, |
int | ncol, | ||
double * | tab | ||
) |
Shuffle an array (by line)
[in] | nrow | Number of rows |
[in] | ncol | Number of columns |
[in,out] | tab | Array to be suffled |
GSTLEARN_EXPORT void ut_sort_double | ( | int | safe, |
int | nech, | ||
int * | ind, | ||
double * | value | ||
) |
Sorts the (double) array value() and the array ind() in the ascending order of value
[in] | safe | 1 if the value array if preserved 0 if the value array is also sorted |
[in] | nech | number of samples |
[out] | ind | output int array |
[out] | value | input and output array |
GSTLEARN_EXPORT StatResults ut_statistics | ( | int | nech, |
const double * | tab, | ||
const double * | sel, | ||
const double * | wgt | ||
) |
Returns the statistics of an array in a StatResults structure