/usr/include/vl/ikmeans.h is in libvlfeat-dev 0.9.17+dfsg0-6+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | /** @file ikmeans.h
** @brief Integer K-Means clustering
** @author Brian Fulkerson
** @author Andrea Vedaldi
**/
/*
Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
All rights reserved.
This file is part of the VLFeat library and is made available under
the terms of the BSD license (see the COPYING file).
*/
#ifndef VL_IKMEANS_H
#define VL_IKMEANS_H
#include "generic.h"
#include "random.h"
typedef vl_int32 vl_ikm_acc ; /**< IKM accumulator data type */
/** ------------------------------------------------------------------
** @brief IKM algorithms
**/
enum VlIKMAlgorithms {
VL_IKM_LLOYD, /**< Lloyd algorithm */
VL_IKM_ELKAN /**< Elkan algorithm */
} ;
/** ------------------------------------------------------------------
** @brief IKM quantizer
**/
typedef struct _VlIKMFilt
{
int M ; /**< data dimensionality */
int K ; /**< number of centers */
int method ; /**< Learning method */
int max_niters ; /**< Lloyd: maximum number of iterations */
int verb ; /**< verbosity level */
vl_ikm_acc *centers ; /**< centers */
vl_ikm_acc *inter_dist ; /**< centers inter-distances */
} VlIKMFilt ;
/** @name Create and destroy
** @{
**/
VL_EXPORT VlIKMFilt *vl_ikm_new (int method) ;
VL_EXPORT void vl_ikm_delete (VlIKMFilt *f) ;
/** @} */
/** @name Process data
** @{
**/
VL_EXPORT void vl_ikm_init (VlIKMFilt *f, vl_ikm_acc const *centers, int M, int K) ;
VL_EXPORT void vl_ikm_init_rand (VlIKMFilt *f, int M, int K) ;
VL_EXPORT void vl_ikm_init_rand_data (VlIKMFilt *f, vl_uint8 const *data, int M, int N, int K) ;
VL_EXPORT int vl_ikm_train (VlIKMFilt *f, vl_uint8 const *data, int N) ;
VL_EXPORT void vl_ikm_push (VlIKMFilt *f, vl_uint *asgn, vl_uint8 const *data, int N) ;
VL_EXPORT
vl_uint vl_ikm_push_one (vl_ikm_acc const *centers,
vl_uint8 const *data,
int M, int K) ;
/** @} */
/** @name Retrieve data and parameters
** @{
**/
VL_INLINE int vl_ikm_get_ndims (VlIKMFilt const *f) ;
VL_INLINE int vl_ikm_get_K (VlIKMFilt const *f) ;
VL_INLINE int vl_ikm_get_verbosity (VlIKMFilt const *f) ;
VL_INLINE int vl_ikm_get_max_niters (VlIKMFilt const *f) ;
VL_INLINE vl_ikm_acc const * vl_ikm_get_centers (VlIKMFilt const *f) ;
/** @} */
/** @name Set parameters
** @{
**/
VL_INLINE void vl_ikm_set_verbosity (VlIKMFilt *f, int verb) ;
VL_INLINE void vl_ikm_set_max_niters (VlIKMFilt *f, int max_niters) ;
/** @} */
/** ------------------------------------------------------------------
** @brief Get data dimensionality
** @param f IKM filter.
** @return data dimensionality.
**/
VL_INLINE int
vl_ikm_get_ndims (VlIKMFilt const* f)
{
return f-> M ;
}
/** ------------------------------------------------------------------
** @brief Get the number of centers K
** @param f IKM filter.
** @return number of centers K.
**/
VL_INLINE int
vl_ikm_get_K (VlIKMFilt const* f)
{
return f-> K ;
}
/** ------------------------------------------------------------------
** @brief Get verbosity level
** @param f IKM filter.
** @return verbosity level.
**/
VL_INLINE int
vl_ikm_get_verbosity (VlIKMFilt const* f)
{
return f-> verb ;
}
/** ------------------------------------------------------------------
** @brief Get maximum number of iterations
** @param f IKM filter.
** @return maximum number of iterations.
**/
VL_INLINE int
vl_ikm_get_max_niters (VlIKMFilt const* f)
{
return f-> max_niters ;
}
/** ------------------------------------------------------------------
** @brief Get maximum number of iterations
** @param f IKM filter.
** @return maximum number of iterations.
**/
VL_INLINE vl_ikm_acc const *
vl_ikm_get_centers (VlIKMFilt const* f)
{
return f-> centers ;
}
/** ------------------------------------------------------------------
** @brief Set verbosity level
** @param f IKM filter.
** @param verb verbosity level.
**/
VL_INLINE void
vl_ikm_set_verbosity (VlIKMFilt *f, int verb)
{
f-> verb = VL_MAX(0,verb) ;
}
/** ------------------------------------------------------------------
** @brief Set maximum number of iterations
** @param f IKM filter.
** @param max_niters maximum number of iterations.
**/
VL_INLINE void
vl_ikm_set_max_niters (VlIKMFilt *f, int max_niters)
{
f-> max_niters = max_niters ;
}
/* VL_IKMEANS_H */
#endif
|