1.3.2
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 count (const VectorVectorInt &vec)
 
static int cumul (const VectorInt &vec)
 
static int cumul (const VectorVectorInt &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 normL1 (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, int norm=2)
 
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 cumulateInPlace (VectorDouble &vec)
 
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 int whereElement (const VectorInt &tab, int target)
 
static VectorDouble reduceOne (const VectorDouble &vecin, int index)
 
static VectorDouble reduce (const VectorDouble &vecin, const VectorInt &vindex)
 
static VectorDouble compress (const VectorDouble &vecin, const VectorInt &vindex)
 
static void truncateDecimalsInPlace (VectorDouble &vec, int ndec)
 
static void truncateDigitsInPlace (VectorDouble &vec, int ndec)
 

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/4]

void VectorHelper::addInPlace ( const double *  veca,
const double *  vecb,
double *  res,
int  size 
)
static

◆ addInPlace() [2/4]

void VectorHelper::addInPlace ( const VectorDouble veca,
const VectorDouble vecb,
VectorDouble res,
int  size = 0 
)
static

◆ addInPlace() [3/4]

void VectorHelper::addInPlace ( const VectorVectorDouble in1,
const VectorVectorDouble in2,
VectorVectorDouble outv 
)
static

◆ addInPlace() [4/4]

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

Performs: veca += vecb

Parameters
destInput/Output vector
srcAuxiliary vector

◆ addMultiplyConstantInPlace()

void VectorHelper::addMultiplyConstantInPlace ( double  val1,
const VectorVectorDouble in1,
VectorVectorDouble outv 
)
static

◆ addSquareInPlace()

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

Performs: veca += vecb**2

Parameters
destInput/Output vector
srcAuxiliary vector

◆ arrangeInPlace() [1/2]

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

◆ arrangeInPlace() [2/2]

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

◆ complement()

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

◆ compress()

VectorDouble VectorHelper::compress ( const VectorDouble vecin,
const VectorInt vindex 
)
static

Reduce the input vector 'vecin' by returning the only elements referred by 'index'

Parameters
vecinInput vector (double)
vindexVector of indices to be kept

◆ concatenate()

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

◆ copy() [1/3]

void VectorHelper::copy ( const VectorDouble vecin,
VectorDouble vecout,
int  size = -1 
)
static

◆ copy() [2/3]

void VectorHelper::copy ( const VectorInt vecin,
VectorInt vecout,
int  size = -1 
)
static

◆ copy() [3/3]

void VectorHelper::copy ( const VectorVectorDouble inv,
VectorVectorDouble outv 
)
static

◆ correlation()

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

◆ count()

int VectorHelper::count ( const VectorVectorInt vec)
static

◆ countDefined()

int VectorHelper::countDefined ( const VectorDouble vec)
static

◆ countUndefined()

int VectorHelper::countUndefined ( const VectorDouble vec)
static

◆ crossProduct3D()

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

Cross product (limited to 3D)

Parameters
vecaFirst vector
vecbSecond Vector
Returns

◆ crossProduct3DInPlace()

void VectorHelper::crossProduct3DInPlace ( const double *  a,
const double *  b,
double *  v 
)
static

◆ cumul() [1/3]

double VectorHelper::cumul ( const VectorDouble vec)
static

◆ cumul() [2/3]

int VectorHelper::cumul ( const VectorInt vec)
static

◆ cumul() [3/3]

int VectorHelper::cumul ( const VectorVectorInt vec)
static

◆ cumulate()

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

◆ cumulateInPlace()

void VectorHelper::cumulateInPlace ( VectorDouble vec)
static

◆ display() [1/4]

void VectorHelper::display ( const String title,
const VectorDouble vect,
bool  skipLine = true 
)
static

◆ display() [2/4]

void VectorHelper::display ( const String title,
const VectorInt vect,
bool  skipLine = true 
)
static

◆ display() [3/4]

void VectorHelper::display ( const String title,
const VectorString vect,
bool  skipLine = true 
)
static

◆ display() [4/4]

void VectorHelper::display ( const String title,
const VectorVectorDouble vect,
bool  skipLine = true 
)
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

◆ dump()

void VectorHelper::dump ( const String title,
const VectorDouble vect 
)
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.

