Changeset 926 for trunk/test/vector_distance_test.cc
 Timestamp:
 Oct 3, 2007, 8:11:31 AM (15 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/test/vector_distance_test.cc
r901 r926 5 5 #include "yat/statistics/euclidean_vector_distance.h" 6 6 #include "yat/statistics/pearson_vector_distance.h" 7 #include "yat/statistics/vector_distance_ptr.h"8 7 #include "yat/utility/matrix.h" 9 8 #include "yat/utility/vector.h" … … 17 16 18 17 using namespace theplu::yat; 19 20 21 // Function to test pointers to distance specialized for DataLookup1D::iterator22 double f(statistics::vector_distance_lookup_weighted_ptr distance) {23 utility::matrix m(2,3,1);24 m(0,1)=2;25 m(1,0)=0;26 m(1,1)=0;27 utility::matrix w(2,3,1);28 w(0,0)=0;29 classifier::MatrixLookupWeighted mw(m,w);30 classifier::DataLookupWeighted1D aw(mw,0,true);31 classifier::DataLookupWeighted1D bw(mw,1,true);32 33 double dist=(*distance)(aw.begin(),aw.end(),bw.begin());34 return dist;35 }36 18 37 19 int main(const int argc,const char* argv[]) … … 98 80 } 99 81 100 101 // Test with pointer to a vector_distance 102 statistics::vector_distance_lookup_weighted_ptr test_ptr= 103 statistics::vector_distance<statistics::euclidean_vector_distance_tag>; 104 dist=(*test_ptr)(aw.begin(),aw.end(),bw.begin()); 105 if(fabs(dist2)>tolerance) { 106 *error << "Error when using pointer to vector_distance" << std::endl; 107 ok=false; 108 } 109 82 110 83 // Test with std::vectors 111 84 std::vector<double> sa(3,1);
Note: See TracChangeset
for help on using the changeset viewer.