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