1.10.1
CCC
 
Loading...
Searching...
No Matches
gstlrn::VectorHelper Class Reference

#include <VectorHelper.hpp>

Inheritance diagram for gstlrn::VectorHelper:
gstlrn::VH

Static Public Member Functions

static initVInt (Id nval, Id value=0.)
 
static initVDouble (Id nval, double value=0.)
 
static initVVDouble (Id nval1, Id nval2, double value=0.)
 
static initVVInt (Id nval1, Id nval2, Id value=0)
 
static initVInt (const Id *values, Id number)
 
static initVInt (const I32 *values, Id number)
 
static initVDouble (const double *values, Id number)
 
static initVVDouble (const double *value, Id n1, Id n2)
 
static VectorString initVString (Id ntab, char **names)
 
static void dumpStats (const String &title, constvect vect, Id nmax=-1)
 
static void dumpRange (const String &title, constvect vect, Id nmax=-1)
 
static void dumpStats (const String &title, const 1 &vectin, Id nmax=-1)
 
static void dumpRange (const String &title, const 1 &vectin, Id nmax=-1)
 
static void dumpRange (const String &title, const 1 &vect)
 
static void dumpNNZ (const String &title, const 1 &vect, Id nclass=10)
 
static void capInPlace (1 &vec, double vmin=TEST, double vmax=TEST)
 
static void capInPlaceVVD (1 &vec, double vmin=TEST, double vmax=TEST)
 
static double extensionDiagonal (const 1 &mini, const 1 &maxi)
 
static Id count (const 1 &vec)
 
static double cumulLog (const 1 &vec)
 
static cumulIncrement (const 1 &vec)
 
static quantiles (const 1 &vec, const 1 &probas)
 
static bool isEqual (const 1 &v1, const 1 &v2, double eps=EPSILON10)
 
static bool isEqualExtended (const 1 &v1, const 1 &v2, double eps=EPSILON10, bool flagRelative=true, bool flagAbsolute=false, const String &string="")
 Function checking that two values are equal This verbose option is essentially used in tests.
 
static void sequenceInPlace (Id n, 1 &vec)
 
static sequence (Id number, Id ideb=0, Id step=1)
 
static sequenceVD (double valFrom, double valTo, double valStep=1., double ratio=1.)
 
static void fillUndef (1 &vec, double repl)
 
static void addMultiplyConstantInPlace (double val1, const constvect in, vect out, Id iad)
 
static double innerProductCV (const constvect veca, const constvect vecb)
 
static void addMultiplyVectVectInPlace (const constvect in1, const constvect in2, vect out, Id iad)
 
static void addInPlace (constvect in, vect dest)
 
static void addInPlace (const double *veca, const double *vecb, double *res, Id size)
 
static void addSquareInPlace (1 &dest, const 1 &src)
 
static subtract (constvect veca, constvect vecb)
 
static void subtractInPlace (const constvect in1, const constvect in2, vect outv)
 
static void multiplyComplexInPlace (const 1 &vecaRe, const 1 &vecaIm, const 1 &vecbRe, const 1 &vecbIm, 1 &resRe, 1 &resIm)
 
static void addMultiplyConstantInPlace (double val1, const 1 &in1, 1 &outv, Id iad)
 
static void addMultiplyConstantInPlace (double val1, const 1 &in1, 1 &outv)
 
static void copy (const 1 &vecin, 1 &vecout, Id size=-1)
 
static void copy (const 1 &vecin, 1 &vecout, Id size=-1)
 
static void copy (const 1 &inv, 1 &outv)
 
static void mean1AndMean2ToStdev (const 1 &mean1, const 1 &mean2, 1 &std, Id number)
 
static void normalize (double *tab, Id ntab)
 
static void normalizeFromGaussianDistribution (1 &vec, double mini=0., double maxi=1.)
 
static normalScore (const 1 &data, const 1 &wt=1())
 
static qnormVec (const 1 &vec)
 
static pnormVec (const 1 &vec)
 
static concatenate (const 1 &veca, const 1 &vecb)
 
static void concatenateInPlace (1 &veca, const 1 &vecb)
 
static power (const 1 &vec, double power)
 
static inverse (const 1 &vec)
 
static void power (1 &res, const constvect vec, double power)
 
static void inverse (1 &res, const constvect vec)
 
static double innerProduct (const double *veca, const double *vecb, Id size=-1)
 
static crossProduct3D (const 1 &veca, const 1 &vecb)
 
static void crossProduct3DInPlace (const double *a, const double *b, double *v)
 
static cumsum (const 1 &vecin, bool flagAddZero, bool revert=false)
 
static void cumulateInPlace (1 &vec)
 
static void cumulate (1 &veca, const 1 &vecb, double coeff=1., double addval=0.)
 
static void getMostSignificant (const 1 &vec, double tol=EPSILON6, Id nmax=-1)
 
static simulateUniform (Id n=1, double mini=0., double maxi=1.)
 
static simulateBernoulli (Id n=1, double proba=0.5, double vone=1., double velse=0.)
 
static simulateGaussian (Id n=1, double mean=0., double sigma=1.)
 
static void simulateGaussianInPlace (1 &vec, double mean=0., double sigma=1.)
 
static sampleRanks (Id ntotal, double proportion=0., Id number=0, Id seed=242141, Id optSort=0)
 
static void normalizeCodir (Id ndim, 1 &codir)
 
static bool isInList (const 1 &vec, Id item)
 
static sort (const 1 &vecin, bool ascending=true, Id size=-1)
 
static sort (const 1 &vecin, bool ascending=true, Id size=-1)
 
static void sortInPlace (1 &vecin, bool ascending=true, Id size=-1)
 
static void sortInPlace (1 &vecin, bool ascending=true, Id size=-1)
 
static bool isSorted (const 1 &vec, bool ascending=true)
 
static unique (const 1 &vecin, Id size=-1)
 
static unique (const 1 &vecin, Id size=-1)
 
static orderRanks (const 1 &vecin, bool ascending=true, Id size=-1)
 
static orderRanks (const 1 &vecin, bool ascending=true, Id size=-1)
 
static sortRanks (const 1 &vecin, bool ascending=true, Id size=-1)
 
static reorder (const 1 &vecin, const 1 &order, Id size=-1)
 
static reorder (const 1 &vecin, const 1 &order, Id size=-1)
 
static revert (const 1 &vecin)
 
static revert (const 1 &vecin)
 
static sample (const 1 &vecin, const 1 &indKeep)
 Create an output VectorDouble by selecting some indices of the Input VectorDouble 'vecin'.
 
static void arrangeInPlace (Id safe, 1 &ranks, 1 &values, bool ascending=true, Id size=-1)
 Arrange values in place (VectorDouble version)
 
static void arrangeInPlace (Id safe, 1 &ranks, 1 &values, bool ascending=true, Id size=-1)
 
static filter (const 1 &vecin, Id vmin=ITEST, Id vmax=ITEST, bool ascending=true)
 
static complement (const 1 &vec, const 1 &sel)
 
static std::pair< double, double > rangeVals (const 1 &vec)
 
static void unflattenInPlace (const 1 &vd, 1 &vvd)
 
static void flattenInPlace (const 1 &vvd, 1 &vd)
 
static flatten (const 1 &vvd)
 
static unflatten (const 1 &vd, const 1 &sizes)
 
static void linearCombinationInPlace (double val1, const 1 &vd1, double val2, const 1 &vd2, 1 &outv)
 
static void linearCombinationVVDInPlace (double val1, const 1 &vvd1, double val2, const 1 &vvd2, 1 &outv)
 
static suppressTest (const 1 &vecin)
 
static void extractInPlace (const 1 &vecin, 1 &vecout, Id start)
 
static void mergeInPlace (const 1 &vecin, 1 &vecout, Id start)
 
static void transformVD (1 &tab, Id oper_choice=1)
 
static void squeezeAndStretchInPlaceForward (const 1 &vecin, 1 &vecout, double origin, double mesh, double top, double bot)
 
static void squeezeAndStretchInPlaceBackward (const 1 &vecin, 1 &vecout, double origin, double mesh, double top, double bot)
 
static Id whereMinimum (const 1 &tab)
 
static Id whereMaximum (const 1 &tab)
 
static Id whereElement (const 1 &tab, Id target)
 
static Id whereElement (const 1 &tab, Id target, Id start)
 
static bool isIsotropic (const 1 &sampleRanks)
 
static reduceOne (const 1 &vecin, Id index)
 
static reduce (const 1 &vecin, const 1 &vindex)
 
static compress (const 1 &vecin, const 1 &vindex)
 
