Ignore:
Timestamp:
Feb 22, 2007, 4:11:14 PM (15 years ago)
Author:
Peter
Message:

added constructing view from utility::vector

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/DataLookup1D.cc

    r720 r766  
    2525#include "DataLookup2D.h"
    2626#include "MatrixLookup.h"
     27
     28#include "yat/utility/matrix.h"
     29#include "yat/utility/vector.h"
    2730
    2831#include <cassert>
     
    5457      matrix_(other.matrix_), owner_(false)
    5558  {
     59  }
     60
     61
     62  DataLookup1D::DataLookup1D(const utility::vector& v,
     63                             const std::vector<size_t>& index)
     64    : column_vector_(true), index_(0), owner_(true)
     65  {
     66    utility::matrix* m = new utility::matrix(1,index.size());
     67    for (size_t i=0; i<index.size(); ++i){
     68      assert(index[i]<v.size());
     69      (*m)(0,i)=v(index[i]);
     70    }
     71    matrix_ = new MatrixLookup(*m, true);
    5672  }
    5773
Note: See TracChangeset for help on using the changeset viewer.