useDynLib("clue", .registration = TRUE, .fixes = "C_")

import("stats")
importFrom("graphics", "par", "plot")
importFrom("cluster", "clara", "pam", "silhouette")

export("cl_agreement",
       "cl_bag",
       "cl_boot",
       "cl_consensus",
       "cl_dissimilarity",
       "cl_ensemble", "as.cl_ensemble", "is.cl_ensemble",
       "cl_fuzziness",
       "cl_join",
       "cl_margin",
       "cl_meet",
       "cl_medoid",
       "cl_membership", "as.cl_membership",
       "cl_object_names",
       "cl_pam",
       "cl_pclust",
       "cl_predict",
       "cl_prototypes",
       "cl_tabulate",
       "cl_ultrametric", "as.cl_ultrametric",
       "ls_fit_addtree",
       "ls_fit_centroid",
       "ls_fit_ultrametric",       
       "ls_fit_sum_of_ultrametrics",
       "ls_fit_ultrametric_target",
       "l1_fit_ultrametric",       
       "l1_fit_ultrametric_target",
       "cl_validity",
       "n_of_objects",
       "n_of_classes",
       "cl_class_ids", "as.cl_class_ids",
       "cl_classes",
       "is.cl_partition", "as.cl_partition",
       "is.cl_hard_partition", "as.cl_hard_partition",
       "is.cl_soft_partition", "is.cl_dendrogram",
       "as.cl_dendrogram",
       "is.cl_hierarchy", "as.cl_hierarchy",
       "as.cl_addtree",
       "kmedoids",
       "pclust", "pclust_family", "pclust_object",
       "solve_LSAP",
       "sumt")

## S3 methods, sorted alphabetically.

S3method("[", "cl_agreement")
S3method("[", "cl_dissimilarity")
S3method("[", "cl_ensemble")
S3method("[", "cl_proximity")

S3method("Complex", "cl_hierarchy")
S3method("Complex", "cl_partition")

S3method("Math", "cl_hierarchy")
S3method("Math", "cl_partition")

S3method("Ops", "cl_dendrogram")
S3method("Ops", "cl_hierarchy")
S3method("Ops", "cl_partition")

S3method("Summary", "cl_hierarchy")
S3method("Summary", "cl_partition")
S3method("Summary", "cl_partition_ensemble")

S3method("as.cl_addtree", "default")
S3method("as.cl_addtree", "phylo")

S3method("as.cl_membership", "default")
S3method("as.cl_membership", "matrix")

S3method("as.cl_ultrametric", "default")
S3method("as.cl_ultrametric", "matrix")

S3method("as.dendrogram", "cl_ultrametric")

S3method("as.dist", "cl_dissimilarity")

S3method("as.hclust", "cl_hierarchy")
S3method("as.hclust", "cl_ultrametric")
S3method("as.hclust", "mona")

S3method("as.matrix", "cl_proximity")
S3method("as.matrix", "hclust")

S3method("c", "cl_ensemble")

S3method("cl_class_ids", "Mclust")
S3method("cl_class_ids", "Weka_clusterer")
S3method("cl_class_ids", "bclust")
S3method("cl_class_ids", "ccfkms")
S3method("cl_class_ids", "cclust")
S3method("cl_class_ids", "cl_class_ids")
S3method("cl_class_ids", "cl_membership")
S3method("cl_class_ids", "cl_pam")
S3method("cl_class_ids", "cl_partition")
S3method("cl_class_ids", "cl_partition_by_class_ids")
S3method("cl_class_ids", "cshell")
S3method("cl_class_ids", "default")
S3method("cl_class_ids", "fclust")
S3method("cl_class_ids", "flexmix")
S3method("cl_class_ids", "kcca")
S3method("cl_class_ids", "kmeans")
S3method("cl_class_ids", "kmedoids")
S3method("cl_class_ids", "movMF")
S3method("cl_class_ids", "partition")
S3method("cl_class_ids", "pclust")
S3method("cl_class_ids", "relation")
S3method("cl_class_ids", "rock")
S3method("cl_class_ids", "specc")

S3method("cl_classes", "cl_hierarchy")
S3method("cl_classes", "cl_partition")
S3method("cl_classes", "cl_ultrametric")
S3method("cl_classes", "default")

