public void samplesToString(DoubleArrayList theta) { int cols = theta.size(); sampleString = ""; for (int param = 0; param < (cols - 1); ++param) { sampleString = sampleString + Double.toString(theta.getQuick(param)) + ", "; // thetaSamples.set(sampleLoc, param, thetaEstNow.get(param)); } sampleString = sampleString + Double.toString(theta.getQuick(cols - 1)); // System.out.println(); }
@SuppressWarnings("unchecked") public void remove() { if (last == -1) throw new IllegalStateException(); if (pos < -1) { // We're removing wrapped entries. Double2DoubleOpenCustomHashMap.this.remove(wrapped.getDouble(-pos - 2)); last = -1; return; } size--; if (shiftKeys(last) == pos && c > 0) { c++; nextEntry(); } last = -1; // You can no longer remove this entry. if (ASSERTS) checkTable(); }
/** * Shifts left entries with the specified hash code, starting at the specified position, and * empties the resulting free entry. If any entry wraps around the table, instantiates lazily * {@link #wrapped} and stores the entry key. * * @param pos a starting position. * @return the position cleared by the shifting process. */ protected final int shiftKeys(int pos) { // Shift entries with the same hash. int last, slot; for (; ; ) { pos = ((last = pos) + 1) & mask; while (used[pos]) { slot = (it.unimi.dsi.fastutil.HashCommon.murmurHash3(strategy.hashCode(key[pos]))) & mask; if (last <= pos ? last >= slot || slot > pos : last >= slot && slot > pos) break; pos = (pos + 1) & mask; } if (!used[pos]) break; if (pos < last) { // Wrapped entry. if (wrapped == null) wrapped = new DoubleArrayList(); wrapped.add(key[pos]); } key[last] = key[pos]; value[last] = value[pos]; } used[last] = false; return last; }
public int nextEntry() { if (!hasNext()) throw new NoSuchElementException(); c--; // We are just enumerating elements from the wrapped list. if (pos < 0) { final double k = wrapped.getDouble(-(last = --pos) - 2); // The starting point. int pos = (it.unimi.dsi.fastutil.HashCommon.murmurHash3(strategy.hashCode(k))) & mask; // There's always an unused entry. while (used[pos]) { if ((strategy.equals((key[pos]), (k)))) return pos; pos = (pos + 1) & mask; } } last = pos; // System.err.println( "Count: " + c ); if (c != 0) { final boolean used[] = Double2DoubleOpenCustomHashMap.this.used; while (pos-- != 0 && !used[pos]) ; // When here pos < 0 there are no more elements to be enumerated by scanning, but wrapped // might be nonempty. } return last; }