gstlearn  0.2.1
Geostatistics & Machine Learning toolbox
VectorHelper Class Reference

#include <VectorHelper.hpp>

Inheritance diagram for VectorHelper:
VH

Static Public Member Functions

static VectorInt initVInt (int nval, int value=0.)
 
static VectorDouble initVDouble (int nval, double value=0.)
 
static VectorVectorDouble initVVDouble (int nval1, int nval2, double value=0.)
 
static VectorVectorInt initVVInt (int nval1, int nval2, int value=0)
 
static VectorInt initVInt (int *values, int number)
 
static VectorDouble initVDouble (double *values, int number)
 
static VectorVectorDouble initVVDouble (double *value, int n1, int n2)
 
static void display (const String &title, const VectorDouble &vect)
 
static void display (const String &title, const VectorVectorDouble &vect)
 
static void display (const String &title, const VectorString &vect)
 
static void display (const String &title, const VectorInt &vect)
 
static String toString (const VectorDouble &vec)
 
static String toString (const VectorVectorDouble &vec)
 
static String toString (const VectorString &vec)
 
static String toString (const VectorInt &vec)
 
static void displayStats (const String &title, const VectorDouble &vect)
 
static void displayRange (const String &title, const VectorDouble &vect)
 
static void displayRange (const String &title, const VectorInt &vect)
 
static void displayNNZ (const String &title, const VectorDouble &vect, int nclass=10)
 
static int maximum (const VectorInt &vec)
 
static int minimum (const VectorInt &vec)
 
static double maximum (const VectorDouble &vec, bool flagAbs=false)
 
static double minimum (const VectorDouble &vec, bool flagAbs=false)
 
static double maximum (const VectorVectorDouble &vec, bool flagAbs=false)
 
static double minimum (const VectorVectorDouble &vec, bool flagAbs=false)
 
static int product (const VectorInt &nx)
 
static double product (const VectorDouble &nx)
 
static int countUndefined (const VectorDouble &vec)
 
static int countDefined (const VectorDouble &vec)
 
static double extensionDiagonal (const VectorDouble &mini, const VectorDouble &maxi)
 
static double cumul (const VectorDouble &vec)
 
static double mean (const VectorDouble &vec)
 
static double variance (const VectorDouble &vec)
 
static double stdv (const VectorDouble &vec)
 
static double norm (const VectorDouble &vec)
 
static double correlation (const VectorDouble &veca, const VectorDouble &vecb)
 
static VectorDouble quantiles (const VectorDouble &vec, const VectorDouble &probas)
 
static bool isConstant (const VectorDouble &vect, double refval=TEST)
 
static bool isConstant (const VectorInt &vect, int refval=ITEST)
 
static bool isSame (const VectorDouble &v1, const VectorDouble &v2, double eps=EPSILON10)
 
static bool isSame (const VectorInt &v1, const VectorInt &v2)
 
static VectorInt sequence (int number, int ideb=0)
 
static VectorDouble sequence (double valFrom, double valTo, double valStep=1., double ratio=1.)
 
static void fill (VectorDouble &vec, double v, int size=0)
 
static void fill (VectorInt &vec, int v, int size=0)
 
static void fill (VectorVectorDouble &vec, double value)
 
static void fillUndef (VectorDouble &vec, double repl)
 
static VectorDouble add (const VectorDouble &veca, const VectorDouble &vecb)
 
static void addInPlace (VectorDouble &dest, const VectorDouble &src)
 
static void addInPlace (const VectorDouble &veca, const VectorDouble &vecb, VectorDouble &res)
 
static VectorDouble subtract (const VectorDouble &veca, const VectorDouble &vecb)
 
static void subtractInPlace (VectorDouble &dest, const VectorDouble &src)
 
static void multiplyInPlace (VectorDouble &vec, const VectorDouble &v)
 
static void divideInPlace (VectorDouble &vec, const VectorDouble &v)
 
static void multiplyConstant (VectorDouble &vec, double v)
 
static void divideConstant (VectorDouble &vec, double v)
 
static void copy (VectorDouble &veca, const VectorDouble &vecb)
 
static void addConstant (VectorDouble &vec, double v)
 
static void addConstant (VectorInt &vec, int v)
 
static void normalize (VectorDouble &vec)
 
static void normalizeFromGaussianDistribution (VectorDouble &vec, double mini=0., double maxi=1.)
 
static VectorDouble normalScore (const VectorDouble &data, const VectorDouble &wt=VectorDouble())
 
static VectorDouble qnormVec (const VectorDouble &vec)
 
static VectorDouble pnormVec (const VectorDouble &vec)
 
static VectorDouble concatenate (const VectorDouble &veca, const VectorDouble &vecb)
 
static VectorDouble power (const VectorDouble &vec, double power)
 
