136 omp_init_lock(&_pSquareMutexLock);
143 : pFeatures( features),
146 pSquareValid( false),
150 omp_init_lock(&_pSquareMutexLock);
155 : pFeatures(fv.pFeatures),
157 _uniqueID(fv._uniqueID),
158 pSquareValid(fv.pSquareValid),
162 omp_init_lock(&_pSquareMutexLock);
169 omp_set_lock(&_pSquareMutexLock);
171 pFeatures = fv.pFeatures;
173 _uniqueID = fv._uniqueID;
174 pSquareValid = fv.pSquareValid;
175 pSquare = fv.pSquare;
177 omp_unset_lock(&_pSquareMutexLock);
185 omp_destroy_lock(&_pSquareMutexLock);
215 omp_set_lock(&_pSquareMutexLock);
219 omp_unset_lock(&_pSquareMutexLock);
221 return pFeatures[index];
227 return pFeatures[index];
232 return pFeatures.begin();
237 omp_set_lock(&_pSquareMutexLock);
241 omp_unset_lock(&_pSquareMutexLock);
243 return pFeatures.begin();
246 const_iterator
end()
const 248 return pFeatures.end();
253 omp_set_lock(&_pSquareMutexLock);
257 omp_unset_lock(&_pSquareMutexLock);
259 return pFeatures.end();
264 return pFeatures.size();
271 omp_set_lock(&_pSquareMutexLock);
273 pFeatures.resize(newSize);
276 omp_unset_lock(&_pSquareMutexLock);
283 omp_set_lock(&_pSquareMutexLock);
285 for (iterator p=
begin(); p!=
end(); )
292 omp_unset_lock(&_pSquareMutexLock);
299 omp_set_lock(&_pSquareMutexLock);
304 for (const_iterator p=
begin();
315 omp_unset_lock(&_pSquareMutexLock);
326 const_iterator i=
begin();
327 const_iterator j=fv.
begin();
341 omp_set_lock(&_pSquareMutexLock);
352 if( is.rdbuf()->sgetc() == EOF)
355 omp_unset_lock(&_pSquareMutexLock);
363 omp_unset_lock(&_pSquareMutexLock);
367 }
while( isspace(c) && c !=
'\n');
370 if( !isdigit(c) && c !=
'-' && c !=
'+' && c !=
'.')
373 omp_unset_lock(&_pSquareMutexLock);
379 pFeatures.push_back(value);
382 omp_unset_lock(&_pSquareMutexLock);
390 p != pFeatures.end(); ++p )
398 return "<label><ws><feature_0><ws><feature_1>...<ws><feature_n>\n" 399 "where <ws> is any number of white spaces except for newline\n" 401 "4 0.123 2.432 42.0 137.0815 24.35";
407 return( pFeatures == fv.pFeatures);
413 omp_set_lock(&_pSquareMutexLock);
418 for(
size_t i = 0; i < n; ++i)
426 omp_unset_lock(&_pSquareMutexLock);
433 omp_set_lock(&_pSquareMutexLock);
437 for(
size_t i = 0; i < n; ++i)
443 omp_unset_lock(&_pSquareMutexLock);
452 std::vector<double> pFeatures;
454 unsigned int _uniqueID;
457 mutable omp_lock_t _pSquareMutexLock;
459 mutable bool pSquareValid;
460 mutable double pSquare;
486 size_t n = fv1.
size();
491 for(
size_t i = 0; i < n; ++i)
493 *resultP = *fv1P + *fv2P;
504 size_t n = fv1.
size();
509 for(
size_t i = 0; i < n; ++i)
511 *resultP = *fv1P - *fv2P;
522 size_t n = fv.
size();
526 for(
size_t i = 0; i < n; ++i)
528 *resultP = factor * *fvP;
const_reference operator[](int index) const
std::vector< double >::reference reference
void operator*=(double factor)
bool operator==(const BasicFV &fv) const
unsigned int uniqueID() const
BasicFV operator+(const BasicFV &fv1, const BasicFV &fv2)
void operator+=(const BasicFV &fv)
const unsigned int MAX_BELIEVABLE_UNIQUE_ID
BasicFV operator*(double factor, const BasicFV &fv)
reference operator[](int index)
const_iterator end() const
static const char * helpPipeFormat()
std::vector< double >::iterator iterator
void resize(size_type newSize)
void setUniqueID(unsigned int uid)
BasicFV operator-(const BasicFV &fv1, const BasicFV &fv2)
BasicFV(BasicFV const &fv)
std::vector< double >::size_type size_type
void setLabel(double value)
double dotProduct(const svt::BasicFV &fv) const
friend std::ostream & operator<<(std::ostream &os, const svt::BasicFV &fv)
void writeWithoutLabel(std::ostream &os) const
const_iterator begin() const
friend std::istream & operator>>(std::istream &is, svt::BasicFV &fv)
BasicFV & operator=(BasicFV const &fv)
std::vector< double >::const_reference const_reference
BasicFV(std::vector< double > features, double label=0, int uniqueID=MAX_BELIEVABLE_UNIQUE_ID+1)
std::vector< double >::const_iterator const_iterator
void readWithoutLabel(std::istream &is)