source: trunk/c++_tools/classifier/FeatureSelector.cc @ 624

Last change on this file since 624 was 624, checked in by Peter, 15 years ago

fixes #109 and #110

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 1019 bytes
RevLine 
[604]1// $Id$
2
3#include "FeatureSelector.h"
4
[624]5#include "MatrixLookup.h"
6#include "MatrixLookupWeighted.h"
[604]7
8#include <list>
9
10namespace theplu {
11namespace classifier {
12
13
14  FeatureSelector::FeatureSelector(size_t N, size_t first)
15    : first_(first), N_(N)
16  {
17  }
18
19
20  FeatureSelector::~FeatureSelector()
21  {
[624]22    for (std::list<const MatrixLookup*>::iterator i=garbage_.begin(); 
[604]23         i!=garbage_.end(); ++i)
24      delete *i;
[624]25    for (std::list<const MatrixLookupWeighted*>::iterator i=
26           garbage_weighted_.begin(); i!=garbage_weighted_.end(); ++i)
27      delete *i;
[604]28  }
29
30
[624]31  const MatrixLookup& FeatureSelector::get(const MatrixLookup& matrix)
[604]32  {
[624]33    garbage_.push_back(new MatrixLookup(matrix,features_,true));
[604]34    return *garbage_.back();
35  }
36
[624]37
38  const MatrixLookupWeighted& 
39  FeatureSelector::get(const MatrixLookupWeighted& matrix)
40  {
41    garbage_weighted_.push_back(new MatrixLookupWeighted(matrix,features_,
42                                                         true));
43    return *garbage_weighted_.back();
44  }
45
[604]46} // end of namespace classifier
47} // end of namespace theplu
Note: See TracBrowser for help on using the repository browser.