Changeset 1590


Ignore:
Timestamp:
Oct 17, 2008, 8:54:24 PM (15 years ago)
Author:
Peter
Message:

some docs on weighted iterator - closes #395

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/concepts.doxygen

    r1550 r1590  
    2828- \subpage concept_mutable_container_2d
    2929- \subpage concept_neighbor_weighting
     30- \subpage concept_weighted_iterator
    3031*/
    3132
     
    369370
    370371*/
     372
     373/**
     374\page concept_weighted_iterator Weighted Iterator
     375
     376\section Description
     377
     378Most functionality in yat come in two versions: one optimized for
     379speed and one weighted version allowing for missing value (see \ref
     380weighted_statistics). For example, weighted containers such as
     381theplu::yat::utility::MatrixWeighted and
     382theplu::yat::classifier::MatrixLookupWeighted allow an easy way to
     383handle missing values. Iterators that iterate over such weighted
     384containers are by definition \ref concept_weighted_iterator. This
     385concept is orthogonal against other iterator concepts such as Random
     386Access Iterator.
     387
     388\section Requirements
     389
     390When implementing a new iterator that may be a \ref
     391concept_weighted_iterator, there are a few things to concider.
     392
     393\subsection weighted_iterator_traits
     394
     395To decide whether an iterator is weighted, there exists a
     396meta-function
     397theplu::yat::utility::weighted_iterator_traits<Iterator>::type that
     398will return either theplu::yat::utility::weighted_iterator_tag or
     399theplu::yat::utility::unweighted_iterator_tag. The default
     400implementation of this meta-function works in most cases, including on
     401all std::iterators, but if you implement a new iterator make sure it
     402behaves as you desire, or you need to create a specialization.
     403
     404\subsection iterator_traits
     405
     406Sometimes it is useful to have unweighted iterators behaving as though
     407they were weighted. For instance,
     408theplu::yat::statistics::EuclideanDistance calculates the distance
     409between two ranges. If both ranges are are unweighted the unweighted
     410version is used, and when any of the two ranges is weighted the
     411weighted version kicks in. In order to make this work also when
     412comparing weighted and unweighted ranges, there must a mechanism to
     413let the unweighted iterator behave as though it were weighted.
     414
     415This can be accomplished through
     416theplu::yat::utility::iterator_traits, which enables access to data
     417value as well as to weight value. For unweighted iterators the weight
     418value is always equal to 1.0 and is not mutable. The default
     419implementation works for most iterators including all unweighted, but
     420if you implement a new weighted iterator you need to check that the
     421default implementation will work for you (see class
     422documentation). Otherwise, you will need to implement a
     423specialization.
     424
     425*/
Note: See TracChangeset for help on using the changeset viewer.