Changeset 1146


Ignore:
Timestamp:
Feb 25, 2008, 10:03:48 PM (16 years ago)
Author:
Peter
Message:

DataLookup1D is now a lookup into a MatrixLookup? closes #327

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/iterator_test.cc

    r1138 r1146  
    9494    ok = false;
    9595
     96  classifier::MatrixLookup ml(m);
     97  classifier::DataLookup1D dl1(ml,0,true);
     98  if (dl1.begin()!=ml.begin_row(0))
     99    ok = false;
     100  if (dl1.end()!=ml.end_row(0))
     101    ok = false;
     102  classifier::DataLookup1D dl2(ml,0,false);
     103  if (dl2.begin()!=ml.begin_column(0))
     104    ok = false;
     105  if (dl2.end()!=ml.end_column(0))
     106    ok = false;
     107
    96108  if (!ok)
    97109    *message << "iterator test failed" << std::endl;
  • trunk/yat/classifier/DataLookup1D.cc

    r1121 r1146  
    2525
    2626#include "DataLookup1D.h"
    27 #include "DataLookup2D.h"
    2827#include "MatrixLookup.h"
    2928
     
    3938namespace classifier {
    4039
    41   DataLookup1D::DataLookup1D(const DataLookup2D& m, const size_t i,
     40  DataLookup1D::DataLookup1D(const MatrixLookup& m, const size_t i,
    4241                             const bool row_vector)
    4342    : column_vector_(!row_vector), index_(i), matrix_(&m), owner_(false)
  • trunk/yat/classifier/DataLookup1D.h

    r1110 r1146  
    2727*/
    2828
    29 #include "DataLookup2D.h"
     29#include "MatrixLookup.h"
    3030#include "yat/utility/Container2DIterator.h"
    3131#include "yat/utility/iterator_traits.h"
     
    5151    /// 'Read Only' iterator
    5252    typedef utility::StrideIterator<
    53     utility::Container2DIterator<const DataLookup2D, const double, void,
     53    utility::Container2DIterator<const MatrixLookup, const double, void,
    5454                                 const double> >
    5555    const_iterator;
     
    6262    /// column. @param index which row/column to look into.
    6363    ///
    64     DataLookup1D(const DataLookup2D&, const size_t index,
     64    DataLookup1D(const MatrixLookup&, const size_t index,
    6565                 const bool row_vector);
    6666
     
    135135    const bool column_vector_;
    136136    const size_t index_;
    137     const DataLookup2D* matrix_;
     137    const MatrixLookup* matrix_;
    138138    const bool owner_;
    139139   
  • trunk/yat/classifier/Kernel.cc

    r1134 r1146  
    104104      return kf_->operator()(vec, DataLookupWeighted1D(*data_w_,i, false));
    105105    else
    106       return kf_->operator()(vec, DataLookup1D(*data_,i, false));
     106      return kf_->operator()(vec,DataLookup1D(dynamic_cast<const MatrixLookup&>
     107                                              (*data_),i, false));
    107108  }
    108109
     
    113114      return kf_->operator()(vec, DataLookupWeighted1D(*data_w_,i, false));
    114115    else
    115       return kf_->operator()(vec, DataLookup1D(*data_,i, false));
     116      return kf_->operator()(vec, DataLookup1D(dynamic_cast<const MatrixLookup&>
     117                                              (*data_),i, false));
    116118  }
    117119
  • trunk/yat/classifier/Kernel_MEV.cc

    r1000 r1146  
    7272                    DataLookupWeighted1D(*data_w_,column,false));
    7373    else
    74       return (*kf_)(DataLookup1D(*data_,row,false),
    75                     DataLookup1D(*data_,column,false));
     74      return (*kf_)(DataLookup1D(dynamic_cast<const MatrixLookup&>
     75                                 (*data_),row,false),
     76                    DataLookup1D(dynamic_cast<const MatrixLookup&>
     77                                 (*data_),column,false));
    7678  }
    7779
  • trunk/yat/classifier/Kernel_SEV.cc

    r1121 r1146  
    7070      for (size_t j=i; j<kernel_matrix_.columns(); j++)
    7171        kernel_matrix_(i,j) = kernel_matrix_(j,i) =
    72           (*kf_)(DataLookup1D(*data_,i,false),DataLookup1D(*data_,j,false));
     72          (*kf_)(DataLookup1D(dynamic_cast<const MatrixLookup&>(*data_),i,false),
     73                 DataLookup1D(dynamic_cast<const MatrixLookup&>(*data_),j,false));
    7374  }
    7475
Note: See TracChangeset for help on using the changeset viewer.