Changeset 2339


Ignore:
Timestamp:
Oct 16, 2010, 4:17:30 PM (11 years ago)
Author:
Peter
Message:

refs #627 extending NeighborWeighting? concept to require defaulf constructor and assign operator. Added a archetype class in test.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/concepts.doxygen

    r2338 r2339  
    348348
    349349Classes modelling the concept \ref concept_neighbor_weighting should
     350be DefaultConstructible and Assignable as well as
    350351implement the following public function:
    351352 
  • trunk/test/Suite.h

    r2338 r2339  
    2424*/
    2525
     26#include <yat/utility/VectorMutable.h>
     27#include <yat/classifier/Target.h>
     28
    2629#include <boost/concept_archetype.hpp>
    2730
    2831#include <iosfwd>
    2932#include <sstream>
     33#include <vector>
    3034
    3135namespace theplu {
     
    243247    distance_archetype(void);
    244248    distance_archetype& operator=(const distance_archetype&);
     249  };
     250
     251  /*
     252    class to test (at compile time) that a function (or class) works
     253    with a NeighborWeighting. Do not run any test using this class because
     254    the class is not really functional at run time.
     255
     256    \see boost/concept_archetype.hpp
     257   */
     258  class neighbor_weighting_archetype
     259  {
     260  public:
     261    neighbor_weighting_archetype(void) {}
     262    void operator()(const utility::VectorBase& distance,
     263                    const std::vector<size_t>& k_sorted,
     264                    const classifier::Target& target,
     265                    utility::VectorMutable& prediction) const {}
     266    neighbor_weighting_archetype& operator=(const neighbor_weighting_archetype&)
     267    { return *this; }
     268  private:
     269    neighbor_weighting_archetype(const neighbor_weighting_archetype&) {};
    245270  };
    246271
  • trunk/test/knn_test.cc

    r2338 r2339  
    7878    boost::detail::dummy_constructor dummy;
    7979    test::distance_archetype distance(dummy);
    80     classifier::KNN<test::distance_archetype> knn(distance);
     80    classifier::KNN<test::distance_archetype
     81                    , test::neighbor_weighting_archetype> knn(distance);
    8182    knn.k(3);
    8283    knn.k();
Note: See TracChangeset for help on using the changeset viewer.