bpp-core3
3.0.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) |
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) |
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< size_t > &v2) |
Takes elements of a vector given a vector of positions. More... | |
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 T | sumProd (const std::vector< T > &v1, const std::vector< T > &v2) |
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 | printRange (const std::vector< T > &v1, OutputStream &out= *ApplicationTools::message, const std::string &delim=",", const std::string &rangeDelim="-") |
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) |
template<class InputType , class OutputType > | |
static OutputType | scalar (const std::vector< InputType > &v1, const std::vector< InputType > &v2, const std::vector< InputType > &w) |
template<class T > | |
static std::vector< T > | kroneckerMult (const std::vector< T > &v1, const std::vector< T > &v2) |
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) |
template<class InputType , class OutputType > | |
static OutputType | cos (const std::vector< InputType > &v1, const std::vector< InputType > &v2) |
template<class InputType , class OutputType > | |
static OutputType | cos (const std::vector< InputType > &v1, const std::vector< InputType > &v2, const std::vector< InputType > &w) |
template<class T > | |
static std::vector< T > | abs (const std::vector< T > &v) |
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) |
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) |
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) |
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) |
template<class InputType , class OutputType > | |
static OutputType | cor (const std::vector< InputType > &v1, const std::vector< InputType > &v2) |
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) |
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) |
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) |
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 , class U > | |
static bool | contains (const std::vector< T > &vec, U 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 , class U > | |
static std::vector< T > | vectorIntersection (const std::vector< T > &vec1, const std::vector< U > &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. | |
static void | resize2 (VVdouble &vv, size_t n1, size_t n2) |
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< T > | log (const std::vector< T > &v1) |
template<class T > | |
static double | log (const T &x) |
template<class T > | |
static std::vector< double > | log (const std::vector< T > &v1, double base) |
template<class T > | |
static double | exp (const T &x) |
template<class T > | |
static std::vector< T > | 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) |
Template function to get the minimum value of a std::vector. More... | |
template<class T > | |
static T | max (const std::vector< T > &v) |
Template function to get the maximum value of a std::vector. More... | |
template<class T > | |
static size_t | whichMax (const std::vector< T > &v) |
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) |
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) |
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) |
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) |
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) |
Template function to get the order of elements in the input vector. More... | |
Definition at line 308 of file VectorTools.h.
|
inline |
Definition at line 311 of file VectorTools.h.
|
inlinevirtual |
Definition at line 312 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 1298 of file VectorTools.h.
|
inlinestatic |
Append the content of a std::vector to another one.
vec1 | Vector 1. |
vec2 | Vector 2. |
Definition at line 1899 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 1921 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 18 of file VectorTools.cpp.
References range().
Referenced by countValues().
|
inlinestatic |
Set the mean of a std::vector to be 0.
v1 | A std::vector. |
Definition at line 1369 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 1388 of file VectorTools.h.
|
inlinestatic |
vec | The std::vector to check. |
el | The element to look for. |
Definition at line 1764 of file VectorTools.h.
Referenced by extend(), bpp::DataTable::setRowName(), vectorIntersection(), and vectorUnion().
|
inlinestatic |
Definition at line 1774 of file VectorTools.h.
|
inlinestatic |
v1 | The first std::vector to check. |
v2 | The second std::vector to check. |
Definition at line 1792 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 1515 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 1530 of file VectorTools.h.
References sum().
|
inlinestatic |
Definition at line 801 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 1054 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 1068 of file VectorTools.h.
|
inlinestatic |
Count each element of a std::vector.
v | the std::vector to parse. |
Definition at line 510 of file VectorTools.h.
References breaks().
|
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 1407 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 1429 of file VectorTools.h.
|
inlinestatic |
v1 | A std::vector. |
Definition at line 573 of file VectorTools.h.
|
inlinestatic |
v1 | A std::vector. |
Definition at line 624 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 1977 of file VectorTools.h.
|
inlinestatic |
Definition at line 787 of file VectorTools.h.
Referenced by bpp::MatrixTools::exp(), and exp().
|
inlinestatic |
Definition at line 793 of file VectorTools.h.
References 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 1939 of file VectorTools.h.
References contains().
|
inlinestatic |
Takes elements of a vector given a vector of positions.
v1 | the std::vector of elements, |
v2 | the std::vector of the selected positions |
Definition at line 493 of file VectorTools.h.
|
inlinestatic |
Definition at line 825 of file VectorTools.h.
|
inlinestatic |
Definition at line 359 of file VectorTools.h.
Referenced by bpp::PrincipalComponentAnalysis::PrincipalComponentAnalysis().
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
Definition at line 1731 of file VectorTools.h.
|
inlinestatic |
v1 | First std::vector. |
v2 | Second std::vector. |
Definition at line 1750 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 471 of file VectorTools.h.
Referenced by bpp::DataTable::setColumnNames(), bpp::Table< T >::setColumnNames(), bpp::DataTable::setRowNames(), and bpp::Table< T >::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 994 of file VectorTools.h.
|
inlinestatic |
Definition at line 762 of file VectorTools.h.
|
inlinestatic |
Definition at line 773 of file VectorTools.h.
|
inlinestatic |
Definition at line 779 of file VectorTools.h.
|
inlinestatic |
Definition at line 817 of file VectorTools.h.
|
inlinestatic |
v1 | a std::vector. |
Definition at line 698 of file VectorTools.h.
References logSumExp().
|
inlinestatic |
v | std::vector. |
Definition at line 638 of file VectorTools.h.
References logSumExp().
|
inlinestatic |
v1 | a std::vector. |
Definition at line 649 of file VectorTools.h.
References max().
Referenced by logMeanExp(), and logNorm().
|
inlinestatic |
v1 | a std::vector. |
v2 | another std::vector. |
Definition at line 673 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 1111 of file VectorTools.h.
Referenced by bpp::NumCalcApplicationTools::getParameterGrid(), logSumExp(), sumExp(), and whichMaxAll().
|
inlinestatic |
v1 | A std::vector. |
Definition at line 1313 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 1324 of file VectorTools.h.
References sum().
|
inlinestatic |
v1 | A std::vector. |
Definition at line 1342 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 1697 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 1618 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 1090 of file VectorTools.h.
Referenced by bpp::NumCalcApplicationTools::getParameterGrid(), and 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 543 of file VectorTools.h.
References range().
|
inlinestatic |
v1 | A std::vector. |
Definition at line 1015 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 1033 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 1274 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 856 of file VectorTools.h.
Referenced by bpp::TreeGraphImpl< GraphImpl >::getFatherOfNode().
|
inlinestatic |
Definition at line 841 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 1910 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 876 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 919 of file VectorTools.h.
|
inlinestatic |
Definition at line 888 of file VectorTools.h.
|
inlinestatic |
v1 | A std::vector. |
Definition at line 557 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 1239 of file VectorTools.h.
Referenced by breaks(), and nclassScott().
|
inlinestatic |
vec | A std::vector. |
n | the number of repetitions |
Definition at line 1954 of file VectorTools.h.
|
inlinestatic |
Definition at line 320 of file VectorTools.h.
|
inlinestatic |
Definition at line 326 of file VectorTools.h.
|
inlinestatic |
Definition at line 339 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 939 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 969 of file VectorTools.h.
|
inlinestatic |
v1 | The sample std::vector. |
unbiased | Tell if an unbiased estimate must be computed. |
Definition at line 1489 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 1503 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 (included). |
to | The end (included) |
by | The step. |
Definition at line 377 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 1560 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 1659 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 1586 of file VectorTools.h.
|
inlinestatic |
Definition at line 809 of file VectorTools.h.
|
inlinestatic |
Definition at line 833 of file VectorTools.h.
Referenced by cov().
|
inlinestatic |
v1 | A std::vector. |
Definition at line 587 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 710 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 733 of file VectorTools.h.
References max().
|
inlinestatic |
v1 | a std::vector. |
v2 | another std::vector. |
Definition at line 601 of file VectorTools.h.
|
static |
Test function.
Definition at line 33 of file VectorTools.cpp.
Referenced by diff(), and 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 446 of file VectorTools.h.
|
inlinestatic |
v1 | The sample std::vector. |
unbiased | Tell if an unbiased estimate must be computed. |
Definition at line 1465 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 1478 of file VectorTools.h.
|
inlinestatic |
vec1 | Vector 1. |
vec2 | Vector 2. |
Definition at line 1850 of file VectorTools.h.
References contains().
|
inlinestatic |
Definition at line 1861 of file VectorTools.h.
References contains().
|
inlinestatic |
vecElementL | A std::vector of std::vectors. |
Definition at line 1876 of file VectorTools.h.
References contains(), and test().
|
inlinestatic |
vec1 | Vector 1. |
vec2 | Vector 2. |
Definition at line 1813 of file VectorTools.h.
References contains().
|
inlinestatic |
vecElementL | A std::vector of std::vectors. |
Definition at line 1830 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 402 of file VectorTools.h.
Referenced by bpp::DataTable::deleteColumn(), bpp::Table< T >::deleteColumn(), bpp::DataTable::deleteRow(), bpp::Table< T >::deleteRow(), bpp::DataTable::getColumn(), bpp::Table< T >::getColumn(), bpp::DataTable::getRow(), bpp::Table< T >::getRow(), bpp::DataTable::operator()(), bpp::Table< T >::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 422 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 1133 of file VectorTools.h.
Referenced by bpp::LogsumHmmLikelihood::computeD2Forward_(), and bpp::LogsumHmmLikelihood::computeDForward_().
|
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 1187 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 1160 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 1213 of file VectorTools.h.
References min().