1.2.0
CCC
 
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 (const int *values, int number)
 
static VectorDouble initVDouble (const double *values, int number)
 
static VectorVectorDouble initVVDouble (const double *value, int n1, int n2)
 
static void display (const String &title, const VectorDouble &vect, bool skipLine=true)
 
static void display (const String &title, const VectorVectorDouble &vect, bool skipLine=true)
 
static void display (const String &title, const VectorString &vect, bool skipLine=true)
 
static void display (const String &title, const VectorInt &vect, bool skipLine=true)
 
static void dump (const String &title, const VectorDouble &vect)
 
static String toStringAsVD (const VectorDouble &vec)
 
static String toStringAsVVD (const VectorVectorDouble &vec)
 
static String toStringAsVS (const VectorString &vec)
 
static String toStringAsVI (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, bool flagAbs=false)
 
static int minimum (const VectorInt &vec, bool flagAbs=false)
 
static double maximum (const VectorDouble &vec, bool flagAbs=false, const VectorDouble &aux=VectorDouble(), int mode=0)
 
static double minimum (const VectorDouble &vec, bool flagAbs=false, const VectorDouble &aux=VectorDouble(), int mode=0)
 
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 &vec)
 
static int countUndefined (const VectorDouble &vec)
 
static int countDefined (const VectorDouble &vec)
 
static bool hasUndefined (const VectorDouble &vec)
 
static double extensionDiagonal (const VectorDouble &mini, const VectorDouble &maxi)
 
static int cumul (const VectorInt &vec)
 
static double cumul (const VectorDouble &vec)
 
static double mean (const VectorDouble &vec)
 
static double variance (const VectorDouble &vec, bool scaleByN=false)
 
static double stdv (const VectorDouble &vec, bool scaleByN=false)
 
static double norm (const VectorDouble &vec)
 
static double norminf (const VectorDouble &vec)
 
static double median (const VectorDouble &vec)
 
static double normDistance (const VectorDouble &veca, const VectorDouble &vecb)
 
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, int step=1)
 
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, int size=0)
 
static void addInPlace (const double *veca, const double *vecb, double *res, int size)
 
static void addInPlace (const VectorVectorDouble &in1, const VectorVectorDouble &in2, VectorVectorDouble &outv)
 
static void addSquareInPlace (VectorDouble &dest, const VectorDouble &src)
 
static VectorDouble subtract (const VectorDouble &veca, const VectorDouble &vecb)
 
static VectorInt subtract (const VectorInt &veca, const VectorInt &vecb)
 
static void subtractInPlace (VectorDouble &dest, const VectorDouble &src)
 
static void subtractInPlace (VectorInt &dest, const VectorInt &src)
 
static void subtractInPlace (const VectorVectorDouble &in1, const VectorVectorDouble &in2, VectorVectorDouble &outv)
 
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 multiplyConstantInPlace (const VectorDouble &vec, double v, VectorDouble &vecout)
 
static void addMultiplyConstantInPlace (double val1, const VectorVectorDouble &in1, VectorVectorDouble &outv)
 
static void divideConstant (VectorDouble &vec, double v)
 
static void copy (const VectorDouble &vecin, VectorDouble &vecout, int size=-1)
 
static void copy (const VectorInt &vecin, VectorInt &vecout, int size=-1)
 
static void copy (const VectorVectorDouble &inv, VectorVectorDouble &outv)
 
static void addConstant (VectorDouble &vec, double v)
 
static void addConstant (VectorInt &vec, int v)
 
static void mean1AndMean2ToStdev (const VectorDouble &mean1, const VectorDouble &mean2, VectorDouble &std, int number)
 
static void normalize (VectorDouble &vec)
 
static void normalize (double *tab, int ntab)
 
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, int size=-1)
 
static double innerProduct (const double *veca, const double *vecb, int size)
 
static double innerProduct (const VectorVectorDouble &x, const VectorVectorDouble &y)
 
static VectorDouble crossProduct3D (const VectorDouble &veca, const VectorDouble &vecb)
 
