65 std::vector<T> weight;
69 void resize(
typename std::vector<T>::size_type n,
typename std::vector<T>::value_type t =
typename std::vector<T>::value_type()){
70 std::vector<T>::resize(n, t);
71 weight.resize(n, 1.0);
80 for (
size_t i=0; i < this->size(); i++){
91 for (
size_t i=0; i < this->size(); i++){
96 ostr << (*this).weight[i];
112 for (
int i = 0; i < a.size(); ++i) {
114 w = a.weight[i] * b.weight[i];
121 return std::numeric_limits<double>::max();
135 const double coeff2 = 1.0 - coeff;
137 for (
int i = 0; i < a.size(); ++i){
138 alpha = coeff2 * a.weight[i];
139 beta = coeff * b.weight[i];
142 m[i] = (alpha*a[i] + beta*b[i]) / w;
160 std::ostream & operator<<(std::ostream & ostr,
const WeightedVector<T> & WeightedVector){
161 WeightedVector.toStream(ostr);
Definition: WeightedVector.h:57
void toStream(std::ostream &ostr) const
Definition: WeightedVector.h:74
static void euclideanMixingFunction(const WeightedVector< T > &a, const WeightedVector< T > &b, double coeff, WeightedVector< T > &m)
Given vectors a and a and a mixing coefficient coeff , outputs mixture vector m.
Definition: WeightedVector.h:131
Definition: DataSelector.cpp:1277