def __merge_clusters(self, cluster1, cluster2):
merged_cluster = cure_cluster(None, None)<EOL>merged_cluster.points = cluster1.points + cluster2.points<EOL>merged_cluster.indexes = cluster1.indexes + cluster2.indexes<EOL>dimension = len(cluster1.mean)<EOL>merged_cluster.mean = [<NUM_LIT:0>] * dimension<EOL>if merged_cluster.points[<NUM_LIT:1>:] == merged_cluster.points[:-<NUM_LIT:1>]:<EOL><INDENT>merged_cluster.mean = merged_cluster.points[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>for index in range(dimension):<EOL><INDENT>merged_cluster.mean[index] = ( len(cluster1.points) * cluster1.mean[index] + len(cluster2.points) * cluster2.mean[index] ) / ( len(cluster1.points) + len(cluster2.points) );<EOL><DEDENT><DEDENT>temporary = list()<EOL>for index in range(self.__number_represent_points):<EOL><INDENT>maximal_distance = <NUM_LIT:0><EOL>maximal_point = None<EOL>for point in merged_cluster.points:<EOL><INDENT>minimal_distance = <NUM_LIT:0><EOL>if index == <NUM_LIT:0>:<EOL><INDENT>minimal_distance = euclidean_distance_square(point, merged_cluster.mean)<EOL><DEDENT>else:<EOL><INDENT>minimal_distance = min([euclidean_distance_square(point, p) for p in temporary])<EOL><DEDENT>if minimal_distance >= maximal_distance:<EOL><INDENT>maximal_distance = minimal_distance<EOL>maximal_point = point<EOL><DEDENT><DEDENT>if maximal_point not in temporary:<EOL><INDENT>temporary.append(maximal_point)<EOL><DEDENT><DEDENT>for point in temporary:<EOL><INDENT>representative_point = [<NUM_LIT:0>] * dimension<EOL>for index in range(dimension):<EOL><INDENT>representative_point[index] = point[index] + self.__compression * (merged_cluster.mean[index] - point[index])<EOL><DEDENT>merged_cluster.rep.append(representative_point)<EOL><DEDENT>return merged_cluster<EOL>
!
        @brief Merges two clusters and returns new merged cluster. Representation points and mean points are calculated for the new cluster.

        @param[in] cluster1 (cure_cluster): Cluster that should be merged.
        @param[in] cluster2 (cure_cluster): Cluster that should be merged.

        @return (cure_cluster) New merged CURE cluster.