static void crossProduct3DInPlace (const double *a, const double *b, double *v)
 
static void cumulate (VectorDouble &veca, const VectorDouble &vecb, double coeff=1., double addval=0.)
 
static void getMostSignificant (const VectorDouble &vec, double tol=EPSILON6, int nmax=-1)
 
static VectorDouble simulateUniform (int n=1, double mini=0., double maxi=1.)
 
static VectorDouble simulateBernoulli (int n=1, double proba=0.5, double vone=1., double velse=0.)
 
static VectorDouble simulateGaussian (int n=1, double mean=0., double sigma=1.)
 
static void simulateGaussianInPlace (VectorDouble &vec, double mean=0., double sigma=1.)
 
static VectorInt sampleRanks (int ntotal, double proportion=0., int number=0, int seed=242141, int optSort=0)
 
static void normalizeCodir (int ndim, VectorDouble &codir)
 
static bool isInList (const VectorInt &vec, int item)
 
static VectorInt sort (const VectorInt &vecin, bool ascending=true, int size=-1)
 
static VectorDouble sort (const VectorDouble &vecin, bool ascending=true, int size=-1)
 
static void sortInPlace (VectorInt &vecin, bool ascending=true, int size=-1)
 
static void sortInPlace (VectorDouble &vecin, bool ascending=true, int size=-1)
 
static bool isSorted (const VectorDouble &vec, bool ascending=true)
 
static VectorDouble unique (const VectorDouble &vecin, int size=-1)
 
static VectorInt unique (const VectorInt &vecin, int size=-1)
 
static VectorInt orderRanks (const VectorInt &vecin, bool ascending=true, int size=-1)
 
static VectorInt orderRanks (const VectorDouble &vecin, bool ascending=true, int size=-1)
 
static VectorInt sortRanks (const VectorDouble &vecin, bool ascending=true, int size=-1)
 
static VectorInt reorder (const VectorInt &vecin, const VectorInt &order, int size=-1)
 
static VectorDouble reorder (const VectorDouble &vecin, const VectorInt &order, int size=-1)
 
static void arrangeInPlace (int safe, VectorInt &ranks, VectorDouble &values, bool ascending=true, int size=-1)
 
static void arrangeInPlace (int safe, VectorInt &ranks, VectorInt &values, bool ascending=true, int size=-1)
 
static VectorInt filter (const VectorInt &vecin, int vmin=ITEST, int vmax=ITEST, bool ascending=true)
 
static VectorInt complement (const VectorInt &vec, const VectorInt &sel)
 
static std::pair< double, double > rangeVals (const VectorDouble &vec)
 
static VectorDouble flatten (const VectorVectorDouble &vvd)
 
static VectorVectorDouble unflatten (const VectorDouble &vd, const VectorInt &sizes)
 
static void flattenInPlace (const VectorVectorDouble &vvd, VectorDouble &vd)
 
static void unflattenInPlace (const VectorDouble &vd, VectorVectorDouble &vvd)
 
static void linearCombinationInPlace (double val1, const VectorDouble &vd1, double val2, const VectorDouble &vd2, VectorDouble &outv)
 
static void linearCombinationVVDInPlace (double val1, const VectorVectorDouble &vvd1, double val2, const VectorVectorDouble &vvd2, VectorVectorDouble &outv)
 
static VectorDouble suppressTest (const VectorDouble &vecin)
 
static void extractInPlace (const VectorDouble &vecin, VectorDouble &vecout, int start)
 
static void mergeInPlace (const VectorDouble &vecin, VectorDouble &vecout, int start)
 
static void transformVD (VectorDouble &tab, int oper_choice=1)
 
static void squeezeAndStretchInPlaceForward (const VectorDouble &vecin, VectorDouble &vecout, double origin, double mesh, double top, double bot)
 
static void squeezeAndStretchInPlaceBackward (const VectorDouble &vecin, VectorDouble &vecout, double origin, double mesh, double top, double bot)
 
static int whereMinimum (const VectorDouble &tab)
 