S3method("cl_membership", "Mclust")
S3method("cl_membership", "bclust")
S3method("cl_membership", "cclust")
S3method("cl_membership", "cl_membership")
S3method("cl_membership", "cl_partition")
S3method("cl_membership", "cshell")
S3method("cl_membership", "default")
S3method("cl_membership", "fanny")
S3method("cl_membership", "fclust")
S3method("cl_membership", "flexmix")
S3method("cl_membership", "kmeans")
S3method("cl_membership", "movMF")
S3method("cl_membership", "partition")
S3method("cl_membership", "pclust")

S3method("cl_object_names", "cl_ensemble")
S3method("cl_object_names", "cl_hierarchy")
S3method("cl_object_names", "cl_membership")
S3method("cl_object_names", "cl_partition")
S3method("cl_object_names", "cl_ultrametric")
S3method("cl_object_names", "default")
S3method("cl_object_names", "dist")
S3method("cl_object_names", "hclust")
S3method("cl_object_names", "mona")
S3method("cl_object_names", "phylo")
S3method("cl_object_names", "twins")

S3method("cl_predict", "Mclust")
S3method("cl_predict", "Weka_clusterer")
S3method("cl_predict", "bclust")
S3method("cl_predict", "cclust")
S3method("cl_predict", "cl_partition")
S3method("cl_predict", "ccfkms")
S3method("cl_predict", "clara")
S3method("cl_predict", "cshell")
S3method("cl_predict", "default")
S3method("cl_predict", "fanny")
S3method("cl_predict", "fclust")
S3method("cl_predict", "flexmix")
S3method("cl_predict", "kcca")
S3method("cl_predict", "kmeans")
S3method("cl_predict", "movMF")
S3method("cl_predict", "pam")
S3method("cl_predict", "pclust")
S3method("cl_predict", "rock")

S3method("cl_prototypes", "Mclust")
S3method("cl_prototypes", "bclust")
S3method("cl_prototypes", "ccfkms")
S3method("cl_prototypes", "cclust")
S3method("cl_prototypes", "cl_pam")
S3method("cl_prototypes", "cl_partition")
S3method("cl_prototypes", "clara")
S3method("cl_prototypes", "cshell")
S3method("cl_prototypes", "fclust")
S3method("cl_prototypes", "kcca")
S3method("cl_prototypes", "kmeans")
S3method("cl_prototypes", "pam")
S3method("cl_prototypes", "pclust")
S3method("cl_prototypes", "specc")

S3method("cl_validity", "agnes")
S3method("cl_validity", "default")
S3method("cl_validity", "diana")
S3method("cl_validity", "cl_partition")
S3method("cl_validity", "pclust")

S3method("cophenetic", "cl_ultrametric")
S3method("cophenetic", "mona")

S3method("cut", "cl_dendrogram")

S3method("is.cl_dendrogram", "cl_dendrogram")
S3method("is.cl_dendrogram", "default")
S3method("is.cl_dendrogram", "hclust")
S3method("is.cl_dendrogram", "mona")
S3method("is.cl_dendrogram", "phylo")
S3method("is.cl_dendrogram", "twins")

S3method("is.cl_hard_partition", "Mclust")
S3method("is.cl_hard_partition", "Weka_clusterer")
S3method("is.cl_hard_partition", "bclust")
S3method("is.cl_hard_partition", "ccfkms")
S3method("is.cl_hard_partition", "cclust")
S3method("is.cl_hard_partition", "cl_hard_partition")
S3method("is.cl_hard_partition", "cl_partition")
S3method("is.cl_hard_partition", "cshell")
S3method("is.cl_hard_partition", "default")
S3method("is.cl_hard_partition", "fanny")
S3method("is.cl_hard_partition", "fclust")
S3method("is.cl_hard_partition", "flexmix")
S3method("is.cl_hard_partition", "kcca")
S3method("is.cl_hard_partition", "kmeans")
S3method("is.cl_hard_partition", "kmedoids")
S3method("is.cl_hard_partition", "movMF")
S3method("is.cl_hard_partition", "partition")
S3method("is.cl_hard_partition", "pclust")
S3method("is.cl_hard_partition", "rock")
S3method("is.cl_hard_partition", "specc")

