Changeset 2338
- Timestamp:
- Oct 16, 2010, 7:00:12 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/concepts.doxygen
r2312 r2338 297 297 \section Requirements 298 298 299 Classes modelling the concept \ref concept_distance should implement 300 the following public function: 299 Classes modelling the concept \ref concept_distance should have a copy 300 constructor 301 302 \verbatim 303 Distance(const Distance& d); 304 \endverbatim 305 306 and also implement the following public function: 301 307 302 308 \verbatim -
trunk/test/Suite.h
r2260 r2338 23 23 along with yat. If not, see <http://www.gnu.org/licenses/>. 24 24 */ 25 26 #include <boost/concept_archetype.hpp> 25 27 26 28 #include <iosfwd> … … 219 221 reference operator()(size_t row, size_t column) 220 222 { return this->element_; } 223 }; 224 225 /* 226 class to test (at compile time) that a function (or class) works 227 with a Distance. Do not run any test using this class because 228 the class is not really functional at run time. 229 230 \see boost/concept_archetype.hpp 231 */ 232 class distance_archetype 233 { 234 public: 235 /// class must be constructible somehow, but we don't wanna assume 236 /// void constructor or any other common constructor so we use the 237 /// signature to allow construction without assuming too much. 238 distance_archetype(const boost::detail::dummy_constructor&) {}; 239 distance_archetype(const distance_archetype&) {}; 240 template<typename T1, typename T2> 241 double operator()(T1 first1, T1 last1, T2 first2) const { return 0.0; } 242 private: 243 distance_archetype(void); 244 distance_archetype& operator=(const distance_archetype&); 221 245 }; 222 246 -
trunk/test/knn_test.cc
r2119 r2338 43 43 using namespace theplu::yat; 44 44 45 void compile_test(test::Suite&); 45 46 utility::Matrix data(void); 46 47 utility::MatrixWeighted data_weighted(void); … … 55 56 std::vector<std::string> vec_target(void); 56 57 58 57 59 int main(int argc, char* argv[]) 58 60 { … … 66 68 test_no_samples(suite); 67 69 test_no_features(suite); 70 compile_test(suite); 68 71 return suite.return_value(); 69 72 } 73 74 75 void compile_test(test::Suite& suite) 76 { 77 if (false) { 78 boost::detail::dummy_constructor dummy; 79 test::distance_archetype distance(dummy); 80 classifier::KNN<test::distance_archetype> knn(distance); 81 knn.k(3); 82 knn.k(); 83 classifier::SupervisedClassifier* knn2 = knn.make_classifier(); 84 delete knn2; 85 utility::Matrix result; 86 knn.train(classifier::MatrixLookup(data()), classifier::Target()); 87 knn.train(classifier::MatrixLookupWeighted(data_weighted()), 88 classifier::Target()); 89 knn.predict(classifier::MatrixLookup(data()), result); 90 knn.predict(classifier::MatrixLookupWeighted(data_weighted()), result); 91 } 92 } 70 93 71 94 -
trunk/test/ncc_test.cc
r2119 r2338 47 47 48 48 void predict_nan_data_unweighted_data(test::Suite& suite); 49 void compile_test(test::Suite& suite); 49 50 50 51 int main(int argc,char* argv[]) … … 259 260 suite.err() << "Difference to stored prediction too large\n"; 260 261 } 262 compile_test(suite); 261 263 262 264 return suite.return_value(); 263 265 } 266 267 268 void compile_test(test::Suite& suite) 269 { 270 if (false) { 271 boost::detail::dummy_constructor dummy; 272 test::distance_archetype distance(dummy); 273 classifier::NCC<test::distance_archetype> ncc(distance); 274 } 275 } 276 264 277 265 278 void predict_nan_data_unweighted_data(test::Suite& suite) -
trunk/yat/utility/concept_check.h
r2334 r2338 261 261 */ 262 262 template <class T> 263 class DistanceConcept 263 class DistanceConcept : boost::CopyConstructible<T> 264 264 { 265 265 public:
Note: See TracChangeset
for help on using the changeset viewer.