Changeset 1134 for trunk/test


Ignore:
Timestamp:
Feb 23, 2008, 11:52:43 PM (14 years ago)
Author:
Peter
Message:

using Index class instead of std::vector<size_t>

Location:
trunk/test
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/data_lookup_1d_test.cc

    r1121 r1134  
    6565  index_even.push_back(0);
    6666  index_even.push_back(4);
    67   classifier::MatrixLookup m1(gsl_m1,index_odd,index_even);
     67  classifier::MatrixLookup m1(gsl_m1,utility::Index(index_odd),
     68                              utility::Index(index_even));
    6869  *error << gsl_m1 << std::endl << '\n';
    6970  *error << m1 << std::endl;
  • trunk/test/feature_selection_test.cc

    r1121 r1134  
    8080  f2.update(dataviewweighted,targets);
    8181  *error << "\nRandomly ordered features (top 12):\n";
    82   std::vector<size_t> features=f2.features();
     82  std::vector<size_t> features=f2.features().vector();
    8383  std::copy(features.begin(),features.end(),
    8484            std::ostream_iterator<size_t>(*error," "));
     
    8787  f.update(dataviewweighted,targets);
    8888  *error << "\nSNR ordered ordered features (top 12):\n";
    89   features=f.features();
     89  features=f.features().vector();
    9090  std::copy(features.begin(),features.end(),
    9191            std::ostream_iterator<size_t>(*error," "));
     
    108108  classifier::MatrixLookupWeighted ranked=f.get(dataviewweighted);
    109109  f.update(ranked,targets);
    110   features=f.features();
     110  features=f.features().vector();
    111111  for(size_t i=0;i<features.size();i++) {
    112112    if(features[i]!=i) {
  • trunk/test/kernel_lookup_test.cc

    r1121 r1134  
    8989         << "                           const vector<size_t>&,\n"
    9090         << "                           const vector<size_t>&)...";
    91   classifier::KernelLookup k2(kernel,index_odd,index_even);
     91  classifier::KernelLookup k2(kernel,utility::Index(index_odd),
     92                              utility::Index(index_even));
    9293  if (k2.rows()!=index_odd.size() || k2.columns()!=index_even.size()) {
    9394    ok =false;
     
    112113         << "                           const vector<size_t>&)...";
    113114  std::vector<size_t> one(1,1);
    114   classifier::KernelLookup k3(k2,one,one);
     115  classifier::KernelLookup k3(k2,utility::Index(one),utility::Index(one));
    115116  if (k3.rows()!=one.size() || k3.columns()!=one.size()) {
    116117    ok =false;
     
    149150  }
    150151 
    151   KernelLookup k5(k1,index_even,index_even);
     152  KernelLookup k5(k1,utility::Index(index_even),utility::Index(index_even));
    152153  std::vector<size_t> index5;
    153154  index5.push_back(0);
    154155  index5.push_back(2);
    155   const KernelLookup* k6 = k5.training_data(index5);
     156  const KernelLookup* k6 = k5.training_data(utility::Index(index5));
    156157  for (size_t s=0; s<k6->rows(); s++)
    157158    for (size_t t=0; t<k6->rows(); t++)
  • trunk/test/kernel_test.cc

    r1133 r1134  
    156156
    157157  // checking view
    158   std::vector<size_t> index(3);
    159   index[0]=1;
    160   index[1]=2;
    161   index[2]=3;
    162   classifier::KernelLookup kv_raw(kernel);
     158  std::vector<size_t> index_vec(3);
     159  index_vec[0]=1;
     160  index_vec[1]=2;
     161  index_vec[2]=3;
     162  utility::Index index(index_vec);
     163  classifier::KernelLookup kv_raw(kernel);
    163164  classifier::KernelLookup kv(kv_raw,index,index);
    164165  if (kv.rows()!=index.size()){
     
    194195
    195196  // checking view
    196   std::vector<size_t> index(3);
    197   index[0]=1;
    198   index[1]=2;
    199   index[2]=3;
     197  std::vector<size_t> index_vec(3);
     198  index_vec[0]=1;
     199  index_vec[1]=2;
     200  index_vec[2]=3;
     201  utility::Index index(index_vec);
    200202  classifier::KernelLookup kv_raw(kernel);
    201203  classifier::KernelLookup kv(kv_raw,index, index);
  • trunk/test/matrix_lookup_test.cc

    r1121 r1134  
    7272  index_even.push_back(0);
    7373 
    74   classifier::MatrixLookup m2(gsl_m2,index_odd, index_even);
     74  classifier::MatrixLookup m2(gsl_m2,utility::Index(index_odd),
     75                              utility::Index(index_even));
    7576  if (m2.rows()!=2 || m2.columns()!=2 ||
    7677      m2(0,0)!=gsl_m2(1,2) || m2(0,1)!=gsl_m2(1,0) ||
     
    8687         << "                           const bool)...";
    8788  std::vector<size_t> one(1,1);
    88   classifier::MatrixLookup m3(gsl_m2,one,true);
     89  classifier::MatrixLookup m3(gsl_m2,utility::Index(one),true);
    8990  if (m3.rows()!=1 || m3.columns()!=gsl_m2.columns() || m3(0,0)!=gsl_m2(1,0) ||
    9091      m3(0,1)!=gsl_m2(1,1) || m3(0,2)!=gsl_m2(1,2) || m3(0,3)!=gsl_m2(1,3)) {
     
    111112         << "                           const std::vector<size_t>&,\n"
    112113         << "                           const std::vector<size_t>&)...";
    113   classifier::MatrixLookup m5(m2,one,one);
     114  classifier::MatrixLookup m5(m2,utility::Index(one),utility::Index(one));
    114115  if (m5.rows()!=1 || m5.columns()!=1 || m5(0,0)!=m2(1,1) ) {
    115116    ok =false;
     
    124125         << "                           const std::vector<size_t>&,\n"
    125126         << "                           const bool)...";
    126   classifier::MatrixLookup m6(m2,one,true);
     127  classifier::MatrixLookup m6(m2,utility::Index(one),true);
    127128  if (m6.rows()!=1 || m6.columns()!=m2.columns() || m6(0,0)!=m2(1,0) ||
    128129      m6(0,1)!=m2(1,1)) {
     
    145146
    146147  *error << "MatrixLookup::training_data(const std::vector<size_t>)...";
    147   const classifier::MatrixLookup* TrnData = m2.training_data(one);
     148  const classifier::MatrixLookup* TrnData =m2.training_data(utility::Index(one));
    148149  if (TrnData->rows() != m2.rows() || TrnData->columns()!=one.size()){
    149150    ok =false;
     
    157158         << "                              const std::vector<size_t>)...";
    158159  std::vector<size_t> val(23,2);
    159   const classifier::MatrixLookup* ValData = m2.validation_data(one, val);
     160  const classifier::MatrixLookup* ValData =
     161    m2.validation_data(utility::Index(one), utility::Index(val));
    160162  if (ValData->rows() != m2.rows() || TrnData->columns()!=val.size()){
    161163    ok =false;
  • trunk/test/subset_generator_test.cc

    r1121 r1134  
    143143    const classifier::DataLookup2D& tv_view=cv_test.training_data(k);
    144144    const classifier::Target& tv_target=cv_test.training_target(k);
    145     const std::vector<size_t>& tv_index=cv_test.training_index(k);
     145    const utility::Index& tv_index=cv_test.training_index(k);
    146146    const classifier::DataLookup2D& test_view=cv_test.validation_data(k);
    147147    const classifier::Target& test_target=cv_test.validation_target(k);
    148     const std::vector<size_t>& test_index=cv_test.validation_index(k);
     148    const utility::Index& test_index=cv_test.validation_index(k);
    149149
    150150    for (size_t i=0; i<test_index.size(); i++) {
     
    173173      const classifier::DataLookup2D& t_view=cv_training.training_data(l);
    174174      const classifier::Target& t_target=cv_training.training_target(l);
    175       const std::vector<size_t>& t_index=cv_training.training_index(l);
     175      const utility::Index& t_index=cv_training.training_index(l);
    176176      const classifier::DataLookup2D& v_view=cv_training.validation_data(l);
    177177      const classifier::Target& v_target=cv_training.validation_target(l);
    178       const std::vector<size_t>& v_index=cv_training.validation_index(l);
     178      const utility::Index& v_index=cv_training.validation_index(l);
    179179     
    180180      if (test_index.size()+tv_index.size()!=target.size()
  • trunk/test/target_test.cc

    r1000 r1134  
    2323
    2424#include "yat/classifier/Target.h"
     25#include "yat/utility/Index.h"
    2526
    2627#include <fstream>
     
    6768  sub.push_back(2);
    6869  sub.push_back(1);
    69   classifier::Target sub_target(target3,sub);
     70  classifier::Target sub_target(target3,utility::Index(sub));
    7071  if (target3(sub[0])!=sub_target(0) || target3(sub[1])!=sub_target(1)){
    7172    ok = false;
Note: See TracChangeset for help on using the changeset viewer.