◆ extractInPlace()

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')

◆ 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 ascending order; False for descending order
Returns
Output array (integers)

◆ flatten()

VectorDouble VectorHelper::flatten ( const VectorVectorDouble vvd)
static

Method which flattens a VectorVectorDouble into a VectorDouble

Parameters
vvdInput VectorVectorDouble
Returns
Returned VectorDouble

◆ flattenInPlace()

void VectorHelper::flattenInPlace ( const VectorVectorDouble vvd,
VectorDouble vd 
)
static

◆ getMostSignificant()

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)

◆ hasUndefined()

bool VectorHelper::hasUndefined ( const VectorDouble vec)
static

◆ initVDouble() [1/2]

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

◆ initVDouble() [2/2]

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

◆ initVInt() [1/2]

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

◆ initVInt() [2/2]

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

◆ initVVDouble() [1/2]

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

◆ initVVDouble() [2/2]

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

◆ initVVInt()

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

◆ innerProduct() [1/3]

double VectorHelper::innerProduct ( const double *  veca,
const double *  vecb,
int  size 
)
static

◆ innerProduct() [2/3]

double VectorHelper::innerProduct ( const VectorDouble veca,
const VectorDouble vecb,
int  size = -1 
)
static

◆ innerProduct() [3/3]

double VectorHelper::innerProduct ( const VectorVectorDouble x,
const VectorVectorDouble y 
)
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

◆ isInList()

bool VectorHelper::isInList ( const VectorInt vec,
int  item 
)
static

◆ 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

◆ isSorted()

bool VectorHelper::isSorted ( const VectorDouble vec,
bool  ascending = true 
)
static

◆ linearCombinationInPlace()

void VectorHelper::linearCombinationInPlace ( double  val1,
const VectorDouble vd1,
double  val2,
const VectorDouble vd2,
VectorDouble outv 
)
static

◆ linearCombinationVVDInPlace()

void VectorHelper::linearCombinationVVDInPlace ( double  val1,
const VectorVectorDouble vvd1,
double  val2,
const VectorVectorDouble vvd2,
VectorVectorDouble outv 
)
static

◆ maximum() [1/3]

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'

◆ maximum() [2/3]