static VectorDouble inverse (const VectorDouble &vec)
 
static double innerProduct (const VectorDouble &veca, const VectorDouble &vecb)
 
static VectorDouble crossProduct (const VectorDouble &veca, const VectorDouble &vecb)
 
static void cumulate (VectorDouble &veca, const VectorDouble &vecb, double coeff=1., double addval=0.)
 
static VectorDouble simulateUniform (int n, double mini=0., double maxi=1.)
 
static VectorDouble simulateBernoulli (int n, double proba, double vone=1., double velse=0.)
 
static VectorDouble simulateGaussian (int n, double mean=0., double sigma=1.)
 
static void simulateGaussianInPlace (VectorDouble &vect, double mean=0., double sigma=1.)
 
static VectorInt sampleRanks (int ntotal, double proportion=0., int number=0, int seed=242141, int optSort=0)
 
static VectorInt sort (const VectorInt &vecin, bool ascending=true)
 
static VectorDouble sort (const VectorDouble &vecin, bool ascending=true)
 
static VectorInt orderRanks (const VectorDouble &vecin)
 
static VectorInt sortRanks (const VectorDouble &vecin)
 
static VectorDouble unique (const VectorDouble &vecin)
 
static VectorInt unique (const VectorInt &vecin)
 
static VectorInt filter (const VectorInt &vecin, int vmin=ITEST, int vmax=ITEST, bool ascending=true)
 
static std::pair< double, double > rangeVals (const VectorDouble &vec)
 

Member Function Documentation

◆ add()

VectorDouble VectorHelper::add ( const VectorDouble veca,
const VectorDouble vecb 
)
static

◆ addConstant() [1/2]

void VectorHelper::addConstant ( VectorDouble vec,
double  v 
)
static

◆ addConstant() [2/2]

void VectorHelper::addConstant ( VectorInt vec,
int  v 
)
static

◆ addInPlace() [1/2]

void VectorHelper::addInPlace ( VectorDouble dest,
const VectorDouble src 
)
static

Performs: veca += vecb

Parameters
destInput/Output vector
srcAuxiliary vector

◆ addInPlace() [2/2]

void VectorHelper::addInPlace ( const VectorDouble veca,
const VectorDouble vecb,
VectorDouble res 
)
static

◆ concatenate()

VectorDouble VectorHelper::concatenate ( const VectorDouble veca,
const VectorDouble vecb 
)
static

◆ copy()

void VectorHelper::copy ( VectorDouble veca,
const VectorDouble vecb 
)
static

◆ correlation()

double VectorHelper::correlation ( const VectorDouble veca,
const VectorDouble vecb 
)
static

◆ countDefined()

int VectorHelper::countDefined ( const VectorDouble vec)
static

◆ countUndefined()

int VectorHelper::countUndefined ( const VectorDouble vec)
static

◆ crossProduct()

VectorDouble VectorHelper::crossProduct ( const VectorDouble veca,
const VectorDouble vecb 
)
static

Cross product (limited to 3D)

Parameters
vecaFirst vector
vecbSecond Vector
Returns

◆ cumul()

double VectorHelper::cumul ( const VectorDouble vec)
static

◆ cumulate()

void VectorHelper::cumulate ( VectorDouble veca,
const VectorDouble vecb,
double  coeff = 1.,
double  addval = 0. 
)
static

◆ display() [1/4]

void VectorHelper::display ( const String title,
const VectorDouble vect 
)
static

◆ display() [2/4]

void VectorHelper::display ( const String title,
const VectorVectorDouble vect 
)
static

◆ display() [3/4]

void VectorHelper::display ( const String title,
const VectorString vect 
)
static

◆ display() [4/4]

void VectorHelper::display ( const String title,
const VectorInt vect 
)
static

◆ displayNNZ()

void VectorHelper::displayNNZ ( const String title,
const VectorDouble vect,
int  nclass = 10 
)
static

◆ displayRange() [1/2]

void VectorHelper::displayRange ( const String title,
const VectorDouble vect 
)
static

◆ displayRange() [2/2]

void VectorHelper::displayRange ( const String title,
const VectorInt vect 
)
static

◆ displayStats()

void VectorHelper::displayStats ( const String title,
const VectorDouble vect 
)
static

◆ divideConstant()

void VectorHelper::divideConstant ( VectorDouble vec,
double  v 
)
static

◆ divideInPlace()

void VectorHelper::divideInPlace ( VectorDouble vec,
const VectorDouble v 
)
static

◆ extensionDiagonal()

double VectorHelper::extensionDiagonal ( const VectorDouble mini,
const VectorDouble maxi 
)
static

Calculate the diagonal of the box extension

Parameters
miniArray of lower coordinates of the box
maxiArray of upper coordinates of the box
Returns
Remarks
If one coordinate is undefined, TEST is returned.