static int whereMaximum (const VectorDouble &tab)
 
static VectorDouble reduceOne (const VectorDouble &vecin, int index)
 
static VectorDouble reduce (const VectorDouble &vecin, const VectorInt &vindex)
 
static void truncateDecimalsInPlace (VectorDouble &vec, int ndec)
 
static void truncateDigitsInPlace (VectorDouble &vec, int ndec)
 

Member Function Documentation

VectorDouble VectorHelper::add ( const VectorDouble veca,
const VectorDouble vecb 
)
static
void VectorHelper::addConstant ( VectorDouble vec,
double  v 
)
static
void VectorHelper::addConstant ( VectorInt vec,
int  v 
)
static
void VectorHelper::addInPlace ( VectorDouble dest,
const VectorDouble src 
)
static

Performs: veca += vecb

Parameters
destInput/Output vector
srcAuxiliary vector
void VectorHelper::addInPlace ( const VectorDouble veca,
const VectorDouble vecb,
VectorDouble res,
int  size = 0 
)
static
void VectorHelper::addInPlace ( const double *  veca,
const double *  vecb,
double *  res,
int  size 
)
static
void VectorHelper::addInPlace ( const VectorVectorDouble in1,
const VectorVectorDouble in2,
VectorVectorDouble outv 
)
static
void VectorHelper::addMultiplyConstantInPlace ( double  val1,
const VectorVectorDouble in1,
VectorVectorDouble outv 
)
static
void VectorHelper::addSquareInPlace ( VectorDouble dest,
const VectorDouble src 
)
static

Performs: veca += vecb**2

Parameters
destInput/Output vector
srcAuxiliary vector
void VectorHelper::arrangeInPlace ( int  safe,
VectorInt ranks,
VectorDouble values,
bool  ascending = true,
int  size = -1 
)
static

Sorts the (double) array value() and the array ranks() if provided

Parameters
[in]safe1 if the value array if preserved 0 if the value array is also sorted
[in]ascendingSorting order
[in]sizeOptional vector dimension
[out]ranksinput and output int array
[out]valuesinput and output double array
Remarks
If ranks = NULL, ranks is ignored
When using 'size', the remaining part of arrays is unchanged
void VectorHelper::arrangeInPlace ( int  safe,
VectorInt ranks,
VectorInt values,
bool  ascending = true,
int  size = -1 
)
static

Sorts the (int) array value() and the array ranks() if provided

Parameters
[in]safe1 if the value array if preserved 0 if the value array is also sorted
[in]ascendingTrue for ascending order; False for descending order
[in]sizeOptional size
[out]ranksintput and output int array
[out]valuesinput and output int array
Remarks
If ranks = NULL, ranks is ignored
When using 'size', the remaining part of arrays is unchanged
VectorInt VectorHelper::complement ( const VectorInt vec,
const VectorInt sel 
)
static

Returns the list complementary to 'sel' within 'vecin'

Parameters
vecInitial list
selVector of forbidden elements
Returns
Complementary list
VectorDouble VectorHelper::concatenate ( const VectorDouble veca,
const VectorDouble vecb 
)
static
void VectorHelper::copy ( const VectorDouble vecin,
VectorDouble vecout,
int  size = -1 
)
static
void VectorHelper::copy ( const VectorInt vecin,
VectorInt vecout,
int  size = -1 
)
static
void VectorHelper::copy ( const VectorVectorDouble inv,
VectorVectorDouble outv 
)
static
double VectorHelper::correlation ( const VectorDouble veca,
const VectorDouble vecb 
)
static
int VectorHelper::countDefined ( const VectorDouble vec)
static
int VectorHelper::countUndefined ( const VectorDouble vec)
static
VectorDouble VectorHelper::crossProduct3D ( const VectorDouble veca,
const VectorDouble vecb 
)
static

Cross product (limited to 3D)

