Changeset 2334
- Timestamp:
- Oct 15, 2010, 4:35:09 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/distance_test.cc
r2202 r2334 28 28 #include "yat/statistics/EuclideanDistance.h" 29 29 #include "yat/statistics/PearsonDistance.h" 30 #include "yat/utility/concept_check.h" 30 31 #include "yat/utility/DataIterator.h" 31 32 #include "yat/utility/Matrix.h" … … 35 36 36 37 #include <boost/concept_archetype.hpp> 38 #include <boost/concept_check.hpp> 37 39 38 40 #include <cassert> … … 193 195 unsigned int long N) 194 196 { 197 BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>)); 195 198 test_duplicate(dist, suite, N); 196 199 test_rescaling(dist, suite, N); -
trunk/yat/classifier/IGP.h
r2119 r2334 27 27 #include "MatrixLookup.h" 28 28 #include "Target.h" 29 #include "yat/utility/concept_check.h" 29 30 #include "yat/utility/Vector.h" 30 31 #include "yat/utility/yat_assert.h" 32 33 #include <boost/concept_check.hpp> 31 34 32 35 #include <cmath> … … 92 95 : matrix_(data), target_(target) 93 96 { 97 BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>)); 94 98 calculate(); 95 99 } … … 99 103 : matrix_(data), target_(target), distance_(dist) 100 104 { 105 BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>)); 101 106 calculate(); 102 107 } -
trunk/yat/classifier/KNN.h
r2210 r2334 31 31 #include "SupervisedClassifier.h" 32 32 #include "Target.h" 33 #include "yat/utility/concept_check.h" 33 34 #include "yat/utility/Exception.h" 34 35 #include "yat/utility/Matrix.h" 35 36 #include "yat/utility/yat_assert.h" 37 38 #include <boost/concept_check.hpp> 36 39 37 40 #include <cmath> … … 191 194 : SupervisedClassifier(),data_ml_(0),data_mlw_(0),target_(0),k_(3) 192 195 { 196 BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>)); 193 197 } 194 198 … … 197 201 : SupervisedClassifier(),data_ml_(0),data_mlw_(0),target_(0),k_(3), distance_(dist) 198 202 { 203 BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>)); 199 204 } 200 205 -
trunk/yat/classifier/NCC.h
r2210 r2334 32 32 #include "yat/statistics/Averager.h" 33 33 #include "yat/statistics/AveragerWeighted.h" 34 #include "yat/utility/concept_check.h" 34 35 #include "yat/utility/Exception.h" 35 36 #include "yat/utility/Matrix.h" … … 38 39 #include "yat/utility/stl_utility.h" 39 40 #include "yat/utility/yat_assert.h" 41 42 #include <boost/concept_check.hpp> 40 43 41 44 #include <iterator> … … 179 182 : SupervisedClassifier(), centroids_nan_(false) 180 183 { 184 BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>)); 181 185 } 182 186 … … 185 189 : SupervisedClassifier(), centroids_nan_(false), distance_(dist) 186 190 { 191 BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>)); 187 192 } 188 193 -
trunk/yat/utility/concept_check.h
r2263 r2334 25 25 #include "iterator_traits.h" 26 26 27 #include <boost/concept_archetype.hpp> 27 28 #include <boost/concept_check.hpp> 28 29 … … 46 47 } 47 48 \endcode 49 50 \since New in yat 0.7 48 51 */ 49 52 template <class T> … … 102 105 } 103 106 \endcode 107 108 \since New in yat 0.7 104 109 */ 105 110 template <class T> … … 154 159 } 155 160 \endcode 161 162 \since New in yat 0.7 156 163 */ 157 164 template <class T> … … 201 208 } 202 209 \endcode 210 211 \since New in yat 0.7 203 212 */ 204 213 template <class T> … … 230 239 BOOST_CONCEPT_ASSERT((boost::Convertible<value_type, DataWeight>)); 231 240 } 232 241 }; 242 243 244 /** 245 \brief Concept check for a \ref concept_distance 246 247 This class is intended to be used in a <a 248 href="\boost_url/concept_check/using_concept_check.htm"> 249 BOOST_CONCEPT_ASSERT </a> 250 251 \code 252 template<class Distance> 253 void some_function(double x) 254 { 255 BOOST_CONCEPT_ASSERT((DistanceConcept<Distance>)); 256 ... 257 } 258 \endcode 259 260 \since New in yat 0.7 261 */ 262 template <class T> 263 class DistanceConcept 264 { 265 public: 266 /** 267 \brief function doing the concept test 268 */ 269 BOOST_CONCEPT_USAGE(DistanceConcept) 270 { 271 boost::random_access_iterator_archetype<double> unweighted; 272 boost::random_access_iterator_archetype<DataWeight> weighted; 273 double d; 274 d = distance_(unweighted, unweighted, unweighted); 275 d = distance_(unweighted, unweighted, weighted); 276 d = distance_(weighted, weighted, unweighted); 277 d = distance_(weighted, weighted, weighted); 278 } 279 private: 280 T distance_; 233 281 }; 234 282
Note: See TracChangeset
for help on using the changeset viewer.