int VectorHelper::maximum ( const VectorInt 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

◆ mean1AndMean2ToStdev()

void VectorHelper::mean1AndMean2ToStdev ( const VectorDouble mean1,
const VectorDouble mean2,
VectorDouble std,
int  number 
)
static

◆ median()

double VectorHelper::median ( const VectorDouble vec)
static

◆ mergeInPlace()

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')

◆ minimum() [1/3]

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'

◆ minimum() [2/3]

int VectorHelper::minimum ( const VectorInt 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

◆ multiplyConstantInPlace()

void VectorHelper::multiplyConstantInPlace ( const VectorDouble vec,
double  v,
VectorDouble vecout 
)
static

◆ multiplyInPlace()

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

◆ norm()

double VectorHelper::norm ( const VectorDouble vec)
static

◆ normalize() [1/2]

void VectorHelper::normalize ( double *  tab,
int  ntab 
)
static

◆ normalize() [2/2]

void VectorHelper::normalize ( VectorDouble vec,
int  norm = 2 
)
static

◆ normalizeCodir()

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

◆ 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

◆ normDistance()

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

◆ norminf()

double VectorHelper::norminf ( const VectorDouble vec)
static

◆ normL1()

double VectorHelper::normL1 ( const VectorDouble vec)
static

◆ orderRanks() [1/2]

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

◆ orderRanks() [2/2]

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

◆ pnormVec()

VectorDouble VectorHelper::pnormVec ( const VectorDouble vec)
static

◆ power()

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

◆ product() [1/2]

double VectorHelper::product ( const VectorDouble vec)
static

◆ product() [2/2]

int VectorHelper::product ( const VectorInt 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

◆ reduce()

VectorDouble VectorHelper::reduce ( const VectorDouble vecin,
const VectorInt vindex 
)
static

Reduce the input vector 'vecin' by suppressing the elements referred by 'index'

Parameters
vecinInput vector (double)
vindexVector of indices to be suppressed

◆ reduceOne()

VectorDouble VectorHelper::reduceOne ( const VectorDouble vecin,
int  index 
)
static

Reduce the input vector 'vecin' by suppressing the element referred by 'index'

Parameters
vecinInput vector (double)
indexIndex to be suppressed

◆ reorder() [1/2]

VectorDouble VectorHelper::reorder ( const VectorDouble vecin,
const VectorInt order,
int  size = -1 
)
static

◆ reorder() [2/2]

VectorInt VectorHelper::reorder ( const VectorInt vecin,
const VectorInt order,
int  size = -1 
)
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]

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

◆ sequence() [2/2]

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

◆ simulateBernoulli()

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

◆ simulateGaussian()

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

◆ simulateGaussianInPlace()

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

◆ simulateUniform()

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

◆ sort() [1/2]

VectorDouble VectorHelper::sort ( const VectorDouble vecin,
bool  ascending = true,
int  size = -1 
)
static

◆ sort() [2/2]

VectorInt VectorHelper::sort ( const VectorInt vecin,
bool  ascending = true,
int  size = -1 
)
static

◆ sortInPlace() [1/2]

void VectorHelper::sortInPlace ( VectorDouble vecin,
bool  ascending = true,
int  size = -1 
)
static

◆ sortInPlace() [2/2]

void VectorHelper::sortInPlace ( VectorInt vecin,
bool  ascending = true,
int  size = -1 
)
static

◆ sortRanks()

VectorInt VectorHelper::sortRanks ( const VectorDouble vecin,
bool  ascending = true,
int  size = -1 
)
static

◆ squeezeAndStretchInPlaceBackward()

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'

◆ squeezeAndStretchInPlaceForward()

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'

◆ stdv()

double VectorHelper::stdv ( const VectorDouble vec,
bool  scaleByN = false 
)
static

◆ subtract() [1/2]

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

Return a vector containing vecb - veca

Parameters
vecaInput Vector
vecbInput Vector
Returns

◆ subtract() [2/2]

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

Return a vector containing vecb - veca (integer version)

Parameters
vecaInput Vector
vecbInput Vector
Returns

◆ subtractInPlace() [1/3]

void VectorHelper::subtractInPlace ( const VectorVectorDouble in1,
const VectorVectorDouble in2,
VectorVectorDouble outv 
)
static

◆ subtractInPlace() [2/3]

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

Performs: veca -= vecb

Parameters
destInput/Output vector
srcAuxiliary vector

◆ subtractInPlace() [3/3]

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

◆ suppressTest()

VectorDouble VectorHelper::suppressTest ( const VectorDouble vecin)
static

◆ toStringAsVD()

String VectorHelper::toStringAsVD ( const VectorDouble vec)
static

◆ toStringAsVI()

String VectorHelper::toStringAsVI ( const VectorInt vec)
static

◆ toStringAsVS()

String VectorHelper::toStringAsVS ( const VectorString vec)
static

◆ toStringAsVVD()

String VectorHelper::toStringAsVVD ( const VectorVectorDouble vec)
static

◆ transformVD()

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)

◆ truncateDecimalsInPlace()

void VectorHelper::truncateDecimalsInPlace ( VectorDouble vec,
int  ndec 
)
static

◆ truncateDigitsInPlace()

void VectorHelper::truncateDigitsInPlace ( VectorDouble vec,
int  ndec 
)
static

◆ unflatten()

VectorVectorDouble VectorHelper::unflatten ( const VectorDouble vd,
const VectorInt sizes 
)
static

◆ unflattenInPlace()

void VectorHelper::unflattenInPlace ( const VectorDouble vd,
VectorVectorDouble vvd 
)
static

◆ unique() [1/2]

VectorDouble VectorHelper::unique ( const VectorDouble vecin,
int  size = -1 
)
static

◆ unique() [2/2]

VectorInt VectorHelper::unique ( const VectorInt vecin,
int  size = -1 
)
static

◆ variance()

double VectorHelper::variance ( const VectorDouble vec,
bool  scaleByN = false 
)
static

◆ whereElement()

int VectorHelper::whereElement ( const VectorInt tab,
int  target 
)
static

◆ whereMaximum()

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

◆ whereMinimum()

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: