bpp-core
2.2.0
|
#include <Bpp/Numeric/VectorTools.h>
Classes | |
class | order_Cmp_ |
Public Member Functions | |
VectorTools () | |
virtual | ~VectorTools () |
Static Public Member Functions | |
template<class T > | |
static void | fill (std::vector< T > &v, T value) |
template<class T > | |
static std::vector< T > | seq (T from, T to, T by) |
Build a sequence std::vector. More... | |
template<class T > | |
static size_t | which (const std::vector< T > &v, const T &which) throw (ElementNotFoundException<T> ) |
Send the position of the first occurence of 'which'. More... | |
template<class T > | |
static std::vector< size_t > | whichAll (const std::vector< T > &v, const T &which) throw (ElementNotFoundException<T> ) |
Send the positions of all occurences of 'which'. More... | |
template<class T > | |
static std::vector< T > | unique (const std::vector< T > &v) |
Send a new std::vector with unique elements. More... | |
template<class T > | |
static bool | isUnique (const std::vector< T > &v) |
Tell if the std::vector as unique elements. More... | |
template<class T > | |
static std::vector< T > | extract (const std::vector< T > &v1, const std::vector< int > &v2) |
template<class T > | |
static std::map< T, size_t > | countValues (const std::vector< T > &v) |
Count each element of a std::vector. More... | |
static std::vector< double > | breaks (const std::vector< double > &v, unsigned int n) |
Get the break points for a given number of classes. More... | |
template<class T > | |
static size_t | nclassScott (const std::vector< T > &v) |
Get the optimal class number following Scott's method. More... | |
template<class T > | |
static T | prod (const std::vector< T > &v1) |
template<class T > | |
static std::vector< T > | cumProd (const std::vector< T > &v1) |
template<class T > | |
static T | sum (const std::vector< T > &v1) |
template<class T > | |
static std::vector< T > | cumSum (const std::vector< T > &v1) |
template<class T > | |
static void | logNorm (std::vector< T > &v) |
template<class T > | |
static T | logSumExp (const std::vector< T > &v1) |
template<class T > | |
static T | logSumExp (const std::vector< T > &v1, const std::vector< T > &v2) |
template<class T > | |
static T | logMeanExp (const std::vector< T > &v1) |
template<class T > | |
static T | sumExp (const std::vector< T > &v1) |
template<class T > | |
static T | sumExp (const std::vector< T > &v1, const std::vector< T > &v2) |
template<class T > | |
static std::string | paste (const std::vector< T > &v, const std::string &delim=" ") |
Concatenate a std::vector after converting to string. More... | |
template<class T > | |
static void | print (const std::vector< T > &v1, OutputStream &out= *ApplicationTools::message, const std::string &delim=" ") |
Print a std::vector to a stream. More... | |
template<class T > | |
static void | printForR (const std::vector< T > &v1, std::string variableName="x", std::ostream &out=std::cout) |
Print a std::vector to a stream in R format. More... | |
template<class InputType , class OutputType > | |
static OutputType | scalar (const std::vector< InputType > &v1, const std::vector< InputType > &v2) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | scalar (const std::vector< InputType > &v1, const std::vector< InputType > &v2, const std::vector< InputType > &w) throw (DimensionException) |
template<class T > | |
static std::vector< T > | kroneckerMult (const std::vector< T > &v1, const std::vector< T > &v2) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | norm (const std::vector< InputType > &v1) |
template<class InputType , class OutputType > | |
static OutputType | norm (const std::vector< InputType > &v1, const std::vector< InputType > &w) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | cos (const std::vector< InputType > &v1, const std::vector< InputType > &v2) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | cos (const std::vector< InputType > &v1, const std::vector< InputType > &v2, const std::vector< InputType > &w) throw (DimensionException) |
template<class T > | |
static std::vector< T > | abs (const std::vector< T > &v) throw (EmptyVectorException<T> ) |
Template function to get the absolute value of all elements of a std::vector. More... | |
template<class InputType , class OutputType > | |
static OutputType | mean (const std::vector< InputType > &v1) |
template<class InputType , class OutputType > | |
static OutputType | mean (const std::vector< InputType > &v1, const std::vector< InputType > &w, bool normalizeWeights=true) |
template<class InputType > | |
static InputType | median (std::vector< InputType > &v1) |
template<class InputType , class OutputType > | |
static std::vector< OutputType > | center (const std::vector< InputType > &v1) |
Set the mean of a std::vector to be 0. More... | |
template<class InputType , class OutputType > | |
static std::vector< OutputType > | center (const std::vector< InputType > &v1, const std::vector< InputType > &w, bool normalizeWeights=true) |
Set the weighted mean of a std::vector to be 0. More... | |
template<class InputType , class OutputType > | |
static OutputType | cov (const std::vector< InputType > &v1, const std::vector< InputType > &v2, bool unbiased=true) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | cov (const std::vector< InputType > &v1, const std::vector< InputType > &v2, const std::vector< InputType > &w, bool unbiased=true, bool normalizeWeights=true) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | var (const std::vector< InputType > &v1, bool unbiased=true) |
template<class InputType , class OutputType > | |
static OutputType | var (const std::vector< InputType > &v1, const std::vector< InputType > &w, bool unbiased=true, bool normalizeWeights=true) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | sd (const std::vector< InputType > &v1, bool unbiased=true) |
template<class InputType , class OutputType > | |
static OutputType | sd (const std::vector< InputType > &v1, const std::vector< InputType > &w, bool unbiased=true, bool normalizeWeights=true) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | cor (const std::vector< InputType > &v1, const std::vector< InputType > &v2) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | cor (const std::vector< InputType > &v1, const std::vector< InputType > &v2, const std::vector< InputType > &w, bool normalizeWeights=true) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | shannon (const std::vector< InputType > &v, double base=2.7182818) |
template<class InputType , class OutputType > | |
static OutputType | shannonDiscrete (const std::vector< InputType > &v, double base=2.7182818) |
template<class InputType , class OutputType > | |
static OutputType | miDiscrete (const std::vector< InputType > &v1, const std::vector< InputType > &v2, double base=2.7182818) throw (DimensionException) |
template<class InputType , class OutputType > | |
static OutputType | shannonContinuous (const std::vector< InputType > &v, double base=2.7182818) |
template<class InputType , class OutputType > | |
static OutputType | miContinuous (const std::vector< InputType > &v1, const std::vector< InputType > &v2, double base=2.7182818) throw (DimensionException) |
template<class T > | |
static bool | haveSameElements (const std::vector< T > &v1, const std::vector< T > &v2) |
template<class T > | |
static bool | haveSameElements (std::vector< T > &v1, std::vector< T > &v2) |
template<class T > | |
static bool | contains (const std::vector< T > &vec, T el) |
template<class T > | |
static bool | containsAll (std::vector< T > &v1, std::vector< T > &v2) |
template<class T > | |
static std::vector< T > | vectorUnion (const std::vector< T > &vec1, const std::vector< T > &vec2) |
template<class T > | |
static std::vector< T > | vectorUnion (const std::vector< std::vector< T > > &vecElementL) |
template<class T > | |
static std::vector< T > | vectorIntersection (const std::vector< T > &vec1, const std::vector< T > &vec2) |
template<class T > | |
static std::vector< T > | vectorIntersection (const std::vector< std::vector< T > > &vecElementL) |
template<class T > | |
static void | append (std::vector< T > &vec1, const std::vector< T > &vec2) |
Append the content of a std::vector to another one. More... | |
template<class T > | |
static void | prepend (std::vector< T > &vec1, const std::vector< T > &vec2) |
Prepend the content of a std::vector to another one. More... | |
template<class T > | |
static std::vector< T > | append (const std::vector< std::vector< T > > &vecElementL) |
template<class T > | |
static void | extend (std::vector< T > &vec1, const std::vector< T > &vec2) |
Extend the content of a std::vector with another one. Only the elements not present in the first vector will be added. More... | |
template<class T > | |
static std::vector< T > | rep (const std::vector< T > &vec, size_t n) |
template<class T > | |
static void | diff (std::vector< T > &v1, std::vector< T > &v2, std::vector< T > &v3) |
This function returns the difference of two std::vectors. More... | |
static bool | test () |
Test function. More... | |
Matrix-like functions to resize arrays. | |
template<class T > | |
static void | resize2 (VVdouble &vv, size_t n1, size_t n2) |
template<class T > | |
static void | resize3 (VVVdouble &vvv, size_t n1, size_t n2, size_t n3) |
static void | resize4 (VVVVdouble &vvvv, size_t n1, size_t n2, size_t n3, size_t n4) |
These methods apply the corresponding function to each element | |
and return the result in a new std::vector. | |
template<class T > | |
static std::vector< double > | log (const std::vector< T > &v1) |
template<class T > | |
static std::vector< double > | log (const std::vector< T > &v1, double base) |
template<class T > | |
static std::vector< double > | exp (const std::vector< T > &v1) |
template<class T > | |
static std::vector< double > | cos (const std::vector< T > &v1) |
template<class T > | |
static std::vector< double > | sin (const std::vector< T > &v1) |
template<class T > | |
static std::vector< double > | log10 (const std::vector< T > &v1) |
template<class T > | |
static std::vector< T > | fact (const std::vector< T > &v1) |
template<class T > | |
static std::vector< T > | sqr (const std::vector< T > &v1) |
template<class T > | |
static std::vector< T > | pow (const std::vector< T > &v1, T &b) |
Extrema. | |
template<class T > | |
static T | min (const std::vector< T > &v) throw (EmptyVectorException<T> ) |
Template function to get the minimum value of a std::vector. More... | |
template<class T > | |
static T | max (const std::vector< T > &v) throw (EmptyVectorException<T> ) |
Template function to get the maximum value of a std::vector. More... | |
template<class T > | |
static size_t | whichMax (const std::vector< T > &v) throw (EmptyVectorException<T> ) |
Template function to get the index of the maximum value of a std::vector. More... | |
template<class T > | |
static size_t | whichMin (const std::vector< T > &v) throw (EmptyVectorException<T> ) |
Template function to get the index of the minimum value of a std::vector. More... | |
template<class T > | |
static std::vector< size_t > | whichMaxAll (const std::vector< T > &v) throw (EmptyVectorException<T> ) |
Template function to get the indices of the maximum value of a std::vector. More... | |
template<class T > | |
static std::vector< size_t > | whichMinAll (const std::vector< T > &v) throw (EmptyVectorException<T> ) |
Template function to get the indices of the minimum value of a std::vector. More... | |
template<class T > | |
static std::vector< T > | range (const std::vector< T > &v) throw (EmptyVectorException<T> ) |
Template function to get both extrema of a std::vector. More... | |
template<class T > | |
static std::vector< size_t > | order (const std::vector< T > &v) throw (EmptyVectorException<T> ) |
Template function to get the order of elements in the input vector. More... | |
Definition at line 329 of file VectorTools.h.
|
inline |
Definition at line 332 of file VectorTools.h.
|
inlinevirtual |
Definition at line 333 of file VectorTools.h.
|
inlinestatic |
Template function to get the absolute value of all elements of a std::vector.
v | The input std::vector. |
Definition at line 1256 of file VectorTools.h.
|
inlinestatic |
Append the content of a std::vector to another one.
vec1 | Vector 1. |
vec2 | Vector 2. |
Definition at line 1835 of file VectorTools.h.
Referenced by diff(), bpp::AbstractParameterAliasable::getAlias(), and bpp::NumCalcApplicationTools::seqFromString().
|
inlinestatic |
vecElementL | A std::vector of std::vectors. |
Definition at line 1861 of file VectorTools.h.
|
static |
Get the break points for a given number of classes.
Given a std::vector of values, return the values that cut the range of values in a given number of classes.
v | The std::vector to parse. |
n | The expected number of classes. |
Definition at line 53 of file VectorTools.cpp.
References range().
|
inlinestatic |
Set the mean of a std::vector to be 0.
v1 | A std::vector. |
Definition at line 1327 of file VectorTools.h.
|
inlinestatic |
Set the weighted mean of a std::vector to be 0.
v1 | A std::vector. |
w | A std::vector of weights. |
normalizeWeights | Tell if weights should be normalized so that they sum to 1. |
Definition at line 1346 of file VectorTools.h.
|
inlinestatic |
vec | The std::vector to check. |
el | The element to look for. |
Definition at line 1721 of file VectorTools.h.
Referenced by extend(), vectorIntersection(), and vectorUnion().
|
inlinestatic |
v1 | The first std::vector to check. |
v2 | The second std::vector to check. |
Definition at line 1739 of file VectorTools.h.
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
DimensionException | If the two std::vector do not have the same length. |
Definition at line 1473 of file VectorTools.h.
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
w | A std::vector of weights. |
normalizeWeights | Tell if weights should be normalized so that they sum to 1. |
DimensionException | If the two std::vector do not have the same length. |
Definition at line 1488 of file VectorTools.h.
References sum().
|
inlinestatic |
Definition at line 784 of file VectorTools.h.
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
DimensionException | If the two std::vector do not have the same length. |
Definition at line 1012 of file VectorTools.h.
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
w | A std::vector of weights. |
DimensionException | If the two std::vector do not have the same length. |
Definition at line 1026 of file VectorTools.h.
|
inlinestatic |
Count each element of a std::vector.
v | the std::vector to parse. |
Definition at line 540 of file VectorTools.h.
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
unbiased | Tell if an unbiased estimate must be computed. |
DimensionException | If the two std::vector do not have the same length. |
Definition at line 1365 of file VectorTools.h.
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
w | A std::vector of weights. |
unbiased | Tell if an unbiased estimate must be computed. |
normalizeWeights | Tell if weights should be normalized so that they sum to 1. |
DimensionException | If the two std::vector do not have the same length. |
Definition at line 1387 of file VectorTools.h.
|
inlinestatic |
v1 | A std::vector. |
Definition at line 600 of file VectorTools.h.
|
inlinestatic |
v1 | A std::vector. |
Definition at line 627 of file VectorTools.h.
Referenced by bpp::RandomTools::pickOne().
|
inlinestatic |
This function returns the difference of two std::vectors.
v1 | First std::vector. |
v2 | Second std::vector. |
v3 | A std::vector to be populated with all elements in v1 that are not found in v2. |
Definition at line 1917 of file VectorTools.h.
References append().
|
inlinestatic |
Definition at line 776 of file VectorTools.h.
Referenced by bpp::MatrixTools::exp().
|
inlinestatic |
Extend the content of a std::vector with another one. Only the elements not present in the first vector will be added.
vec1 | Vector 1. |
vec2 | Vector 2. |
Definition at line 1879 of file VectorTools.h.
References contains().
|
inlinestatic |
v1 | the std::vector of elements, |
v2 | the std::vector of the selected positions |
Definition at line 523 of file VectorTools.h.
|
inlinestatic |
Definition at line 808 of file VectorTools.h.
|
inlinestatic |
Definition at line 381 of file VectorTools.h.
Referenced by bpp::PrincipalComponentAnalysis::PrincipalComponentAnalysis().
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
Definition at line 1688 of file VectorTools.h.
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
Definition at line 1707 of file VectorTools.h.
|
inlinestatic |
Tell if the std::vector as unique elements.
The input std::vector is copied, and the copy is sorted using QuickSort algorithm. A one-pass loop then look for duplicates.
If v is empty, the method returns 'true'.
v | the std::vector to parse. |
Definition at line 503 of file VectorTools.h.
Referenced by bpp::DataTable::setColumnNames(), and bpp::DataTable::setRowNames().
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
DimensionException | If the two std::vector do not have the same length. |
Definition at line 952 of file VectorTools.h.
|
inlinestatic |
Definition at line 761 of file VectorTools.h.
|
inlinestatic |
Definition at line 768 of file VectorTools.h.
|
inlinestatic |
Definition at line 800 of file VectorTools.h.
|
inlinestatic |
v1 | a std::vector. |
Definition at line 701 of file VectorTools.h.
References max().
|
inlinestatic |
v | std::vector. |
Definition at line 643 of file VectorTools.h.
References max().
|
inlinestatic |
v1 | a std::vector. |
Definition at line 660 of file VectorTools.h.
References max().
|
inlinestatic |
v1 | a std::vector. |
v2 | another std::vector. |
Definition at line 678 of file VectorTools.h.
References max().
|
inlinestatic |
Template function to get the maximum value of a std::vector.
The > operator must be defined for the specified class.
v | The input std::vector. |
EmptyVectorException | If the input std::vector is empty. |
Definition at line 1069 of file VectorTools.h.
Referenced by logMeanExp(), logNorm(), logSumExp(), sumExp(), and whichMaxAll().
|
inlinestatic |
v1 | A std::vector. |
Definition at line 1271 of file VectorTools.h.
|
inlinestatic |
v1 | A std::vector. |
w | A std::vector of weights. |
normalizeWeights | Tell if weights should be normalized so that they sum to 1. |
Definition at line 1282 of file VectorTools.h.
References sum().
|
inlinestatic |
v1 | A std::vector. |
Definition at line 1300 of file VectorTools.h.
|
inlinestatic |
This is the continuous version. Each vector is supposed to be a finite sample from a continuous distribution. The density is of the distribution is estimated using a kernel method, as well as the joint density, and are used to compute the continuous mutual information.
Reference: Ivan Kojadinovic (2004) Computational Statistics & Data Analysis, 46:269-294
v1 | The first input vector. |
v2 | The second input vector. |
base | The base of the logarithm to use. |
DimensionException | if the two vectors do not have the same lengths. |
Definition at line 1654 of file VectorTools.h.
References bpp::AdaptiveKernelDensityEstimation::kDensity().
|
inlinestatic |
This is the discrete version. Each vector is supposed to be a finite sample from a discrete distribution. The counts of each (joint) observed state are computed and used to compute the discrete mutual information.
v1 | The first input vector. |
v2 | The second input vector. |
base | The base of the logarithm to use. |
DimensionException | if the two vectors do not have the same lengths. |
Definition at line 1575 of file VectorTools.h.
|
inlinestatic |
Template function to get the minimum value of a std::vector.
The < operator must be defined for the specified class.
v | The input std::vector. |
EmptyVectorException | If the input std::vector is empty. |
Definition at line 1048 of file VectorTools.h.
Referenced by whichMinAll().
|
inlinestatic |
Get the optimal class number following Scott's method.
Use Scott's (1979) method to compute the optimal class number for histogram.
Scott, D.W. (1979) On optimal and data-based histograms. Biometrika, 66, 605¿610.
v | The std::vector to parse. |
Definition at line 573 of file VectorTools.h.
References range().
|
inlinestatic |
v1 | A std::vector. |
Definition at line 973 of file VectorTools.h.
|
inlinestatic |
v1 | A std::vector. |
w | A std::vector of weights. |
DimensionException | If v1 and w do not have the same length. |
Definition at line 991 of file VectorTools.h.
|
inlinestatic |
Template function to get the order of elements in the input vector.
This function is equivalent to the R 'order' function. It will sort elements by increasing size, so that [0] in the resulting outptu vector is the indice of the minimum element in the input vector, [1] is the second minimum, etc.
v | The input std::vector. |
Definition at line 1232 of file VectorTools.h.
|
inlinestatic |
Concatenate a std::vector after converting to string.
v | The std::vector to concatenate. |
delim | A string which is used to separate the values (default is " "). |
Definition at line 839 of file VectorTools.h.
|
inlinestatic |
Definition at line 824 of file VectorTools.h.
Referenced by bpp::MatrixTools::pow().
|
inlinestatic |
Prepend the content of a std::vector to another one.
vec1 | Vector 1. |
vec2 | Vector 2. |
Definition at line 1850 of file VectorTools.h.
|
inlinestatic |
Print a std::vector to a stream.
v1 | A std::vector. |
out | A stream. |
delim | A string which is used to separate the values (default is " "). |
Definition at line 859 of file VectorTools.h.
|
inlinestatic |
Print a std::vector to a stream in R format.
v1 | A std::vector. |
variableName | the variable name (default "x"). |
out | A stream (default cout). |
Definition at line 877 of file VectorTools.h.
|
inlinestatic |
v1 | A std::vector. |
Definition at line 587 of file VectorTools.h.
|
inlinestatic |
Template function to get both extrema of a std::vector.
Both < and > operators must be defined for the specified class.
v | The input std::vector. |
Definition at line 1197 of file VectorTools.h.
Referenced by breaks(), and nclassScott().
|
inlinestatic |
vec | A std::vector. |
n | the number of repetitions |
Definition at line 1894 of file VectorTools.h.
|
inlinestatic |
Definition at line 342 of file VectorTools.h.
|
inlinestatic |
Definition at line 349 of file VectorTools.h.
|
inlinestatic |
Definition at line 362 of file VectorTools.h.
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
DimensionException | If the two std::vector do not have the same length. |
Definition at line 897 of file VectorTools.h.
|
inlinestatic |
This dt product correspond to the dot product <v1,v2> in the space defined by
v1 | First std::vector. |
v2 | Second std::vector. |
w | A std::vector of weights. |
DimensionException | If the two std::vector do not have the same length or do not match the length of the weights. |
Definition at line 927 of file VectorTools.h.
|
inlinestatic |
v1 | The sample std::vector. |
unbiased | Tell if an unbiased estimate must be computed. |
Definition at line 1447 of file VectorTools.h.
|
inlinestatic |
v1 | The sample std::vector. |
w | A std::vector of weights. |
unbiased | Tell if an unbiased estimate must be computed. |
normalizeWeights | Tell if weights should be normalized so that they sum to 1. |
DimensionException | If v1 and w do not have the same length. |
Definition at line 1461 of file VectorTools.h.
|
inlinestatic |
Build a sequence std::vector.
Build a std::vector from a value to another with a specified step. This works for numerical values for which additions, subtractions and division makes sens.
from | The begining. |
to | The end. |
by | The step. |
Definition at line 402 of file VectorTools.h.
Referenced by bpp::NumCalcApplicationTools::seqFromString().
|
inlinestatic |
The elements of the vector should contain frequencies of each modality of the variable and sum to one. This verification is left to the user though.
v | The input std::vector. |
base | The base of the logarithm to use. |
Definition at line 1518 of file VectorTools.h.
|
inlinestatic |
This is the continuous version. The vector is supposed to be a finite sample from a continuous distribution. The density is of the distribution is estimated using a kernel method, and is used to compute the continuous entropy.
Reference: Ivan Kojadinovic (2004) Computational Statistics & Data Analysis, 46:269-294
v | The input std::vector. |
base | The base of the logarithm to use. |
Definition at line 1616 of file VectorTools.h.
References bpp::AdaptiveKernelDensityEstimation::kDensity().
|
inlinestatic |
This is the discrete version. The vector is supposed to be a finite sample from a discrete distribution. The counts of each observed state are computed and used to compute the discrete entropy.
v | The input std::vector. |
base | The base of the logarithm to use. |
Definition at line 1543 of file VectorTools.h.
|
inlinestatic |
Definition at line 792 of file VectorTools.h.
|
inlinestatic |
Definition at line 816 of file VectorTools.h.
Referenced by cov().
|
inlinestatic |
v1 | A std::vector. |
Definition at line 614 of file VectorTools.h.
Referenced by bpp::PrincipalComponentAnalysis::center(), bpp::RescaledHmmLikelihood::computeD2Forward_(), bpp::RescaledHmmLikelihood::computeDForward_(), bpp::ContingencyTableGenerator::ContingencyTableGenerator(), bpp::ContingencyTableTest::ContingencyTableTest(), cor(), cov(), mean(), bpp::MixtureOfDiscreteDistributions::MixtureOfDiscreteDistributions(), bpp::RandomTools::randMultinomial(), bpp::PrincipalComponentAnalysis::scale(), bpp::Simplex::setFrequencies(), bpp::SimpleDiscreteDistribution::SimpleDiscreteDistribution(), and bpp::Simplex::Simplex().
|
inlinestatic |
v1 | a std::vector. |
Definition at line 719 of file VectorTools.h.
References max().
Referenced by bpp::LogsumHmmLikelihood::computeD2Forward_(), and bpp::LogsumHmmLikelihood::computeDForward_().
|
inlinestatic |
v1 | a std::vector. |
v2 | another std::vector. |
Definition at line 737 of file VectorTools.h.
References max().
|
static |
Test function.
Definition at line 68 of file VectorTools.cpp.
Referenced by vectorIntersection().
|
inlinestatic |
Send a new std::vector with unique elements.
The input std::vector is copied, and the copy is sorted using QuickSort algorithm. A one-pass loop then look for duplicates and copy unique element to a result std::vector. The output std::vector is hence sorted.
If v is empty, it is passed 'as is' in return (after being copied).
v | the std::vector to parse. |
Definition at line 478 of file VectorTools.h.
|
inlinestatic |
v1 | The sample std::vector. |
unbiased | Tell if an unbiased estimate must be computed. |
Definition at line 1423 of file VectorTools.h.
|
inlinestatic |
v1 | The sample std::vector. |
w | A std::vector of weights. |
unbiased | Tell if an unbiased estimate must be computed. |
normalizeWeights | Tell if weights should be normalized so that they sum to 1. |
DimensionException | If v1 and w do not have the same length. |
Definition at line 1436 of file VectorTools.h.
|
inlinestatic |
vec1 | Vector 1. |
vec2 | Vector 2. |
Definition at line 1797 of file VectorTools.h.
References contains().
|
inlinestatic |
vecElementL | A std::vector of std::vectors. |
Definition at line 1812 of file VectorTools.h.
References contains(), and test().
|
inlinestatic |
vec1 | Vector 1. |
vec2 | Vector 2. |
Definition at line 1760 of file VectorTools.h.
References contains().
|
inlinestatic |
vecElementL | A std::vector of std::vectors. |
Definition at line 1777 of file VectorTools.h.
References contains().
|
inlinestatic |
Send the position of the first occurence of 'which'.
Comparisons are performed using the == operator. Maximum complexity: O(v.size()).
v | The std::vector to search. |
which | The element to search. |
Definition at line 434 of file VectorTools.h.
Referenced by bpp::DataTable::deleteColumn(), bpp::DataTable::deleteRow(), bpp::DataTable::getColumn(), bpp::DataTable::getRow(), bpp::DataTable::operator()(), and whichAll().
|
inlinestatic |
Send the positions of all occurences of 'which'.
Comparisons are performed using the == operator. Complexity: O(v.size()).
v | The std::vector to search. |
which | The element to search. |
Definition at line 454 of file VectorTools.h.
References which().
|
inlinestatic |
Template function to get the index of the maximum value of a std::vector.
The > operator must be defined for the specified class. The position sent is the first one matching the maximum value.
v | The input std::vector. |
EmptyVectorException | If the input std::vector is empty. |
Definition at line 1091 of file VectorTools.h.
|
inlinestatic |
Template function to get the indices of the maximum value of a std::vector.
The > and == operator must be defined for the specified class. All positions matching the maximum value are returned.
v | The input std::vector. |
EmptyVectorException | If the input std::vector is empty. |
Definition at line 1145 of file VectorTools.h.
References max().
|
inlinestatic |
Template function to get the index of the minimum value of a std::vector.
The < operator must be defined for the specified class. The position sent is the first one matching the maximum value.
v | The input std::vector. |
EmptyVectorException | If the input std::vector is empty. |
Definition at line 1118 of file VectorTools.h.
|
inlinestatic |
Template function to get the indices of the minimum value of a std::vector.
The < and == operator must be defined for the specified class. All positions matching the maximum value are returned.
v | The input std::vector. |
EmptyVectorException | If the input std::vector is empty. |
Definition at line 1171 of file VectorTools.h.
References min().