Parameters
vecaFirst vector
vecbSecond Vector
Returns
void VectorHelper::crossProduct3DInPlace ( const double *  a,
const double *  b,
double *  v 
)
static
int VectorHelper::cumul ( const VectorInt vec)
static
double VectorHelper::cumul ( const VectorDouble vec)
static
void VectorHelper::cumulate ( VectorDouble veca,
const VectorDouble vecb,
double  coeff = 1.,
double  addval = 0. 
)
static
void VectorHelper::display ( const String title,
const VectorDouble vect,
bool  skipLine = true 
)
static
void VectorHelper::display ( const String title,
const VectorVectorDouble vect,
bool  skipLine = true 
)
static
void VectorHelper::display ( const String title,
const VectorString vect,
bool  skipLine = true 
)
static
void VectorHelper::display ( const String title,
const VectorInt vect,
bool  skipLine = true 
)
static
void VectorHelper::displayNNZ ( const String title,
const VectorDouble vect,
int  nclass = 10 
)
static
void VectorHelper::displayRange ( const String title,
const VectorDouble vect 
)
static
void VectorHelper::displayRange ( const String title,
const VectorInt vect 
)
static
void VectorHelper::displayStats ( const String title,
const VectorDouble vect 
)
static
void VectorHelper::divideConstant ( VectorDouble vec,
double  v 
)
static
void VectorHelper::divideInPlace ( VectorDouble vec,
const VectorDouble v 
)
static
void VectorHelper::dump ( const String title,
const VectorDouble vect 
)
static
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.
void VectorHelper::extractInPlace ( const VectorDouble vecin,
VectorDouble vecout,
int  start 
)
static

Extract the part of a vector 'vecin' (dimensioned to dimension of 'vecout') starting at address 'istart' and copy it into 'vecout'

Parameters
vecinInitial vector
vecoutResulting vector (already allocated)
startStarting address (within 'vecin')
void VectorHelper::fill ( VectorDouble vec,
double  v,
int  size = 0 
)
static
void VectorHelper::fill ( VectorInt vec,
int  v,
int  size = 0 
)
static
void VectorHelper::fill ( VectorVectorDouble vec,
double  value 
)
static
void VectorHelper::fillUndef ( VectorDouble vec,
double  repl 
)
static
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 ascending order; False for descending order
Returns
Output array (integers)
VectorDouble VectorHelper::flatten ( const VectorVectorDouble vvd)
static

Method which flattens a VectorVectorDouble into a VectorDouble

Parameters
vvdInput VectorVectorDouble
Returns
Returned VectorDouble
void VectorHelper::flattenInPlace ( const VectorVectorDouble vvd,
VectorDouble vd 
)
static
void VectorHelper::getMostSignificant ( const VectorDouble vec,
double  tol = EPSILON6,
int  nmax = -1 
)
static

Display the first significant values of the input vector. A "significant" value is a value larger than 'tol' in absolute value Values are listed by decreasing importance.