S3method("is.cl_hierarchy", "cl_hierarchy")
S3method("is.cl_hierarchy", "default")
S3method("is.cl_hierarchy", "hclust")
S3method("is.cl_hierarchy", "mona")
S3method("is.cl_hierarchy", "phylo")
S3method("is.cl_hierarchy", "twins")

S3method("is.cl_partition", "Mclust")
S3method("is.cl_partition", "Weka_clusterer")
S3method("is.cl_partition", "bclust")
S3method("is.cl_partition", "ccfkms")
S3method("is.cl_partition", "cclust")
S3method("is.cl_partition", "cl_partition")
S3method("is.cl_partition", "cshell")
S3method("is.cl_partition", "default")
S3method("is.cl_partition", "fclust")
S3method("is.cl_partition", "flexmix")
S3method("is.cl_partition", "kcca")
S3method("is.cl_partition", "kmeans")
S3method("is.cl_partition", "kmedoids")
S3method("is.cl_partition", "movMF")
S3method("is.cl_partition", "partition")
S3method("is.cl_partition", "pclust")
S3method("is.cl_partition", "rock")
S3method("is.cl_partition", "specc")

S3method("n_of_classes", "Mclust")
S3method("n_of_classes", "bclust")
S3method("n_of_classes", "cclust")
S3method("n_of_classes", "cl_membership")
S3method("n_of_classes", "cl_partition")
S3method("n_of_classes", "cshell")
S3method("n_of_classes", "default")
S3method("n_of_classes", "fanny")
S3method("n_of_classes", "fclust")
S3method("n_of_classes", "kmeans")
S3method("n_of_classes", "partition")
S3method("n_of_classes", "pclust")

S3method("n_of_objects", "Mclust")
S3method("n_of_objects", "bclust")
S3method("n_of_objects", "cclust")
S3method("n_of_objects", "cl_ensemble")
S3method("n_of_objects", "cl_hierarchy")
S3method("n_of_objects", "cl_membership")
S3method("n_of_objects", "cl_partition")
S3method("n_of_objects", "cl_ultrametric")
S3method("n_of_objects", "cshell")
S3method("n_of_objects", "default")
S3method("n_of_objects", "dist")
S3method("n_of_objects", "fclust")
S3method("n_of_objects", "hclust")
S3method("n_of_objects", "kmeans")
S3method("n_of_objects", "mona")
S3method("n_of_objects", "partition")
S3method("n_of_objects", "pclust")
S3method("n_of_objects", "phylo")
S3method("n_of_objects", "twins")

S3method("names", "cl_proximity")

S3method("plot", "cl_addtree")
S3method("plot", "cl_ensemble")
S3method("plot", "cl_dendrogram")
S3method("plot", "cl_ultrametric")

S3method("print", "cl_class_ids")
S3method("print", "cl_classes_of_partition_of_objects")
S3method("print", "cl_classes_of_hierarchy_of_objects")
S3method("print", "cl_cross_proximity")
S3method("print", "cl_dendrogram")
S3method("print", "cl_dendrogram_ensemble")
S3method("print", "cl_ensemble")
S3method("print", "cl_fuzziness")
S3method("print", "cl_hierarchy")
S3method("print", "cl_hierarchy_ensemble")
S3method("print", "cl_membership")
S3method("print", "cl_pam")
S3method("print", "cl_partition")
S3method("print", "cl_partition_by_class_ids")
S3method("print", "cl_partition_by_memberships")
S3method("print", "cl_partition_ensemble")
S3method("print", "cl_proximity")
S3method("print", "cl_pclust")
S3method("print", "cl_validity")
S3method("print", "kmedoids")
S3method("print", "pclust")
S3method("print", "solve_LSAP")

S3method("rep", "cl_ensemble")

S3method("silhouette", "cl_partition")
S3method("silhouette", "cl_pclust")

S3method("unique", "cl_ensemble")

S3method(".maybe_is_proper_soft_partition", "Mclust")
S3method(".maybe_is_proper_soft_partition", "cl_partition")
S3method(".maybe_is_proper_soft_partition", "cshell")
S3method(".maybe_is_proper_soft_partition", "default") 
S3method(".maybe_is_proper_soft_partition", "fanny")
S3method(".maybe_is_proper_soft_partition", "fclust")
S3method(".maybe_is_proper_soft_partition", "flexmix")
S3method(".maybe_is_proper_soft_partition", "pclust")