43b503cbb9e91b597a2ba97b8807096114e68935
kent
  Thu Aug 28 13:06:17 2014 -0700
Removing hacTreeExpensiveMerges and simplifying hacTreeMultiThread
diff --git src/inc/hacTree.h src/inc/hacTree.h
index fa625c1..1bf994b 100644
--- src/inc/hacTree.h
+++ src/inc/hacTree.h
@@ -67,45 +67,42 @@
     struct hacTree *parent;     // Cluster that contains this cluster, NULL for root node
     struct hacTree *left;       // Left child, NULL for leaf node
     struct hacTree *right;      // Right child, NULL for leaf node
     double childDistance;       // Result of distance function on left and right kids
     struct slList *itemOrCluster;  // If leaf node, one of the items passed in;
                                 // otherwise, result of merging left and right kids' itemOrClusters
     };
 
 struct hacTree *hacTreeFromItems(const struct slList *itemList, struct lm *localMem,
 				 hacDistanceFunction *distF, hacMergeFunction *mergeF,
 				 hacCmpFunction *cmpF, void *extraData);
 /* Using distF, mergeF, optionally cmpF and binary tree operations,
  * perform a hierarchical agglomerative (bottom-up) clustering of
  * items.  To free the resulting tree, lmCleanup(&localMem). */
 
-struct hacTree *hacTreeForCostlyMerges(struct slList *itemList, struct lm *localMem,
-				 hacDistanceFunction *distF, hacMergeFunction *mergeF,
-				 void *extraData);
-/* Construct hacTree similar to hacTreeForItems, but using a method that will minimize the 
- * number of calls to the distance and merge functions, assuming they are expensive.  
- * Do a lmCleanup(&localMem) to free the returned tree. */
-
 struct hacTree *hacTreeMultiThread(int threadCount, struct slList *itemList, struct lm *localMem,
 				 hacDistanceFunction *distF, hacMergeFunction *mergeF,
 				 void *extraData, struct hash *precalcDistanceHash);
 /* Construct hacTree minimizing number of merges called, and doing distance calls
  * in parallel when possible.   Do a lmCleanup(localMem) to free returned tree. 
  * The inputs are
  *	threadCount - number of threads - at least one, recommended no more than 15
  *	itemList - list of items to tree up.  Format can vary, but must start with a
  *	           pointer to next item in list.
  *	localMem - memory pool where hacTree and a few other things are allocated from
  *	distF - function that calculates distance between two items, passed items and extraData
  *	mergeF - function that creates a new item in same format as itemList from two passed
  *	         in items and the extraData.  Typically does average of two input items
  *	extraData - parameter passed through to distF and mergeF, otherwise unused, may be NULL
  *	precalcDistanceHash - a hash containing at least some of the pairwise distances
  *	            between items on itemList, set with hacTreeDistanceHashAdd. 
  *	            As a side effect this hash will be expanded to include all distances 
- *	            including those between intermediate nodes. */
+ *	            including those between intermediate nodes.  May be NULL. */
 
 void hacTreeDistanceHashAdd(struct hash *hash, void *itemA, void *itemB, double distance);
 /* Add an item to distance hash */
 
+double * hacTreeDistanceHashLookup(struct hash *hash, void *itemA, void *itemB);
+/* Look up pair in distance hash.  Returns NULL if not found, otherwise pointer to
+ * distance */
+
 #endif//def HACTREE_H