kmeans.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*****************************************************************************/
  2. /*IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. */
  3. /*By downloading, copying, installing or using the software you agree */
  4. /*to this license. If you do not agree to this license, do not download, */
  5. /*install, copy or use the software. */
  6. /* */
  7. /* */
  8. /*Copyright (c) 2005 Northwestern University */
  9. /*All rights reserved. */
  10. /*Redistribution of the software in source and binary forms, */
  11. /*with or without modification, is permitted provided that the */
  12. /*following conditions are met: */
  13. /* */
  14. /*1 Redistributions of source code must retain the above copyright */
  15. /* notice, this list of conditions and the following disclaimer. */
  16. /* */
  17. /*2 Redistributions in binary form must reproduce the above copyright */
  18. /* notice, this list of conditions and the following disclaimer in the */
  19. /* documentation and/or other materials provided with the distribution.*/
  20. /* */
  21. /*3 Neither the name of Northwestern University nor the names of its */
  22. /* contributors may be used to endorse or promote products derived */
  23. /* from this software without specific prior written permission. */
  24. /* */
  25. /*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS */
  26. /*IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED */
  27. /*TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT AND */
  28. /*FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL */
  29. /*NORTHWESTERN UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, */
  30. /*INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  31. /*(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR */
  32. /*SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */
  33. /*HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, */
  34. /*STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
  35. /*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  36. /*POSSIBILITY OF SUCH DAMAGE. */
  37. /******************************************************************************/
  38. #ifndef _H_FUZZY_KMEANS
  39. #define _H_FUZZY_KMEANS
  40. #ifndef FLT_MAX
  41. #define FLT_MAX 3.40282347e+38
  42. #endif
  43. /* rmse.c */
  44. float euclid_dist_2 (float*, float*, int);
  45. int find_nearest_point (float* , int, float**, int);
  46. float rms_err(float**, int, int, float**, int);
  47. int cluster(int, int, float**, int, int, float, int*, float***, float*, int, int, int, int, int);
  48. int setup(int argc, char** argv);
  49. int allocate(int npoints, int nfeatures, int nclusters, float **feature, int platform_id, int device_id, int use_gpu);
  50. void deallocateMemory();
  51. int kmeansOCL(float **feature, int nfeatures, int npoints, int nclusters, int *membership, float **clusters, int *new_centers_len, float **new_centers);
  52. float** kmeans_clustering(float **feature, int nfeatures, int npoints, int nclusters, float threshold, int *membership);
  53. #endif