private static void computeCentroids(MixtureModel f, MixtureModel g, Clustering.CLUSTERING_TYPE type, int[] repartition){
		int n = f.size;
		int m = g.size;
		int i,j;
		
		// Count how many param compose each class
		int[] count = new int[m];
		for (i=0; i<n; i++)
			count[repartition[i]]++;

		for (i=0; i<m; i++){
			
			if (count[i]==0){
				g.param[i]  = null;
				g.weight[i] = 0;
				System.err.printf("The class %d is empty. Impossible to compute the centroid.", i);
			}
			else if (count[i]==1){
				for (j=0; j<n; j++){
					if (repartition[j]==i){
						g.param[i]  = f.param[j];
						g.weight[i] = f.weight[j];
						break;
					}
				}
			}
			else{
				MixtureModel mix = new MixtureModel(count[i]);
				mix.EF = f.EF;
				
				// Build the mixture model and normalize weights
				int ind = 0;
				double sum = 0;
				for (j=0; j<n; j++){
					if (repartition[j]==i){
						mix.weight[ind] = f.weight[j];
						mix.param[ind]  = f.param[j];
						sum            += f.weight[j];
						ind++;
					}
				}
				mix.normalizeWeights();
				
				// Compute the centroid
				g.param[i] = Clustering.getCentroid(mix, type);
				
				// Set the weight of the centroid
				g.weight[i] = sum;
			}
		}
	}