Changeset 14927 for branches/PersistenceReintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/PriorityQueue.cs
- Timestamp:
- 05/04/17 17:19:35 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/PriorityQueue.cs
r14785 r14927 63 63 64 64 public KeyValuePair<TK, TV> PeekMin() { 65 if (size == 0) {65 if (size == 0) { 66 66 throw new InvalidOperationException("Heap is empty"); 67 67 } … … 86 86 size = sz - 1; 87 87 finalLayerDist++; 88 if (finalLayerDist == finalLayerSize) {88 if (finalLayerDist == finalLayerSize) { 89 89 finalLayerSize >>= 2; 90 90 finalLayerDist = 0; 91 91 } 92 92 93 while (succ < sz) {93 while (succ < sz) { 94 94 var minKey = data[succ].Key; 95 95 var delta = 0; 96 96 97 97 var otherKey = data[succ + 1].Key; 98 if (otherKey.CompareTo(minKey) < 0) {98 if (otherKey.CompareTo(minKey) < 0) { 99 99 minKey = otherKey; 100 100 delta = 1; 101 101 } 102 102 otherKey = data[succ + 2].Key; 103 if (otherKey.CompareTo(minKey) < 0) {103 if (otherKey.CompareTo(minKey) < 0) { 104 104 minKey = otherKey; 105 105 delta = 2; 106 106 } 107 107 otherKey = data[succ + 3].Key; 108 if (otherKey.CompareTo(minKey) < 0) {108 if (otherKey.CompareTo(minKey) < 0) { 109 109 minKey = otherKey; 110 110 delta = 3; … … 136 136 pred = pred - layerDist; // finally preds index 137 137 138 while (data[pred].Key.CompareTo(bubble) > 0) { // must terminate since inf at root138 while (data[pred].Key.CompareTo(bubble) > 0) { // must terminate since inf at root 139 139 data[hole].Key = data[pred].Key; 140 140 data[hole].Value = data[pred].Value; … … 158 158 finalLayerDist--; 159 159 160 if (finalLayerDist == -1) { // layer full161 // start next layer160 if (finalLayerDist == -1) { // layer full 161 // start next layer 162 162 finalLayerSize <<= 2; 163 163 finalLayerDist = finalLayerSize - 1; … … 172 172 pred = pred - layerDist; // finally preds index 173 173 var predKey = data[pred].Key; 174 while (predKey.CompareTo(key) > 0) {174 while (predKey.CompareTo(key) > 0) { 175 175 data[hole].Key = predKey; 176 176 data[hole].Value = data[pred].Value; … … 195 195 var sup = Supremum; 196 196 var cap = capacity; 197 for (var i = 1; i <= cap; i++) {197 for (var i = 1; i <= cap; i++) { 198 198 data[i].Key = sup; 199 199 }
Note: See TracChangeset
for help on using the changeset viewer.