Changeset 1091


Ignore:
Timestamp:
Feb 14, 2008, 5:26:31 PM (13 years ago)
Author:
Peter
Message:

fixes #267 iterator for MatrixLookupWeighted?

Location:
trunk/yat/classifier
Files:
2 edited

Legend:

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

    r1035 r1091  
    244244
    245245
     246  MatrixLookupWeighted::const_iterator MatrixLookupWeighted::begin(void) const
     247  {
     248    return const_iterator(const_iterator::iterator_type(*this, 0, 0), 1);
     249  }
     250
     251
     252  MatrixLookupWeighted::const_iterator
     253  MatrixLookupWeighted::begin_column(size_t i) const
     254  {
     255    return const_iterator(const_iterator::iterator_type(*this, 0, i),columns());
     256  }
     257
     258
     259  MatrixLookupWeighted::const_iterator
     260  MatrixLookupWeighted::begin_row(size_t i) const
     261  {
     262    return const_iterator(const_iterator::iterator_type(*this, i, 0), 1);
     263  }
     264
     265
    246266  double MatrixLookupWeighted::data(size_t row, size_t column) const
    247267  {
     
    249269  }
    250270
     271
     272
     273  MatrixLookupWeighted::const_iterator MatrixLookupWeighted::end(void) const
     274  {
     275    return const_iterator(const_iterator::iterator_type(*this, rows(), 0), 1);
     276  }
     277
     278
     279  MatrixLookupWeighted::const_iterator
     280  MatrixLookupWeighted::end_column(size_t i) const
     281  {
     282    return const_iterator(const_iterator::iterator_type(*this, rows(), i),
     283                          columns());
     284  }
     285
     286
     287  MatrixLookupWeighted::const_iterator
     288  MatrixLookupWeighted::end_row(size_t i) const
     289  {
     290    return const_iterator(const_iterator::iterator_type(*this, i+1, 0), 1);
     291  }
    251292
    252293
  • trunk/yat/classifier/MatrixLookupWeighted.h

    r1090 r1091  
    251251    virtual ~MatrixLookupWeighted();
    252252
     253    /**
     254       Iterator iterates along a row. When end of row is reached it
     255       jumps to beginning of next row.
     256
     257       \return const_iterator pointing to upper-left element.
     258     */
     259    const_iterator begin(void) const;
     260
     261    /**
     262       Iterator iterates along a column.
     263
     264       \return iterator pointing to first element of column \a i.
     265     */
     266    const_iterator begin_column(size_t) const;
     267
     268    /**
     269       Iterator iterates along a column.
     270
     271       \return const_iterator pointing to first element of column \a i.
     272     */
     273    const_iterator begin_row(size_t) const;
     274
    253275    ///
    254276    /// @return data value of element (@a row, @a column)
    255277    ///
    256278    double data(size_t row, size_t column) const;
     279
     280    /**
     281       \return const_iterator pointing to end of matrix
     282     */
     283    const_iterator end(void) const;
     284
     285    /**
     286       \return const_iterator pointing to end of column \a i
     287     */
     288    const_iterator end_column(size_t) const;
     289
     290    /**
     291       \return const_iterator pointing to end of row \a i
     292     */
     293    const_iterator end_row(size_t) const;
    257294
    258295    /**
Note: See TracChangeset for help on using the changeset viewer.