◆ fill() [1/3]

void VectorHelper::fill ( VectorDouble vec,
double  v,
int  size = 0 
)
static

◆ fill() [2/3]

void VectorHelper::fill ( VectorInt vec,
int  v,
int  size = 0 
)
static

◆ fill() [3/3]

void VectorHelper::fill ( VectorVectorDouble vec,
double  value 
)
static

◆ fillUndef()

void VectorHelper::fillUndef ( VectorDouble vec,
double  repl 
)
static

◆ filter()

VectorInt VectorHelper::filter ( const VectorInt vecin,
int  vmin = ITEST,
int  vmax = ITEST,
bool  ascending = true 
)
static

From an input list, filter out all the elements which do no lie within [vmin, vmax], suppress double occurrences and sort them out (ascending or descending)

Parameters
vecinInput array (integer)
vminlower bound included (or ITEST)
vmaxupper bound excluded (or ITEST)
ascendingTrue for asceding order; False for descending order
Returns
Output array (integers)

◆ initVDouble() [1/2]

VectorDouble VectorHelper::initVDouble ( int  nval,
double  value = 0. 
)
static

◆ initVDouble() [2/2]

VectorDouble VectorHelper::initVDouble ( double *  values,
int  number 
)
static

◆ initVInt() [1/2]

VectorInt VectorHelper::initVInt ( int  nval,
int  value = 0. 
)
static

◆ initVInt() [2/2]

VectorInt VectorHelper::initVInt ( int *  values,
int  number 
)
static

◆ initVVDouble() [1/2]

VectorVectorDouble VectorHelper::initVVDouble ( int  nval1,
int  nval2,
double  value = 0. 
)
static

◆ initVVDouble() [2/2]

VectorVectorDouble VectorHelper::initVVDouble ( double *  value,
int  n1,
int  n2 
)
static

◆ initVVInt()

VectorVectorInt VectorHelper::initVVInt ( int  nval1,
int  nval2,
int  value = 0 
)
static

◆ innerProduct()

double VectorHelper::innerProduct ( const VectorDouble veca,
const VectorDouble vecb 
)
static

◆ inverse()

VectorDouble VectorHelper::inverse ( const VectorDouble vec)
static

◆ isConstant() [1/2]

bool VectorHelper::isConstant ( const VectorDouble vect,
double  refval = TEST 
)
static

Check if the contents of a vector is constant (equal to 'refval' is defined)

Parameters
vectInput vector
refvalReference value (TEST if not defined)
Returns

◆ isConstant() [2/2]

bool VectorHelper::isConstant ( const VectorInt vect,
int  refval = ITEST 
)
static

Check if the contents of a vector is constant (equal to 'refval' is defined)

Parameters
vectInput vector
refvalReference value (ITEST if not defined)
Returns

◆ isSame() [1/2]

bool VectorHelper::isSame ( const VectorDouble v1,
const VectorDouble v2,
double  eps = EPSILON10 
)
static

◆ isSame() [2/2]

bool VectorHelper::isSame ( const VectorInt v1,
const VectorInt v2 
)
static

◆ maximum() [1/3]

int VectorHelper::maximum ( const VectorInt vec)
static

◆ maximum() [2/3]

double VectorHelper::maximum ( const VectorDouble vec,
bool  flagAbs = false 
)
static

◆ maximum() [3/3]

double VectorHelper::maximum ( const VectorVectorDouble vec,
bool  flagAbs = false 
)
static

◆ mean()

double VectorHelper::mean ( const VectorDouble vec)
static

◆ minimum() [1/3]

int VectorHelper::minimum ( const VectorInt vec)
static

◆ minimum() [2/3]

double VectorHelper::minimum ( const VectorDouble vec,
bool  flagAbs = false 
)
static

◆ minimum() [3/3]

double VectorHelper::minimum ( const VectorVectorDouble vec,
bool  flagAbs = false 
)
static

◆ multiplyConstant()

void VectorHelper::multiplyConstant ( VectorDouble vec,
double  v 
)
static

◆ multiplyInPlace()

void VectorHelper::multiplyInPlace ( VectorDouble vec,
const VectorDouble v 
)
static

◆ norm()

double VectorHelper::norm ( const VectorDouble vec)
static

◆ normalize()

void VectorHelper::normalize ( VectorDouble vec)
static

◆ normalizeFromGaussianDistribution()

void VectorHelper::normalizeFromGaussianDistribution ( VectorDouble vec,
double  mini = 0.,
double  maxi = 1. 
)
static

◆ normalScore()

VectorDouble VectorHelper::normalScore ( const VectorDouble data,
const VectorDouble wt = VectorDouble() 
)
static

◆ orderRanks()

