Package com.google.uzaygezen.core

Examples of com.google.uzaygezen.core.BitVector


    }
    StreamingRollup<BitVector, BigIntegerContent> rollup = BoundedRollup.create(
      new BigIntegerContent(BigInteger.ZERO), cacheSize);
    Scan fullScan = new Scan();
    ResultScanner scanner = table.getScanner(fullScan);
    BitVector hilbertIndex = BitVectorFactories.OPTIMAL.apply(spec.sumBitsPerDimension());
    for (Result row : scanner) {
      hilbertIndex.copyFromBigEndian(row.getRow());
      for (int i = 0; i < path.length; ++i) {
        path[i] = path[i].clone();
      }
      BitVectorMath.split(hilbertIndex, path);
      // We should say the exact number of times. Saying one is correct, but
View Full Code Here


    BitVector[] point = new BitVector[spec.getBitsPerDimension().size()];
    for (int j = 0; j < spec.getBitsPerDimension().size(); ++j) {
      point[j] = BitVectorFactories.OPTIMAL.apply(spec.getBitsPerDimension().get(j));
    }
    for (int i : filtered) {
      BitVector index = BitVectorFactories.OPTIMAL.apply(spec.sumBitsPerDimension());
      // int has 32 bits, which fits in each dimensions.
      for (int j = 0; j < spec.getBitsPerDimension().size(); ++j) {
        point[j].copyFrom(data[i][j]);
      }
      sfc.index(point, 0, index);
      pairs.add(Pair.of(index.clone(), i));
    }
    // Sort by Hilbert index.
    Collections.sort(pairs);
    List<int[]> expected = new ArrayList<>(pairs.size());
    for (Pair<BitVector, Integer> pair : pairs) {
View Full Code Here

    for (int i = 0; i < indexRanges.size() - 1; ++i) {
      FilteredIndexRange<Object, BigIntegerRange> a = indexRanges.get(i);
      FilteredIndexRange<Object, BigIntegerRange> b = indexRanges.get(i + 1);
      Assert.assertTrue(a.getIndexRange().getEnd().compareTo(b.getIndexRange().getStart()) < 0);
    }
    BitVector start = BitVectorFactories.OPTIMAL.apply(spec.sumBitsPerDimension());
    BitVector end = BitVectorFactories.OPTIMAL.apply(spec.sumBitsPerDimension());
    Scan[] scans = new Scan[indexRanges.size()];
    for (int i = 0; i < indexRanges.size(); ++i) {
      FilteredIndexRange<Object, BigIntegerRange> indexRange = indexRanges.get(i);
      BigInteger startBigInteger = indexRange.getIndexRange().getStart();
      start.copyFrom(startBigInteger);
      BigInteger endBigInteger = indexRange.getIndexRange().getEnd();
      final Scan scan;
      if (endBigInteger.testBit(spec.sumBitsPerDimension())) {
        scan = new Scan(start.toBigEndianByteArray());
      } else {
        end.copyFrom(endBigInteger);
        scan = new Scan(start.toBigEndianByteArray(), end.toBigEndianByteArray());
      }
      scans[i] = scan;
    }
    BitVector[] point = new BitVector[spec.getBitsPerDimension().size()];
    BitVector index = BitVectorFactories.OPTIMAL.apply(spec.sumBitsPerDimension());
    for (int j = 0; j < spec.getBitsPerDimension().size(); ++j) {
      point[j] = BitVectorFactories.OPTIMAL.apply(spec.getBitsPerDimension().get(j));
    }
    List<int[]> actual = new ArrayList<>();
    for (int i = 0; i < indexRanges.size(); ++i) {
      ResultScanner scanner = table.getScanner(scans[i]);
      FilteredIndexRange<Object, BigIntegerRange> indexRange = indexRanges.get(i);
      logger.log(Level.FINE, "indexRange={0}", indexRange);
      for (Result result : scanner) {
        byte[] row = result.getRow();
        index.copyFromBigEndian(row);
        sfc.indexInverse(index, point);
        boolean isContained = RangeUtil.containsBigInteger(
          region, Arrays.asList(bitVectorPointToBigIntegerPoint(point)));
        if (!indexRange.isPotentialOverSelectivity()) {
          Assert.assertTrue(isContained);
View Full Code Here

  private static void populateTable(
    final byte[] family, final byte[][] qualifiers, MultiDimensionalSpec spec, int[][] data,
    SpaceFillingCurve sfc, MockHTable table) throws IOException, InterruptedException {
    BitVector[] point = new BitVector[spec.getBitsPerDimension().size()];
    BitVector index = BitVectorFactories.OPTIMAL.apply(spec.sumBitsPerDimension());
    for (int j = 0; j < spec.getBitsPerDimension().size(); ++j) {
      point[j] = BitVectorFactories.OPTIMAL.apply(spec.getBitsPerDimension().get(j));
    }
    Put[] puts = new Put[data.length];
    for (int i = 0; i < data.length; ++i) {
      // int has 32 bits, which fits in each dimensions.
      for (int j = 0; j < spec.getBitsPerDimension().size(); ++j) {
        point[j].copyFrom(data[i][j]);
      }
      sfc.index(point, 0, index);
      byte[] row = index.toBigEndianByteArray();
      Put put = new Put(row);
      KeyValue[] keyValues = new KeyValue[qualifiers.length];
      for (int k = 0; k < qualifiers.length; ++k) {
        // Put a nice string representation of the data point in the dummy
        // column.
View Full Code Here

          values[i],
          binsPerDimension[i]));
    }

    // Convert the normalized values to a BitVector
    final BitVector hilbertBitVector = convertToHilbert(
        dimensionValues,
        compactHilbertCurve,
        dimensionDefinitions);

    return hilbertBitVector.toBigEndianByteArray();
  }
View Full Code Here

      final List<BigInteger> values,
      final CompactHilbertCurve compactHilbertCurve,
      final SFCDimensionDefinition[] dimensionDefinitions ) {
    final BitVector[] bitVectors = new BitVector[values.size()];

    final BitVector hilbertBitVector = BitVectorFactories.OPTIMAL.apply(compactHilbertCurve.getSpec().sumBitsPerDimension());

    for (int i = 0; i < values.size(); i++) {
      bitVectors[i] = BitVectorFactories.OPTIMAL.apply(dimensionDefinitions[i].getBitsOfPrecision());
      bitVectors[i].copyFrom(values.get(i));
    }
View Full Code Here

          values[i],
          binsPerDimension[i]));
    }

    // Convert the normalized values to a BitVector
    final BitVector hilbertBitVector = convertToHilbert(
        dimensionValues,
        compactHilbertCurve,
        dimensionDefinitions);

    return hilbertBitVector.toBigEndianByteArray();
  }
