@Test public void compactHilbertIndexInverseFirstOrderOnSquare() { CompactHilbertCurve chc = new CompactHilbertCurve(new int[] {1, 1}); BitVector[] p = new BitVector[2]; p[0] = BitVectorFactories.OPTIMAL.apply(1); p[1] = BitVectorFactories.OPTIMAL.apply(1); chc.indexInverse(TestUtils.createBitVector(0, 2), p); Assert.assertTrue(p[0].isEmpty()); Assert.assertTrue(p[1].isEmpty()); chc.indexInverse(TestUtils.createBitVector(1, 2), p); Assert.assertTrue(p[0].isEmpty()); Assert.assertEquals(TestUtils.createBitVector(1, 1), p[1]); BitVector two = TestUtils.createBitVector(2, 2); chc.indexInverse(two, p); Assert.assertEquals(TestUtils.createBitVector(1, 1), p[0]); Assert.assertEquals(TestUtils.createBitVector(1, 1), p[1]); BitVector three = TestUtils.createBitVector(3, 2); chc.indexInverse(three, p); Assert.assertEquals(TestUtils.createBitVector(1, 1), p[0]); Assert.assertEquals(TestUtils.createBitVector(0, 1), p[1]); }
@Override public void indexInverse(BitVector index, BitVector[] p) { Preconditions.checkArgument(n == p.length, "p does not have the right size."); for (int i = 0; i < n; ++i) { p[i].clear(); } int d = 0; int k = spec.sumBitsPerDimension(); BitVector[] wAndT = new BitVector[] {w, t}; e.clear(); t.clear(); for (int i = spec.maxBitsPerDimension(); --i >= 0; ) { assert d < n; masks.copyMaskTo(i, d, mu); BitVector r = rBuffer[i]; int start = k - r.size(); r.copyFromSection(index, start); assert k == start + r.size(); computeInverseBits(d, mu, e, r, wAndT); copyOneBitToEachDimensionWhereSet(t, i, p); int oldD = d; d = updateD(d, w); k = start; updateE(oldD, w, e); } assert k == 0; }
CompactHilbertCurve implements SpaceFillingCurve { @Override public void indexInverse(BitVector index, BitVector[] p) { Preconditions.checkArgument(n == p.length, "p does not have the right size."); for (int i = 0; i < n; ++i) { p[i].clear(); } int d = 0; int k = spec.sumBitsPerDimension(); BitVector[] wAndT = new BitVector[] {w, t}; e.clear(); t.clear(); for (int i = spec.maxBitsPerDimension(); --i >= 0; ) { assert d < n; masks.copyMaskTo(i, d, mu); BitVector r = rBuffer[i]; int start = k - r.size(); r.copyFromSection(index, start); assert k == start + r.size(); computeInverseBits(d, mu, e, r, wAndT); copyOneBitToEachDimensionWhereSet(t, i, p); int oldD = d; d = updateD(d, w); k = start; updateE(oldD, w, e); } assert k == 0; } }
CompactHilbertCurve implements SpaceFillingCurve { @Override public void indexInverse(BitVector index, BitVector[] p) { Preconditions.checkArgument(n == p.length, "p does not have the right size."); for (int i = 0; i < n; ++i) { p[i].clear(); } int d = 0; int k = spec.sumBitsPerDimension(); BitVector[] wAndT = new BitVector[] {w, t}; e.clear(); t.clear(); for (int i = spec.maxBitsPerDimension(); --i >= 0; ) { assert d < n; masks.copyMaskTo(i, d, mu); BitVector r = rBuffer[i]; int start = k - r.size(); r.copyFromSection(index, start); assert k == start + r.size(); computeInverseBits(d, mu, e, r, wAndT); copyOneBitToEachDimensionWhereSet(t, i, p); int oldD = d; d = updateD(d, w); k = start; updateE(oldD, w, e); } assert k == 0; } CompactHilbertCurve(MultiDimensionalSpec spec);  CompactHilbertCurve(int[] m); }
CompactHilbertCurve implements SpaceFillingCurve { @Override public void indexInverse(BitVector index, BitVector[] p) { Preconditions.checkArgument(n == p.length, "p does not have the right size."); for (int i = 0; i < n; ++i) { p[i].clear(); } int d = 0; int k = spec.sumBitsPerDimension(); BitVector[] wAndT = new BitVector[] {w, t}; e.clear(); t.clear(); for (int i = spec.maxBitsPerDimension(); --i >= 0; ) { assert d < n; masks.copyMaskTo(i, d, mu); BitVector r = rBuffer[i]; int start = k - r.size(); r.copyFromSection(index, start); assert k == start + r.size(); computeInverseBits(d, mu, e, r, wAndT); copyOneBitToEachDimensionWhereSet(t, i, p); int oldD = d; d = updateD(d, w); k = start; updateE(oldD, w, e); } assert k == 0; } CompactHilbertCurve(MultiDimensionalSpec spec);  CompactHilbertCurve(int[] m); @Override MultiDimensionalSpec getSpec(); @Override void index(BitVector[] p, int minLevel, BitVector index); @Override void indexInverse(BitVector index, BitVector[] p); @Override void accept(ZoomingNavigator visitor); @Override String toString(); }
CompactHilbertCurve implements SpaceFillingCurve { @Override public void indexInverse(BitVector index, BitVector[] p) { Preconditions.checkArgument(n == p.length, "p does not have the right size."); for (int i = 0; i < n; ++i) { p[i].clear(); } int d = 0; int k = spec.sumBitsPerDimension(); BitVector[] wAndT = new BitVector[] {w, t}; e.clear(); t.clear(); for (int i = spec.maxBitsPerDimension(); --i >= 0; ) { assert d < n; masks.copyMaskTo(i, d, mu); BitVector r = rBuffer[i]; int start = k - r.size(); r.copyFromSection(index, start); assert k == start + r.size(); computeInverseBits(d, mu, e, r, wAndT); copyOneBitToEachDimensionWhereSet(t, i, p); int oldD = d; d = updateD(d, w); k = start; updateE(oldD, w, e); } assert k == 0; } CompactHilbertCurve(MultiDimensionalSpec spec);  CompactHilbertCurve(int[] m); @Override MultiDimensionalSpec getSpec(); @Override void index(BitVector[] p, int minLevel, BitVector index); @Override void indexInverse(BitVector index, BitVector[] p); @Override void accept(ZoomingNavigator visitor); @Override String toString();  }