* This routine first checks to see if the samples in this * clusterer have already been clustered before; if so, it does * not bother to recreate the cluster tree. It simply recomputes * the prototypes based on the new Config info. * * If the samples have not been clustered before, the * samples in the KD tree are formed into a cluster tree and then * the prototypes are computed from the c
| 511 | * @note History: 5/29/89, DSJ, Created. |
| 512 | */ |
| 513 | LIST ClusterSamples(CLUSTERER *Clusterer, CLUSTERCONFIG *Config) { |
| 514 | //only create cluster tree if samples have never been clustered before |
| 515 | if (Clusterer->Root == NULL) |
| 516 | CreateClusterTree(Clusterer); |
| 517 | |
| 518 | //deallocate the old prototype list if one exists |
| 519 | FreeProtoList (&Clusterer->ProtoList); |
| 520 | Clusterer->ProtoList = NIL_LIST; |
| 521 | |
| 522 | //compute prototypes starting at the root node in the tree |
| 523 | ComputePrototypes(Clusterer, Config); |
| 524 | // We don't need the cluster pointers in the protos any more, so null them |
| 525 | // out, which makes it safe to delete the clusterer. |
| 526 | LIST proto_list = Clusterer->ProtoList; |
| 527 | iterate(proto_list) { |
| 528 | PROTOTYPE *proto = reinterpret_cast<PROTOTYPE *>(first_node(proto_list)); |
| 529 | proto->Cluster = NULL; |
| 530 | } |
| 531 | return Clusterer->ProtoList; |
| 532 | } // ClusterSamples |
| 533 | |
| 534 | /** |
| 535 | * This routine frees all of the memory allocated to the |
nothing calls this directly
no test coverage detected