Parameters
vecInput Vector
tolTolerance above which a value is significant (in absolute value)
nmaxLimit on the number of values printed (-1: no limit)
bool VectorHelper::hasUndefined ( const VectorDouble vec)
static
VectorDouble VectorHelper::initVDouble ( int  nval,
double  value = 0. 
)
static
VectorDouble VectorHelper::initVDouble ( const double *  values,
int  number 
)
static
VectorInt VectorHelper::initVInt ( int  nval,
int  value = 0. 
)
static
VectorInt VectorHelper::initVInt ( const int *  values,
int  number 
)
static
VectorVectorDouble VectorHelper::initVVDouble ( int  nval1,
int  nval2,
double  value = 0. 
)
static
VectorVectorDouble VectorHelper::initVVDouble ( const double *  value,
int  n1,
int  n2 
)
static
VectorVectorInt VectorHelper::initVVInt ( int  nval1,
int  nval2,
int  value = 0 
)
static
double VectorHelper::innerProduct ( const VectorDouble veca,
const VectorDouble vecb,
int  size = -1 
)
static
double VectorHelper::innerProduct ( const double *  veca,
const double *  vecb,
int  size 
)
static
double VectorHelper::innerProduct ( const VectorVectorDouble x,
const VectorVectorDouble y 
)
static
VectorDouble VectorHelper::inverse ( const VectorDouble vec)
static
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
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
bool VectorHelper::isInList ( const VectorInt vec,
int  item 
)
static
bool VectorHelper::isSame ( const VectorDouble v1,
const VectorDouble v2,
double  eps = EPSILON10 
)
static
bool VectorHelper::isSame ( const VectorInt v1,
const VectorInt v2 
)
static
bool VectorHelper::isSorted ( const VectorDouble vec,
bool  ascending = true 
)
static
void VectorHelper::linearCombinationInPlace ( double  val1,
const VectorDouble vd1,
double  val2,
const VectorDouble vd2,
VectorDouble outv 
)
static
void VectorHelper::linearCombinationVVDInPlace ( double  val1,
const VectorVectorDouble vvd1,
double  val2,
const VectorVectorDouble vvd2,
VectorVectorDouble outv 
)
static
int VectorHelper::maximum ( const VectorInt vec,
bool  flagAbs = false 
)
static
double VectorHelper::maximum ( const VectorDouble vec,
bool  flagAbs = false,
const VectorDouble aux = VectorDouble(),
int  mode = 0 
)
static

Calculate the maximum of 'vec' (conditionally to 'aux')

Parameters
vecTarget vector
flagAbsWhen True, take the absolute value of 'vec' beforehand
auxConditional vector (see remarks)
modeComparison mode
Returns
Minimum value
Remarks
When 'aux' is defined, the maximum of 'vec' is conditional to 'aux'
- mode=0: statistics calculated only when 'vec' and 'aux' are both defined
- mode>0: statistics calculated only when 'vec' > 'aux'
- mode<0: statistics calculated only when 'vec' < 'aux'
double VectorHelper::maximum ( const VectorVectorDouble vec,
bool  flagAbs = false 
)
static
double VectorHelper::mean ( const VectorDouble vec)
static
void VectorHelper::mean1AndMean2ToStdev ( const VectorDouble mean1,
const VectorDouble mean2,
VectorDouble std,
int  number 
)
static
double VectorHelper::median ( const VectorDouble vec)
static
void VectorHelper::mergeInPlace ( const VectorDouble vecin,
VectorDouble vecout,
int  start 
)
static

Merge 'vecin' into 'vecout' starting at address 'istart'

Parameters
vecinInitial vector
vecoutVector where 'vecin' should be copied
startStarting address (in 'vecout')
int VectorHelper::minimum ( const VectorInt vec,
bool  flagAbs = false 
)
static
double VectorHelper::minimum ( const VectorDouble vec,
bool  flagAbs = false,
const VectorDouble aux = VectorDouble(),
int  mode = 0 
)
static

Calculate the minimum of 'vec' (conditionally to 'aux')

Parameters
vecTarget vector
flagAbsWhen True, take the absolute value of 'vec' beforehand
auxConditional vector (see remarks)
modeComparison mode
Returns
Minimum value
Remarks
When 'aux' is defined, the minimum of 'vec' is conditional to 'aux'
- mode=0: statistics calculated only when 'vec' and 'aux' are both defined
- mode>0: statistics calculated only when 'vec' > 'aux'
- mode<0: statistics calculated only when 'vec' < 'aux'
double VectorHelper::minimum ( const VectorVectorDouble vec,
bool  flagAbs = false 
)
static
void VectorHelper::multiplyConstant ( VectorDouble vec,
double  v 
)
static
void VectorHelper::multiplyConstantInPlace ( const VectorDouble vec,
double  v,
VectorDouble vecout 
)
static
void VectorHelper::multiplyInPlace ( VectorDouble vec,
const VectorDouble v 
)
static
double VectorHelper::norm ( const VectorDouble vec)
static
void VectorHelper::normalize ( VectorDouble vec)
static
void VectorHelper::normalize ( double *  tab,
int  ntab 
)
static
void VectorHelper::normalizeCodir ( int  ndim,
VectorDouble codir 
)
static

