- Main Page
- Data Structures
- Files
- Related Pages

# hikmeans.c File Reference

Heirachical Integer K-Means Clustering - Declaration. More...

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <math.h>`
`#include "hikmeans.h"`

## Functions
vl_ikm_data * | vl_hikm_copy_subset (vl_ikm_data const *data, vl_uint *ids, int N, int M, vl_uint id, int *N2)
| Copy a subset of the data to a buffer.
static VlHIKMNode * | xmeans (VlHIKMTree *tree, vl_ikm_data const *data, int N, int K, int height)
| Compute HIKM clustering.
static void | xdelete (VlHIKMNode *node)
| Delete node.
VlHIKMTree * | vl_hikm_new (int method)
| New HIKM tree.
void | vl_hikm_delete (VlHIKMTree *f)
| Delete HIKM tree.
void | vl_hikm_init (VlHIKMTree *f, int M, int K, int depth)
| Initialize HIKM tree.
void | vl_hikm_train (VlHIKMTree *f, vl_ikm_data const *data, int N)
| Train HIKM tree.
void | vl_hikm_push (VlHIKMTree *f, vl_uint *asgn, vl_ikm_data const *data, int N)
| Project data down HIKM tree.

## Detailed Description

Author:
  Brian Fulkerson

  Andrea Vedaldi

## Function Documentation

vl_ikm_data* vl_hikm_copy_subset | ( | vl_ikm_data const * | data,
|  | vl_uint * | ids,
|  | int | N,
|  | int | M,
|  | vl_uint | id,
|  | int * | N2 |
| ) |  |  |

For internal use only.

Parameters:

  | data | Data.
  | ids | Data labels.
  | N | Number of indeces.
  | M | Data dimensionality.
  | id | Label of data to copy.
  | N2 | Number of data copied (out).

Returns:
  a new buffer with a copy of the selected data.

void vl_hikm_delete | ( | VlHIKMTree * | f | ) |

Parameters:

  | f | HIKM tree.

void vl_hikm_init | ( | VlHIKMTree * | f,
|  | int | M,
|  | int | K,
|  | int | depth |
| ) |  |  |

Parameters:

  | f | HIKM tree.
  | M | Data dimensionality.
  | K | Number of clusters per node.
  | depth | Tree depth.

Remarks:
  depth cannot be smaller than 1.

Returns:
  a new HIKM tree representing the clustering.

VlHIKMTree* vl_hikm_new | ( | int | method | ) |

Parameters:

  | method | clustering method.

Returns:
  new HIKM tree.

void vl_hikm_push | ( | VlHIKMTree * | f,
|  | vl_uint * | asgn,
|  | vl_ikm_data const * | data,
|  | int | N |
| ) |  |  |

Parameters:

  | f | HIKM tree.
  | asgn | Path down the tree (out).
  | data | Data to project.
  | N | Number of data.

The function writes to asgn the path of the data data down the HIKM tree f. The paramter asgn must point to an array of `M` by `N` elements, where `M` is the depth of the HIKM tree and `N` is the number of data point to process.

void vl_hikm_train | ( | VlHIKMTree * | f,
|  | vl_ikm_data const * | data,
|  | int | N |
| ) |  |  |

Parameters:

  | f | HIKM tree.
  | data | Data to cluster.
  | N | Number of data.

static void xdelete | ( | VlHIKMNode * | node | ) | `[static]`

For internal use only.

Parameters:

  | node | to delete.

The function deletes recursively node and all its descendent.

static VlHIKMNode* xmeans | ( | VlHIKMTree * | tree,
|  | vl_ikm_data const * | data,
|  | int | N,
|  | int | K,
|  | int | height |
| ) |  |  | `[static]`

Parameters:

  | tree | HIKM tree to initialize.
  | data | Data to cluster.
  | N | Number of data points.
  | K | Number of clusters for this node.
  | height | Tree height.

Remarks:
  height cannot be smller than 1.

Returns:
  a new HIKM node representing a sub-clustering.