ikmeans.c File Reference


Detailed Description

Author:
Brian Fulkerson

Andrea Vedaldi

Definition in file ikmeans.c.

#include "ikmeans.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "assert.h"
#include "ikmeans_init.tc"
#include "ikmeans_lloyd.tc"
#include "ikmeans_elkan.tc"

Go to the source code of this file.


Functions

VlIKMFiltvl_ikm_new (int method)
 Create a new IKM quantizer.
void vl_ikm_delete (VlIKMFilt *f)
 Delete IKM quantizer.
VL_EXPORT int vl_ikm_train (VlIKMFilt *f, vl_uint8 const *data, int N)
 Train clusters.
VL_EXPORT void vl_ikm_push (VlIKMFilt *f, vl_uint *asgn, vl_uint8 const *data, int N)
 Project data to clusters.
VL_EXPORT vl_uint vl_ikm_push_one (vl_ikm_acc const *centers, vl_uint8 const *data, int M, int K)
 Project one datum to clusters.

Function Documentation

void vl_ikm_delete ( VlIKMFilt f  ) 

Parameters:
f IKM quantizer.

Definition at line 125 of file ikmeans.c.

References vl_free().

Referenced by xdelete().

VlIKMFilt* vl_ikm_new ( int  method  ) 

Parameters:
method Clustering algorithm.
The function allocates initializes a new IKM quantizer to operate based algorithm method.

method has values in the enumerations VlIKMAlgorithms.

Returns:
new IKM quantizer.

Definition at line 105 of file ikmeans.c.

References vl_malloc().

Referenced by xmeans().

VL_EXPORT void vl_ikm_push ( VlIKMFilt f,
vl_uint asgn,
vl_uint8 const *  data,
int  N 
)

Parameters:
f IKM quantizer.
asgn Assignments (out).
data data.
N number of data (N >= 1).
The function projects the data data on the integer K-means clusters specified by the IKM quantizer f. Notice that the quantizer must be initialized.

Definition at line 176 of file ikmeans.c.

References VL_IKM_ELKAN, and VL_IKM_LLOYD.

Referenced by vl_hikm_push(), and xmeans().

VL_EXPORT vl_uint vl_ikm_push_one ( vl_ikm_acc const *  centers,
vl_uint8 const *  data,
int  M,
int  K 
)

Parameters:
centers centers.
data datum to project.
K number of centers.
M dimensionality of the datum.
The function projects the specified datum data on the clusters specified by the centers centers.

Returns:
the cluster index.

Definition at line 200 of file ikmeans.c.

Referenced by vl_ikm_push_lloyd().

VL_EXPORT int vl_ikm_train ( VlIKMFilt f,
vl_uint8 const *  data,
int  N 
)

Parameters:
f IKM quantizer.
data data.
N number of data (N >= 1).
Returns:
-1 if an overflow may have occurred.

Definition at line 144 of file ikmeans.c.

References VL_IKM_ELKAN, VL_IKM_LLOYD, and VL_PRINTF.

Referenced by xmeans().