- Main Page
- Data Structures
- Files
- Related Pages

# ikmeans.c File Reference

Integer K-Means clustering - Definition. More...

`#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"`

## Functions
VlIKMFilt * | vl_ikm_new (int method)
| Create a new IKM quantizer.
void | vl_ikm_delete (VlIKMFilt *f)
| Delete IKM qunatizer.
int | vl_ikm_train (VlIKMFilt *f, vl_ikm_data const *data, int N)
| Train clusters.
void | vl_ikm_push (VlIKMFilt *f, vl_uint *asgn, vl_ikm_data const *data, int N)
| Project data to clusters.
vl_uint | vl_ikm_push_one (vl_ikm_acc const *centers, vl_ikm_data const *data, int M, int K)
| Project one datum to clusters.

## Detailed Description

Author:
  Brian Fulkerson

  Andrea Vedaldi

## Function Documentation

void vl_ikm_delete | ( | VlIKMFilt * | f | ) |

Parameters:

  | f | IKM qunatizer.

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 qunatizer.

void vl_ikm_push | ( | VlIKMFilt * | f,
|  | vl_uint * | asgn,
|  | vl_ikm_data const * | data,
|  | int | N |
| ) |  |  |

Parameters:

  | f | IKM qunatizer.
  | asgn | Assigments (out).
  | data | data.
  | N | number of data (N `>=` 1).

The function projects the data data on the integer K-kmeans clusters specified by the IKM quantizer f. Notice that the quantizer must be initialized.

vl_uint vl_ikm_push_one | ( | vl_ikm_acc const * | centers,
|  | vl_ikm_data 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.

int vl_ikm_train | ( | VlIKMFilt * | f,
|  | vl_ikm_data const * | data,
|  | int | N |
| ) |  |  |

Parameters:

  | f | IKM qunatizer.
  | data | data.
  | N | number of data (N `>=` 1).

Returns:
  -1 if an overflow may have occured.