fkmeans/kmeans.h

53 lines
1.3 KiB
C
Raw Normal View History

2010-11-18 19:22:00 +01:00
/*
* =====================================================================================
*
* Filename: kmeans.h
*
* Description: Header file for C k-means implementation
*
* Version: 1.0
* Created: 12/11/2010 10:43:55
* Revision: none
* Compiler: gcc
*
* Author: BlackLight (http://0x00.ath.cx), <blacklight@autistici.org>
* Licence: GNU GPL v.3
* Company: DO WHAT YOU WANT CAUSE A PIRATE IS FREE, YOU ARE A PIRATE!
*
* =====================================================================================
*/
#ifndef __KMEANS_H
#define __KMEANS_H
typedef struct __kmeans_t {
2010-11-19 12:20:36 +01:00
/** Input data set */
2010-11-18 19:22:00 +01:00
double **dataset;
2010-11-19 12:20:36 +01:00
/** Number of elements in the data set */
2010-11-18 19:22:00 +01:00
int dataset_size;
2010-11-19 12:20:36 +01:00
/** Dimension of each element of the data set */
2010-11-18 19:22:00 +01:00
int dataset_dim;
2010-11-19 12:20:36 +01:00
/** Number of clusters */
2010-11-18 19:22:00 +01:00
int k;
2010-11-19 12:20:36 +01:00
/** Vector containing the number of elements in each cluster */
2010-11-18 19:22:00 +01:00
int *cluster_sizes;
2010-11-19 12:20:36 +01:00
/** Clusters */
2010-11-18 19:22:00 +01:00
double ***clusters;
2010-11-19 12:20:36 +01:00
/** Coordinates of the centers of the clusters */
2010-11-18 19:22:00 +01:00
double **centers;
} kmeans_t;
kmeans_t* kmeans_new ( double **dataset, const int dataset_size, const int dataset_dim, const int K );
kmeans_t* kmeans_auto ( double **dataset, int dataset_size, int dataset_dim );
void kmeans ( kmeans_t *km );
void kmeans_free ( kmeans_t *km );
#endif