00001
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef VL_IKMEANS_H
00015 #define VL_IKMEANS_H
00016
00017 #include "generic.h"
00018
00019 typedef vl_int32 vl_ikm_acc ;
00025 VL_EXPORT
00026 enum VlIKMAlgorithms {
00027 VL_IKM_LLOYD,
00028 VL_IKM_ELKAN
00029 } ;
00030
00035 typedef struct _VlIKMFilt
00036 {
00037 int M ;
00038 int K ;
00040 int method ;
00041 int max_niters ;
00042 int verb ;
00044 vl_ikm_acc *centers ;
00045 vl_ikm_acc *inter_dist ;
00046 } VlIKMFilt ;
00047
00051 VL_EXPORT VlIKMFilt *vl_ikm_new (int method) ;
00052 VL_EXPORT void vl_ikm_delete (VlIKMFilt *f) ;
00058 VL_EXPORT void vl_ikm_init (VlIKMFilt *f, vl_ikm_acc const *centers, int M, int K) ;
00059 VL_EXPORT void vl_ikm_init_rand (VlIKMFilt *f, int M, int K) ;
00060 VL_EXPORT void vl_ikm_init_rand_data (VlIKMFilt *f, vl_uint8 const *data, int M, int N, int K) ;
00061 VL_EXPORT int vl_ikm_train (VlIKMFilt *f, vl_uint8 const *data, int N) ;
00062 VL_EXPORT void vl_ikm_push (VlIKMFilt *f, vl_uint *asgn, vl_uint8 const *data, int N) ;
00063
00064 VL_EXPORT
00065 vl_uint vl_ikm_push_one (vl_ikm_acc const *centers,
00066 vl_uint8 const *data,
00067 int M, int K) ;
00073 VL_INLINE int vl_ikm_get_ndims (VlIKMFilt const *f) ;
00074 VL_INLINE int vl_ikm_get_K (VlIKMFilt const *f) ;
00075 VL_INLINE int vl_ikm_get_verbosity (VlIKMFilt const *f) ;
00076 VL_INLINE int vl_ikm_get_max_niters (VlIKMFilt const *f) ;
00077 VL_INLINE vl_ikm_acc const * vl_ikm_get_centers (VlIKMFilt const *f) ;
00083 VL_INLINE void vl_ikm_set_verbosity (VlIKMFilt *f, int verb) ;
00084 VL_INLINE void vl_ikm_set_max_niters (VlIKMFilt *f, int max_niters) ;
00093 VL_INLINE int
00094 vl_ikm_get_ndims (VlIKMFilt const* f)
00095 {
00096 return f-> M ;
00097 }
00098
00105 VL_INLINE int
00106 vl_ikm_get_K (VlIKMFilt const* f)
00107 {
00108 return f-> K ;
00109 }
00110
00117 VL_INLINE int
00118 vl_ikm_get_verbosity (VlIKMFilt const* f)
00119 {
00120 return f-> verb ;
00121 }
00122
00129 VL_INLINE int
00130 vl_ikm_get_max_niters (VlIKMFilt const* f)
00131 {
00132 return f-> max_niters ;
00133 }
00134
00141 VL_INLINE vl_ikm_acc const *
00142 vl_ikm_get_centers (VlIKMFilt const* f)
00143 {
00144 return f-> centers ;
00145 }
00146
00153 VL_INLINE void
00154 vl_ikm_set_verbosity (VlIKMFilt *f, int verb)
00155 {
00156 f-> verb = verb ;
00157 }
00158
00165 VL_INLINE void
00166 vl_ikm_set_max_niters (VlIKMFilt *f, int max_niters)
00167 {
00168 f-> max_niters = max_niters ;
00169 }
00170
00171
00172 #endif