source: trunk/lib/classifier/DataView.cc @ 455

Last change on this file since 455 was 455, checked in by Markus Ringnér, 16 years ago

Adding classes to support general views of matrices (and kernels). Will be useful for cross-validation and ensembles of classifiers

File size: 959 bytes
Line 
1// $Id$
2
3#include <c++_tools/classifier/DataView.h>
4
5namespace theplu {
6namespace classifier {
7
8  DataView::DataView(const gslapi::matrix& data)
9    : MatrixView(), data_(&data)
10  {
11    for(size_t i=0;i<(*data_).rows();i++)
12      row_index_.push_back(i);
13    for(size_t i=0;i<(*data_).columns();i++)
14      column_index_.push_back(i);
15  }
16 
17  DataView::DataView(const gslapi::matrix& data, 
18                     const std::vector<size_t>& row, 
19                     const std::vector<size_t>& col)
20    : MatrixView(row,col), data_(&data)
21  {
22  }
23 
24  DataView::DataView(const gslapi::matrix& data, 
25                     const std::vector<size_t>& index, bool row)
26    : MatrixView(index, row), data_(&data)
27  {
28    if(row)
29      for(size_t i=0;i<(*data_).columns();i++)
30        column_index_.push_back(i);
31    else
32      for(size_t i=0;i<(*data_).rows();i++)
33        row_index_.push_back(i);
34
35  }
36 
37  DataView::DataView(const DataView& dv)
38    : MatrixView(dv), data_(dv.data_)
39  {
40  }
41
42
43}} // of namespace classifier and namespace theplu
Note: See TracBrowser for help on using the repository browser.