static void truncateDecimalsInPlace (1 &vec, Id ndec)
 
static void truncateDigitsInPlace (1 &vec, Id ndec)
 

Member Function Documentation

◆ addInPlace() [1/2]

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

◆ addInPlace() [2/2]

void gstlrn::VectorHelper::addInPlace ( constvect  in,
vect  dest 
)
static

◆ addMultiplyConstantInPlace() [1/3]

void gstlrn::VectorHelper::addMultiplyConstantInPlace ( double  val1,
const 1 &  in1,
1 &  outv 
)
static

◆ addMultiplyConstantInPlace() [2/3]

void gstlrn::VectorHelper::addMultiplyConstantInPlace ( double  val1,
const 1 &  in1,
1 &  outv,
Id  iad 
)
static

◆ addMultiplyConstantInPlace() [3/3]

void gstlrn::VectorHelper::addMultiplyConstantInPlace ( double  val1,
const constvect  in,
vect  out,
Id  iad 
)
static

◆ addMultiplyVectVectInPlace()

void gstlrn::VectorHelper::addMultiplyVectVectInPlace ( const constvect  in1,
const constvect  in2,
vect  out,
Id  iad 
)
static

◆ addSquareInPlace()

void gstlrn::VectorHelper::addSquareInPlace ( 1 &  dest,
const 1 &  src 
)
static

Performs: veca += vecb**2

Parameters
destInput/Output vector
srcAuxiliary vector

◆ arrangeInPlace() [1/2]

void gstlrn::VectorHelper::arrangeInPlace ( Id  safe,
1 &  ranks,
1 &  values,
bool  ascending = true,
Id  size = -1 
)
static

Arrange values in place (VectorDouble version)

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 Id array
[out]valuesinput and output double array
Remarks
If ranks = NULL, ranks is ignored
When using 'size', the remaining part of arrays is unchanged

Sorts the static_cast<Id>(array) value() and the array ranks() if provided This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ arrangeInPlace() [2/2]

static void gstlrn::VectorHelper::arrangeInPlace ( Id  safe,
1 &  ranks,
1 &  values,
bool  ascending = true,
Id  size = -1 
)
static

◆ capInPlace()

void gstlrn::VectorHelper::capInPlace ( 1 &  vec,
double  vmin = TEST,
double  vmax = TEST 
)
static

◆ capInPlaceVVD()

void gstlrn::VectorHelper::capInPlaceVVD ( 1 &  vec,
double  vmin = TEST,
double  vmax = TEST 
)
static

◆ complement()

gstlrn::VectorHelper::complement ( const 1 &  vec,
const 1 &  sel 
)
static

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

Parameters
vecInitial list
selVector of forbidden elements
Returns
Complementary list

◆ compress()

