Changeset 1589 for trunk/yat/classifier


Ignore:
Timestamp:
Oct 17, 2008, 6:10:43 PM (13 years ago)
Author:
Peter
Message:

fixes #444

Location:
trunk/yat/classifier
Files:
2 edited

Legend:

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

    r1587 r1589  
    141141  MatrixLookupWeighted::begin_column(size_t i) const
    142142  {
    143     return const_column_iterator(const_column_iterator::iterator_type(*this,0,
    144                                                                       i),
    145                                  columns());
    146   }
    147 
    148 
    149   MatrixLookupWeighted::const_iterator
     143    return const_column_iterator(data_->begin_column(column_index_[i]),
     144                                 row_index_.begin());
     145  }
     146
     147
     148  MatrixLookupWeighted::const_row_iterator
    150149  MatrixLookupWeighted::begin_row(size_t i) const
    151150  {
    152     return const_row_iterator(const_row_iterator::iterator_type(*this,i, 0), 1);
     151    return const_row_iterator(data_->begin_row(row_index_[i]),
     152                              column_index_.begin());
    153153  }
    154154
     
    177177
    178178
    179   MatrixLookupWeighted::const_iterator
     179  MatrixLookupWeighted::const_column_iterator
    180180  MatrixLookupWeighted::end_column(size_t i) const
    181181  {
    182     return const_column_iterator(const_column_iterator::iterator_type(*this,
    183                                                                       rows(),i),
    184                                  columns());
     182    return const_column_iterator(data_->end_column(column_index_[i]),
     183                                 row_index_.end());
    185184  }
    186185
     
    189188  MatrixLookupWeighted::end_row(size_t i) const
    190189  {
    191     return const_row_iterator(const_row_iterator::iterator_type(*this,i+1,0),1);
     190    return const_row_iterator(data_->end_row(row_index_[i]),
     191                              column_index_.end());
    192192  }
    193193
  • trunk/yat/classifier/MatrixLookupWeighted.h

    r1588 r1589  
    2828#include "yat/utility/DataWeight.h"
    2929#include "yat/utility/Index.h"
     30#include "yat/utility/MatrixWeighted.h"
    3031#include "yat/utility/SmartPtr.h"
    3132#include "yat/utility/StrideIterator.h"
     33
     34#include <boost/iterator/permutation_iterator.hpp>
    3235
    3336#include <iostream>
     
    3740namespace theplu {
    3841namespace yat {
    39 
    40 namespace utility {
    41   class MatrixWeighted;
    42 }
    43 
    4442namespace classifier { 
    4543
     
    8886       'Read only' iterator used to iterate over a column
    8987     */
    90     typedef const_iterator const_column_iterator;
     88    typedef boost::permutation_iterator<
     89      utility::MatrixWeighted::const_column_iterator,
     90      utility::Index::const_iterator> const_column_iterator;
    9191
    9292    /**
    9393       'Read only' iterator used to iterate over a row
    9494     */
    95     typedef const_iterator const_row_iterator;
     95    typedef boost::permutation_iterator<
     96      utility::MatrixWeighted::const_row_iterator,
     97      utility::Index::const_iterator> const_row_iterator;
    9698
    9799    /**
Note: See TracChangeset for help on using the changeset viewer.