Fix plausible values for the Direction coefficients. They must be defined and with norm equal to 1

Parameters
[in]ndimSpace dimension
[in,out]codirInput/Output Direction coefficients
void VectorHelper::normalizeFromGaussianDistribution ( VectorDouble vec,
double  mini = 0.,
double  maxi = 1. 
)
static
VectorDouble VectorHelper::normalScore ( const VectorDouble data,
const VectorDouble wt = VectorDouble() 
)
static
double VectorHelper::normDistance ( const VectorDouble veca,
const VectorDouble vecb 
)
static
double VectorHelper::norminf ( const VectorDouble vec)
static
VectorInt VectorHelper::orderRanks ( const VectorInt vecin,
bool  ascending = true,
int  size = -1 
)
static

Returns the permutation which rearranges the input vector into any order

Parameters
vecinInput vector
ascendingTrue for ascending order; False otherwise
sizeOptional dimension of the input vector
Returns
Vector of orders
VectorInt VectorHelper::orderRanks ( const VectorDouble vecin,
bool  ascending = true,
int  size = -1 
)
static

Returns the permutation which rearranges the input vector into any order

Parameters
vecinInput vector
ascendingTrue for ascending order; False otherwise
sizeOptional vector dimension
Returns
Vector of orders
VectorDouble VectorHelper::pnormVec ( const VectorDouble vec)
static
VectorDouble VectorHelper::power ( const VectorDouble vec,
double  power 
)
static
int VectorHelper::product ( const VectorInt nx)
static
double VectorHelper::product ( const VectorDouble vec)
static
VectorDouble VectorHelper::qnormVec ( const VectorDouble vec)
static
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
std::pair< double, double > VectorHelper::rangeVals ( const VectorDouble vec)
static
VectorDouble VectorHelper::reduce ( const VectorDouble vecin,
const VectorInt vindex 
)
static
VectorDouble VectorHelper::reduceOne ( const VectorDouble vecin,
int  index 
)
static
VectorInt VectorHelper::reorder ( const VectorInt vecin,
const VectorInt order,
int  size = -1 
)
static
VectorDouble VectorHelper::reorder ( const VectorDouble vecin,
const VectorInt order,
int  size = -1 
)
static
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'
VectorInt VectorHelper::sequence ( int  number,
int  ideb = 0,
int  step = 1 
)
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
stepStep between two consecutive values
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 sequence of numbers

Parameters
valFromStarting value
valToEnding value
valStepStep
ratioThe whole sequence can be ultimately scaled by 'ratio'
Returns
VectorDouble VectorHelper::simulateBernoulli ( int  n = 1,
double  proba = 0.5,
double  vone = 1.,
double  velse = 0. 
)
static
VectorDouble VectorHelper::simulateGaussian ( int  n = 1,
double  mean = 0.,
double  sigma = 1. 
)
static
void VectorHelper::simulateGaussianInPlace ( VectorDouble vec,
double  mean = 0.,
double  sigma = 1. 
)
static
VectorDouble VectorHelper::simulateUniform ( int  n = 1,
double  mini = 0.,
double  maxi = 1. 
)
static
VectorInt VectorHelper::sort ( const VectorInt vecin,
bool  ascending = true,
int  size = -1 
)
static
VectorDouble VectorHelper::sort ( const VectorDouble vecin,
bool  ascending = true,
int  size = -1 
)
static
void VectorHelper::sortInPlace ( VectorInt vecin,
bool  ascending = true,
int  size = -1 
)
static
void VectorHelper::sortInPlace ( VectorDouble vecin,
bool  ascending = true,
int  size = -1 
)
static
VectorInt VectorHelper::sortRanks ( const VectorDouble vecin,
bool  ascending = true,
int  size = -1 
)
static
void VectorHelper::squeezeAndStretchInPlaceBackward ( const VectorDouble vecin,
VectorDouble vecout,
double  origin,
double  mesh,
double  top,
double  bot 
)
static