gstlrn::VectorHelper::compress ( const 1 &  vecin,
const 1 &  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()

gstlrn::VectorHelper::concatenate ( const 1 &  veca,
const 1 &  vecb 
)
static

◆ concatenateInPlace()

void gstlrn::VectorHelper::concatenateInPlace ( 1 &  veca,
const 1 &  vecb 
)
static

◆ copy() [1/3]

void gstlrn::VectorHelper::copy ( const 1 &  inv,
1 &  outv 
)
static

◆ copy() [2/3]

void gstlrn::VectorHelper::copy ( const 1 &  vecin,
1 &  vecout,
Id  size = -1 
)
static

◆ copy() [3/3]

static void gstlrn::VectorHelper::copy ( const 1 &  vecin,
1 &  vecout,
Id  size = -1 
)
static

◆ count()

Id gstlrn::VectorHelper::count ( const 1 &  vec)
static

◆ crossProduct3D()

gstlrn::VectorHelper::crossProduct3D ( const 1 &  veca,
const 1 &  vecb 
)
static

Cross product (limited to 3D)

Parameters
vecaFirst vector
vecbSecond Vector
Returns

◆ crossProduct3DInPlace()

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

◆ cumsum()

gstlrn::VectorHelper::cumsum ( const 1 &  vecin,
bool  flagAddZero,
bool  revert = false 
)
static

◆ cumulate()

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

◆ cumulateInPlace()

void gstlrn::VectorHelper::cumulateInPlace ( 1 &  vec)
static

◆ cumulIncrement()

gstlrn::VectorHelper::cumulIncrement ( const 1 &  vec)
static

◆ cumulLog()

double gstlrn::VectorHelper::cumulLog ( const 1 &  vec)
static

◆ dumpNNZ()

void gstlrn::VectorHelper::dumpNNZ ( const String title,
const 1 &  vect,
Id  nclass = 10 
)
static

◆ dumpRange() [1/3]

void gstlrn::VectorHelper::dumpRange ( const String title,
const 1 &  vect 
)
static

◆ dumpRange() [2/3]

void gstlrn::VectorHelper::dumpRange ( const String title,
const 1 &  vectin,
Id  nmax = -1 
)
static

◆ dumpRange() [3/3]

void gstlrn::VectorHelper::dumpRange ( const String title,
constvect  vect,
Id  nmax = -1 
)
static

◆ dumpStats() [1/2]

void gstlrn::VectorHelper::dumpStats ( const String title,
const 1 &  vectin,
Id  nmax = -1 
)
static

◆ dumpStats() [2/2]

void gstlrn::VectorHelper::dumpStats ( const String title,
constvect  vect,
Id  nmax = -1 
)
static

◆ extensionDiagonal()

double gstlrn::VectorHelper::extensionDiagonal ( const 1 &  mini,
const 1 &  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 gstlrn::VectorHelper::extractInPlace ( const 1 &  vecin,
1 &  vecout,
Id  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')

◆ fillUndef()

void gstlrn::VectorHelper::fillUndef ( 1 &  vec,
double  repl 
)
static

◆ filter()

gstlrn::VectorHelper::filter ( const 1 &  vecin,
Id  vmin = ITEST,
Id  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()

gstlrn::VectorHelper::flatten ( const 1 &  vvd)
static

Method which flattens a VectorVectorDouble into a VectorDouble

Parameters
vvdInput VectorVectorDouble
Returns
Returned VectorDouble

◆ flattenInPlace()

void gstlrn::VectorHelper::flattenInPlace ( const 1 &  vvd,
1 &  vd 
)
static

◆ getMostSignificant()

void gstlrn::VectorHelper::getMostSignificant ( const 1 &  vec,
double  tol = EPSILON6,
Id  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)

◆ initVDouble() [1/2]

gstlrn::VectorHelper::initVDouble ( const double *  values,
Id  number 
)
static

◆ initVDouble() [2/2]

gstlrn::VectorHelper::initVDouble ( Id  nval,
double  value = 0. 
)
static

◆ initVInt() [1/3]

gstlrn::VectorHelper::initVInt ( const I32 values,
Id  number 
)
static

◆ initVInt() [2/3]

gstlrn::VectorHelper::initVInt ( const Id values,
Id  number 
)
static

◆ initVInt() [3/3]

gstlrn::VectorHelper::initVInt ( Id  nval,
Id  value = 0. 
)
static

◆ initVString()

VectorString gstlrn::VectorHelper::initVString ( Id  ntab,
char **  names 
)
static

◆ initVVDouble() [1/2]

gstlrn::VectorHelper::initVVDouble ( const double *  value,
Id  n1,
Id  n2 
)
static

◆ initVVDouble() [2/2]

gstlrn::VectorHelper::initVVDouble ( Id  nval1,
Id  nval2,
double  value = 0. 
)
static

◆ initVVInt()

gstlrn::VectorHelper::initVVInt ( Id  nval1,
Id  nval2,
Id  value = 0 
)
static

◆ innerProduct()

double gstlrn::VectorHelper::innerProduct ( const double *  veca,
const double *  vecb,
Id  size = -1 
)
static

◆ innerProductCV()

double gstlrn::VectorHelper::innerProductCV ( const constvect  veca,
const constvect  vecb 
)
static

◆ inverse() [1/2]

void gstlrn::VectorHelper::inverse ( 1 &  res,
const constvect  vec 
)
static

◆ inverse() [2/2]

gstlrn::VectorHelper::inverse ( const 1 &  vec)
static

◆ isEqual()

bool gstlrn::VectorHelper::isEqual ( const 1 &  v1,
const 1 &  v2,
double  eps = EPSILON10 
)
static

◆ isEqualExtended()

bool gstlrn::VectorHelper::isEqualExtended ( const 1 &  v1,
const 1 &  v2,
double  eps = EPSILON10,
bool  flagRelative = true,
bool  flagAbsolute = false,
const String string = "" 
)
static

Function checking that two values are equal This verbose option is essentially used in tests.

Parameters
v1First value to be compared
v2Second value to be compared
epsTolerance used for comparison
flagRelativewhen True, the values are compared without paying attention to their sign
flagAbsolutewhen True, test is run on absolute difference
stringMessage to be displayed when the vectors are not similar
Returns
Boolean
Note
: When the two vectors do not share the same dimension, the test is not performed and a message is printed.

◆ isInList()

bool gstlrn::VectorHelper::isInList ( const 1 &  vec,
Id  item 
)
static

◆ isIsotropic()

bool gstlrn::VectorHelper::isIsotropic ( const 1 &  sampleRanks)
static

◆ isSorted()

bool gstlrn::VectorHelper::isSorted ( const 1 &  vec,
bool  ascending = true 
)
static

◆ linearCombinationInPlace()

void gstlrn::VectorHelper::linearCombinationInPlace ( double  val1,
const 1 &  vd1,
double  val2,
const 1 &  vd2,
1 &  outv 
)
static

◆ linearCombinationVVDInPlace()

void gstlrn::VectorHelper::linearCombinationVVDInPlace ( double  val1,
const 1 &  vvd1,
double  val2,
const 1 &  vvd2,
1 &  outv 
)
static

◆ mean1AndMean2ToStdev()

void gstlrn::VectorHelper::mean1AndMean2ToStdev ( const 1 &  mean1,
const 1 &  mean2,
1 &  std,
Id  number 
)
static

◆ mergeInPlace()

void gstlrn::VectorHelper::mergeInPlace ( const 1 &  vecin,
1 &  vecout,
Id  start 
)
static

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

Parameters
vecinInitial vector
vecoutVector where 'vecin' should be copied
startStarting address (in 'vecout')

◆ multiplyComplexInPlace()

void gstlrn::VectorHelper::multiplyComplexInPlace ( const 1 &  vecaRe,
const 1 &  vecaIm,
const 1 &  vecbRe,
const 1 &  vecbIm,
1 &  resRe,
1 &  resIm 
)
static

◆ normalize()

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

◆ normalizeCodir()

void gstlrn::VectorHelper::normalizeCodir ( Id  ndim,
1 &  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 gstlrn::VectorHelper::normalizeFromGaussianDistribution ( 1 &  vec,
double  mini = 0.,
double  maxi = 1. 
)
static

◆ normalScore()

gstlrn::VectorHelper::normalScore ( const 1 &  data,
const 1 &  wt = 1() 
)
static

◆ orderRanks() [1/2]

gstlrn::VectorHelper::orderRanks ( const 1 &  vecin,
bool  ascending = true,
Id  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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ orderRanks() [2/2]

static gstlrn::VectorHelper::orderRanks ( const 1 &  vecin,
bool  ascending = true,
Id  size = -1 
)
static

◆ pnormVec()

gstlrn::VectorHelper::pnormVec ( const 1 &  vec)
static

◆ power() [1/2]

void gstlrn::VectorHelper::power ( 1 &  res,
const constvect  vec,
double  power 
)
static

◆ power() [2/2]

gstlrn::VectorHelper::power ( const 1 &  vec,
double  power 
)
static

◆ qnormVec()

gstlrn::VectorHelper::qnormVec ( const 1 &  vec)
static

◆ quantiles()

gstlrn::VectorHelper::quantiles ( const 1 &  vec,
const 1 &  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 > gstlrn::VectorHelper::rangeVals ( const 1 &  vec)
static

◆ reduce()

gstlrn::VectorHelper::reduce ( const 1 &  vecin,
const 1 &  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()

gstlrn::VectorHelper::reduceOne ( const 1 &  vecin,
Id  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]

gstlrn::VectorHelper::reorder ( const 1 &  vecin,
const 1 &  order,
Id  size = -1 
)
static

◆ reorder() [2/2]

static gstlrn::VectorHelper::reorder ( const 1 &  vecin,
const 1 &  order,
Id  size = -1 
)
static

◆ revert() [1/2]

gstlrn::VectorHelper::revert ( const 1 &  vecin)
static

◆ revert() [2/2]

static gstlrn::VectorHelper::revert ( const 1 &  vecin)
static

◆ sample()

gstlrn::VectorHelper::sample ( const 1 &  vecin,
const 1 &  indKeep 
)
static

Create an output VectorDouble by selecting some indices of the Input VectorDouble 'vecin'.

Parameters
vecinInput Rectangular Matrix
indKeepSet of Indices to be kept (all if not defined)

◆ sampleRanks()

gstlrn::VectorHelper::sampleRanks ( Id  ntotal,
double  proportion = 0.,
Id  number = 0,
Id  seed = 242141,
Id  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()

gstlrn::VectorHelper::sequence ( Id  number,
Id  ideb = 0,
Id  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

◆ sequenceInPlace()

void gstlrn::VectorHelper::sequenceInPlace ( Id  n,
1 &  vec 
)
static

◆ sequenceVD()

gstlrn::VectorHelper::sequenceVD ( 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

◆ simulateBernoulli()

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

◆ simulateGaussian()

gstlrn::VectorHelper::simulateGaussian ( Id  n = 1,
double  mean = 0.,
double  sigma = 1. 
)
static

◆ simulateGaussianInPlace()

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

◆ simulateUniform()

gstlrn::VectorHelper::simulateUniform ( Id  n = 1,
double  mini = 0.,
double  maxi = 1. 
)
static

◆ sort() [1/2]

gstlrn::VectorHelper::sort ( const 1 &  vecin,
bool  ascending = true,
Id  size = -1 
)
static

◆ sort() [2/2]

static gstlrn::VectorHelper::sort ( const 1 &  vecin,
bool  ascending = true,
Id  size = -1 
)
static

◆ sortInPlace() [1/2]

void gstlrn::VectorHelper::sortInPlace ( 1 &  vecin,
bool  ascending = true,
Id  size = -1 
)
static

◆ sortInPlace() [2/2]

static void gstlrn::VectorHelper::sortInPlace ( 1 &  vecin,
bool  ascending = true,
Id  size = -1 
)
static

◆ sortRanks()

gstlrn::VectorHelper::sortRanks ( const 1 &  vecin,
bool  ascending = true,
Id  size = -1 
)
static

◆ squeezeAndStretchInPlaceBackward()

void gstlrn::VectorHelper::squeezeAndStretchInPlaceBackward ( const 1 &  vecin,
1 &  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 gstlrn::VectorHelper::squeezeAndStretchInPlaceForward ( const 1 &  vecin,
1 &  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'

◆ subtract()

gstlrn::VectorHelper::subtract ( constvect  veca,
constvect  vecb 
)
static

Return a vector containing vecb - veca

Parameters
vecaInput Vector
vecbInput Vector
Returns

◆ subtractInPlace()

void gstlrn::VectorHelper::subtractInPlace ( const constvect  in1,
const constvect  in2,
vect  outv 
)
static

Performs: outv = in2 - in1

Parameters
in1Input vector
in2Input vector
outvOutput vector

◆ suppressTest()

gstlrn::VectorHelper::suppressTest ( const 1 &  vecin)
static

◆ transformVD()

void gstlrn::VectorHelper::transformVD ( 1 &  tab,
Id  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 gstlrn::VectorHelper::truncateDecimalsInPlace ( 1 &  vec,
Id  ndec 
)
static

◆ truncateDigitsInPlace()

void gstlrn::VectorHelper::truncateDigitsInPlace ( 1 &  vec,
Id  ndec 
)
static

◆ unflatten()

gstlrn::VectorHelper::unflatten ( const 1 &  vd,
const 1 &  sizes 
)
static

◆ unflattenInPlace()

void gstlrn::VectorHelper::unflattenInPlace ( const 1 &  vd,
1 &  vvd 
)
static

◆ unique() [1/2]

gstlrn::VectorHelper::unique ( const 1 &  vecin,
Id  size = -1 
)
static

◆ unique() [2/2]

static gstlrn::VectorHelper::unique ( const 1 &  vecin,
Id  size = -1 
)
static

◆ whereElement() [1/2]

Id gstlrn::VectorHelper::whereElement ( const 1 &  tab,
Id  target 
)
static

◆ whereElement() [2/2]

Id gstlrn::VectorHelper::whereElement ( const 1 &  tab,
Id  target,
Id  start 
)
static

◆ whereMaximum()

Id gstlrn::VectorHelper::whereMaximum ( const 1 &  tab)
static

Find the location of the maximum value within a vector

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

◆ whereMinimum()

Id gstlrn::VectorHelper::whereMinimum ( const 1 &  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: