Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [15d818] Maximize Restore History

moved k_means to bsta from sdet to allow more global linking

Joseph Mundy Joseph Mundy 2013-06-20

changed contrib
changed contrib/brl
changed contrib/brl/bbas
changed contrib/brl/bbas/bsta
changed contrib/brl/bbas/bsta/tests
changed contrib/brl/bseg
changed contrib/brl/bseg/sdet
changed contrib/brl/bseg/sdet/tests
copied contrib/brl/bseg/sdet/sdet_k_means.cxx -> contrib/brl/bbas/bsta/bsta_k_means.cxx
copied contrib/brl/bseg/sdet/sdet_k_means.h -> contrib/brl/bbas/bsta/bsta_k_means.h
copied contrib/brl/bseg/sdet/tests/test_k_means.cxx -> contrib/brl/bbas/bsta/tests/test_k_means.cxx
contrib
Directory.
contrib/brl
Directory.
contrib/brl/bbas
Directory.
contrib/brl/bseg
Directory.
contrib/brl/bseg/sdet/sdet_k_means.cxx to contrib/brl/bbas/bsta/bsta_k_means.cxx
--- a/contrib/brl/bseg/sdet/sdet_k_means.cxx
+++ b/contrib/brl/bbas/bsta/bsta_k_means.cxx
@@ -1,5 +1,5 @@
-// This is brl/bseg/sdet/sdet_k_means.cxx
-#include "sdet_k_means.h"
+// This is bsta/bsta_k_means.cxx
+#include "bsta_k_means.h"
 //:
 //  \file
 
@@ -27,14 +27,14 @@
 // if some of the centres start off outside the convex hull of the data set.
 // In particular if you let the function initialise the centres, it will
 // occur if any of the first k data samples are identical.
-unsigned sdet_k_means(vcl_vector<vnl_vector<double> > &data, unsigned& k,
+unsigned bsta_k_means(vcl_vector<vnl_vector<double> > &data, unsigned& k,
                      vcl_vector<vnl_vector<double> >* cluster_centres,
                      vcl_vector<unsigned> * partition //=0
                     )
 {
   unsigned n_data = data.size();
   if(n_data==0){
-    vcl_cout << "no data to process in sdet_k_means\n";
+    vcl_cout << "no data to process in bsta_k_means\n";
     return 0;
   }
   vcl_vector<vnl_vector<double> > & centres = *cluster_centres;
@@ -197,7 +197,7 @@
 //
 // \par
 // The algorithm has been optimised
-unsigned sdet_k_means_weighted(vcl_vector<vnl_vector<double> > &data,
+unsigned bsta_k_means_weighted(vcl_vector<vnl_vector<double> > &data,
                                unsigned& k,
                                const vcl_vector<double>& wts,
                                vcl_vector<vnl_vector<double> >* cluster_centres,
@@ -206,7 +206,7 @@
 {
   unsigned n_data = data.size();
   if(n_data==0){
-    vcl_cout << "no data to process in sdet_k_means\n";
+    vcl_cout << "no data to process in bsta_k_means\n";
     return 0;
   }
   vcl_vector<vnl_vector<double> > & centres = *cluster_centres;
@@ -255,7 +255,7 @@
 #else
         if (++didx<n_data)
         {
-          vcl_cerr << "ERROR: sdet_k_means_weighted, while initialising centres from data\n"
+          vcl_cerr << "ERROR: bsta_k_means_weighted, while initialising centres from data\n"
                    << "Not enough non-zero-weighted data\n";
           vcl_abort();
         }
contrib/brl/bseg/sdet/sdet_k_means.h to contrib/brl/bbas/bsta/bsta_k_means.h
--- a/contrib/brl/bseg/sdet/sdet_k_means.h
+++ b/contrib/brl/bbas/bsta/bsta_k_means.h
@@ -1,13 +1,13 @@
-// This is brl/bseg/sdet/sdet_k_means.h
-#ifndef sdet_k_means_h
-#define sdet_k_means_h
+// This is brl/bbas/bsta/bsta_k_means.h
+#ifndef bsta_k_means_h
+#define bsta_k_means_h
 //:
 // \file
 // \author Ian Scott
 // \date 18-May-2001
 // \brief K Means clustering functions
 // \verbatim
-// Copied to sdet to avoid cross linking, J.L. Mundy December 13, 2011
+// Copied to bsta to avoid cross linking, J.L. Mundy June 4, 2013
 // \endverbatim
 #include <vcl_vector.h>
 #include <vnl/vnl_vector.h>
@@ -31,7 +31,7 @@
 // if some of the centres start off outside the convex hull of the data set.
 // In particular if you let the function initialise the centres, it will
 // occur if any of the first k data samples are identical.
-unsigned sdet_k_means(vcl_vector<vnl_vector<double> > &data, unsigned& k,
+unsigned bsta_k_means(vcl_vector<vnl_vector<double> > &data, unsigned& k,
                      vcl_vector<vnl_vector<double> >* cluster_centres,
                      vcl_vector<unsigned> * partition =0 );
 
@@ -55,9 +55,9 @@
 // if some of the centres start off outside the convex hull of the data set.
 // In particular if you let the function initialise the centres, it will
 // occur if any of the first k data samples are identical.
-unsigned sdet_k_means_weighted(vcl_vector<vnl_vector<double> > &data,
+unsigned bsta_k_means_weighted(vcl_vector<vnl_vector<double> > &data,
                                unsigned& k,
                               const vcl_vector<double>& wts,
                               vcl_vector<vnl_vector<double> >* cluster_centres,
                               vcl_vector<unsigned> * partition =0);
-#endif // sdet_k_means_h
+#endif // bsta_k_means_h
contrib/brl/bseg/sdet/tests/test_k_means.cxx to contrib/brl/bbas/bsta/tests/test_k_means.cxx
--- a/contrib/brl/bseg/sdet/tests/test_k_means.cxx
+++ b/contrib/brl/bbas/bsta/tests/test_k_means.cxx
@@ -1,10 +1,10 @@
-// This is brl/bseg/sdet/tests/test_k_means.cxx
+// This is brl/bbas/bsta/tests/test_k_means.cxx
 #include <testlib/testlib_test.h>
 #include <vcl_vector.h>
 #include <vcl_string.h>
 #include <vcl_sstream.h>
 #include <vcl_iostream.h>
-#include <sdet/sdet_k_means.h>
+#include <bsta/bsta_k_means.h>
 void test_k_means()
 {
   vcl_vector<vnl_vector<double> > pts(8, vnl_vector<double>(2,0.0));
@@ -20,7 +20,7 @@
   unsigned k = 2;
   vcl_vector<vnl_vector<double> > centers;
   vcl_vector<unsigned> partition;
-  unsigned n_iter = sdet_k_means(pts, k, &centers, &partition);
+  unsigned n_iter = bsta_k_means(pts, k, &centers, &partition);
   vcl_cout << "After " << n_iter << " iterations the cluster centers are:\n";
   for(unsigned i = 0; i<centers.size(); ++i)
     vcl_cout << "c[" << i << "]:(" << centers[i][0] << ' ' 
@@ -40,7 +40,7 @@
   centers.clear();
   partition.clear();
   vcl_vector<double> weights(8, 1.0);
-  n_iter = sdet_k_means_weighted(pts, k, weights, &centers, &partition);
+  n_iter = bsta_k_means_weighted(pts, k, weights, &centers, &partition);
   vcl_cout << "\nweighted k_means\n";
   vcl_cout << "After " << n_iter << " iterations the cluster centers are:\n";
   for(unsigned i = 0; i<centers.size(); ++i)