Operate the squeeze-and-stretch algorithm backward (see remarks)

Parameters
vecinInput vector (in sugar box system)
vecoutOutput vector (in structural system)
originOrigin of the vertical axis (structural system)
meshMesh of the vertical axis (structural system)
topElevation of the Top surface
botElevation of the Bottom surface
Remarks
The information is contained in 'vecin' which is defined on a regular 1D grid
(characterized by 'base' and 'mesh')
Extend the relevant information, lying between 'bot' and 'top' in order to fill
the whole vector 'vecout'
void VectorHelper::squeezeAndStretchInPlaceForward ( const VectorDouble vecin,
VectorDouble vecout,
double  origin,
double  mesh,
double  top,
double  bot 
)
static

Operate the squeeze-and-stretch algorithm forward (see remarks)

Parameters
vecinInput vector (in structural system)
vecoutOutput vector (in sugar box system)
originOrigin of the vertical axis (structural system)
meshMesh of the vertical axis (structural system)
topElevation of the Top surface
botElevation of the Bottom surface
Remarks
The information is contained in 'vecin' which is defined on a regular 1D grid
in the structural system. The purpose is to sample the relevant sub-information
(between 'top' and 'bot') densely in 'vecout'
double VectorHelper::stdv ( const VectorDouble vec,
bool  scaleByN = false 
)
static
VectorDouble VectorHelper::subtract ( const VectorDouble veca,
const VectorDouble vecb 
)
static

Return a vector containing vecb - veca

Parameters
vecaInput Vector
vecbInput Vector
Returns
VectorInt VectorHelper::subtract ( const VectorInt veca,
const VectorInt vecb 
)
static

Return a vector containing vecb - veca (integer version)

Parameters
vecaInput Vector
vecbInput Vector
Returns
void VectorHelper::subtractInPlace ( VectorDouble dest,
const VectorDouble src 
)
static

Performs: veca -= vecb

Parameters
destInput/Output vector
srcAuxiliary vector
void VectorHelper::subtractInPlace ( VectorInt dest,
const VectorInt src 
)
static
void VectorHelper::subtractInPlace ( const VectorVectorDouble in1,
const VectorVectorDouble in2,
VectorVectorDouble outv 
)
static
VectorDouble VectorHelper::suppressTest ( const VectorDouble vecin)
static
String VectorHelper::toStringAsVD ( const VectorDouble vec)
static
String VectorHelper::toStringAsVI ( const VectorInt vec)
static
String VectorHelper::toStringAsVS ( const VectorString vec)
static
String VectorHelper::toStringAsVVD ( const VectorVectorDouble vec)
static
void VectorHelper::transformVD ( VectorDouble tab,
int  oper_choice = 1 
)
static

Transform a vector of double values as follows

Parameters
tabVector of double values
oper_choiceOperation on the diagonal term (see Utilities::operate_XXX)
Returns
void VectorHelper::truncateDecimalsInPlace ( VectorDouble vec,
int  ndec 
)
static
void VectorHelper::truncateDigitsInPlace ( VectorDouble vec,
int  ndec 
)
static
VectorVectorDouble VectorHelper::unflatten ( const VectorDouble vd,
const VectorInt sizes 
)
static
void VectorHelper::unflattenInPlace ( const VectorDouble vd,
VectorVectorDouble vvd 
)
static
VectorDouble VectorHelper::unique ( const VectorDouble vecin,
int  size = -1 
)
static
VectorInt VectorHelper::unique ( const VectorInt vecin,
int  size = -1 
)
static
double VectorHelper::variance ( const VectorDouble vec,
bool  scaleByN = false 
)
static
int VectorHelper::whereMaximum ( const VectorDouble tab)
static

Find the location of the maximum value within a vector

Returns
Rank of the maximum value
Parameters
[in]tabVector of values
int VectorHelper::whereMinimum ( const VectorDouble tab)
static

Find the location of the minimum value within a vector

Returns
Rank of the minimum value
Parameters
[in]tabVector of values

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