View Full Code Here

      final List<Long> values,
      final CompactHilbertCurve compactHilbertCurve,
      final SFCDimensionDefinition[] dimensionDefinitions ) {
    final BitVector[] bitVectors = new BitVector[values.size()];

    final BitVector hilbertBitVector = BitVectorFactories.OPTIMAL.apply(compactHilbertCurve.getSpec().sumBitsPerDimension());

    for (int i = 0; i < values.size(); i++) {
      bitVectors[i] = BitVectorFactories.OPTIMAL.apply(dimensionDefinitions[i].getBitsOfPrecision());
      bitVectors[i].copyFrom(values.get(i));
    }
View Full Code Here

      final byte[] hilbertValue,
      final CompactHilbertCurve compactHilbertCurve,
      final SFCDimensionDefinition[] dimensionDefinitions ) {
    final BitVector[] perDimensionBitVectors = new BitVector[dimensionDefinitions.length];

    final BitVector hilbertBitVector = BitVectorFactories.OPTIMAL.apply(compactHilbertCurve.getSpec().sumBitsPerDimension());
    hilbertBitVector.copyFromBigEndian(hilbertValue);
    for (int i = 0; i < dimensionDefinitions.length; i++) {
      perDimensionBitVectors[i] = BitVectorFactories.OPTIMAL.apply(dimensionDefinitions[i].getBitsOfPrecision());
    }

    compactHilbertCurve.indexInverse(
View Full Code Here

TOP

Related Classes of com.google.uzaygezen.core.BitVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.