VectorInt VectorHelper::orderRanks ( const VectorDouble vecin)
static

Returns the permutation which rearranges the input vector into ascending order

Parameters
vecinInput vector
Returns
Vector of orders

◆ pnormVec()

VectorDouble VectorHelper::pnormVec ( const VectorDouble vec)
static

◆ power()

VectorDouble VectorHelper::power ( const VectorDouble vec,
double  power 
)
static

◆ product() [1/2]

int VectorHelper::product ( const VectorInt nx)
static

◆ product() [2/2]

double VectorHelper::product ( const VectorDouble nx)
static

◆ qnormVec()

VectorDouble VectorHelper::qnormVec ( const VectorDouble vec)
static

◆ quantiles()

VectorDouble VectorHelper::quantiles ( const VectorDouble vec,
const VectorDouble probas 
)
static

Calculate the quantiles

Parameters
vecArray of values
probasArray of probabilities (sorted by ascending order)
Returns
Vector of data values for the different probabilities

◆ rangeVals()

std::pair< double, double > VectorHelper::rangeVals ( const VectorDouble vec)
static

◆ sampleRanks()

VectorInt VectorHelper::sampleRanks ( int  ntotal,
double  proportion = 0.,
int  number = 0,
int  seed = 242141,
int  optSort = 0 
)
static

Sample a set of 'ntotal' ranks (unique occurrence)

Parameters
ntotalDimension to be sampled
proportionProportion of elected samples (in [0,1])
numberNumber of elected samples
seedSeed used for the random number generator
optSortSorting: 0 for None; 1 for Ascending; -1 for Descending
Returns
A vector of indices lying between 0 and ntotal-1. No duplicate.
Remarks
If 'proportion' and 'number' are not specified,
the output vector has dimension equal to 'ntotal'

◆ sequence() [1/2]

VectorInt VectorHelper::sequence ( int  number,
int  ideb = 0 
)
static

Create an output vector containing the 'number' consecutive numbers starting from 'ideb'

Parameters
numberLength of the output vector
idebIndex of the first element of the output vector

◆ sequence() [2/2]

VectorDouble VectorHelper::sequence ( double  valFrom,
double  valTo,
double  valStep = 1.,
double  ratio = 1. 
)
static

Create an output vector going from 'valFrom' to 'ValTo' by step of 'valStep' Create a vector containing the a seauence of numbers

Parameters
valFromStarting value
valToEnding value
valStepStep
ratioThe whole sequence can be ultimately scaled by 'ratio'
Returns

◆ simulateBernoulli()

VectorDouble VectorHelper::simulateBernoulli ( int  n,
double  proba,
double  vone = 1.,
double  velse = 0. 
)
static

◆ simulateGaussian()

VectorDouble VectorHelper::simulateGaussian ( int  n,
double  mean = 0.,
double  sigma = 1. 
)
static

◆ simulateGaussianInPlace()

void VectorHelper::simulateGaussianInPlace ( VectorDouble vect,
double  mean = 0.,
double  sigma = 1. 
)
static

◆ simulateUniform()

VectorDouble VectorHelper::simulateUniform ( int  n,
double  mini = 0.,
double  maxi = 1. 
)
static

◆ sort() [1/2]

VectorInt VectorHelper::sort ( const VectorInt vecin,
bool  ascending = true 
)
static

◆ sort() [2/2]

VectorDouble VectorHelper::sort ( const VectorDouble vecin,
bool  ascending = true 
)
static

◆ sortRanks()

VectorInt VectorHelper::sortRanks ( const VectorDouble vecin)
static

◆ stdv()

double VectorHelper::stdv ( const VectorDouble vec)
static

◆ subtract()

VectorDouble VectorHelper::subtract ( const VectorDouble veca,
const VectorDouble vecb 
)
static

Return a vector containing vecb - veca

Parameters
vecaInput Vector
vecbInput Vector
Returns

◆ subtractInPlace()

void VectorHelper::subtractInPlace ( VectorDouble dest,
const VectorDouble src 
)
static

Performs: veca -= vecb

Parameters
destInput/Output vector
srcAuxiliary vector

◆ toString() [1/4]

String VectorHelper::toString ( const VectorDouble vec)
static

◆ toString() [2/4]

String VectorHelper::toString ( const VectorVectorDouble vec)
static

◆ toString() [3/4]

String VectorHelper::toString ( const VectorString vec)
static

◆ toString() [4/4]

String VectorHelper::toString ( const VectorInt vec)
static

◆ unique() [1/2]

VectorDouble VectorHelper::unique ( const VectorDouble vecin)
static

◆ unique() [2/2]

VectorInt VectorHelper::unique ( const VectorInt vecin)
static

◆ variance()

double VectorHelper::variance ( const VectorDouble vec)
static

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