Package gnu.trove.set.hash

Examples of gnu.trove.set.hash.TIntHashSet.toArray()


   */
  public static int[] union(int[] a, int[] b) {
    TIntHashSet set = new TIntHashSet();
    set.addAll(a);
    set.addAll(b);
    return set.toArray();
  }

  /**
   * Computes the intersection of two <b>sorted</b> arrays. Will deduplicate the
   * items, so the return is a set of integers.
View Full Code Here


      if (set.contains(a)) {
        toReturn.add(a);
      }
    }

    return toReturn.toArray();
  }

  /**
   * If array contains unique integers in a range between 0 and n-1, this
   * function finds the only one missing in linear time and constant memory.
View Full Code Here

    int bestSplitIndex = bestSplit.getSplitAttributeIndex();
    if (featureTypes[bestSplitIndex].isNominal()) {
      TIntHashSet uniqueFeatures = getNominalValues(bestSplitIndex, features);
      NominalNode node = new NominalNode(bestSplitIndex, uniqueFeatures.size());
      int cIndex = 0;
      for (int nominalValue : uniqueFeatures.toArray()) {
        node.nominalSplitValues[cIndex] = nominalValue;
        Tuple<List<DoubleVector>, List<DoubleVector>> filtered = filterNominal(
            features, outcome, bestSplitIndex, nominalValue);
        TIntHashSet newPossibleFeatures = new TIntHashSet(
            possibleFeatureIndices);
View Full Code Here

      if (!globallyVisitedVertices.contains(i)) {
        globallyVisitedVertices.add(i);
        TIntHashSet set = new TIntHashSet();
        set = bfs(set, i, adjacencyMatrix);
        if (!set.isEmpty()) {
          connectedComponents.put(clusterId++, set.toArray());
          globallyVisitedVertices.addAll(set);
        }
      }
    }
    // translate the adjacents back to the points
View Full Code Here

        // NOPE. this NPEs.
        Fluid fluid = FluidRegistry.getFluid(str.type);
        if (fluid != null)
          ints.add(fluid.getID());
      }
      fluidList = ints.toArray();
    }
    if (water)
      return new FeatureGenUnderfluid(featureName, gen, matList, numClusters, biomeRes, retrogen, dimRes);
    else
      return new FeatureGenUnderfluid(featureName, gen, matList, fluidList, numClusters, biomeRes, retrogen, dimRes);
View Full Code Here

        if (fromL == null)
            return tensor;

        allIndicesNames.addAll(getIndicesNames(tensor.getIndices().getFree()));
        IndexGeneratorImpl generator = new IndexGeneratorImpl(allIndicesNames.toArray());
        int[] from = fromL.toArray(), to = new int[fromL.size()];
        Arrays.sort(from);
        added.ensureCapacity(from.length);
        int i;
        for (i = from.length - 1; i >= 0; --i)
View Full Code Here

        if (fromL == null)
            return tensor;

        allIndicesNames.addAll(getIndicesNames(tensor.getIndices().getFree()));
        IndexGeneratorImpl generator = new IndexGeneratorImpl(allIndicesNames.toArray());
        int[] from = fromL.toArray(), to = new int[fromL.size()];
        Arrays.sort(from);
        int i;
        for (i = from.length - 1; i >= 0; --i)
            to[i] = generator.generate(IndicesUtils.getType(from[i]));
View Full Code Here

        if (TensorUtils.passOutDummies(tensor)) {
            TIntHashSet forbidden = new TIntHashSet();
            for (j = 0; j < size; ++j)
                if (j != i)
                    TensorUtils.appendAllIndicesNamesT(get(j), forbidden);
            tensor = ApplyIndexMapping.renameDummy(tensor, forbidden.toArray());
        }

        Boolean compare = TensorUtils.compare1(old, tensor);
        if (compare == null)
            return super.set(i, tensor);
View Full Code Here

        Tensor factor, newFactor;
        int toResolvePosition = toResolve.size();
        for (i = factors.length - 1; i >= 0; --i)
            if (result[i] == null) {
                factor = toResolve.get(--toResolvePosition);
                newFactor = ApplyIndexMapping.renameDummy(factor, forbidden.toArray());
                forbidden.addAll(TensorUtils.getAllIndicesNamesT(newFactor));
                result[i] = newFactor;
            }
//        for (int i = toResolve.size() - 1; i >= 0; --i) {
//            factor = toResolve.get(i);
View Full Code Here

        int i;
        for (i = factors.length - 1; i >= 0; --i)
            forbidden.addAll(TensorUtils.getAllIndicesNamesT(factors[i]));

        for (i = factors.length - 1; i >= 0; --i) {
            factors[i] = ApplyIndexMapping.renameDummy(factors[i], forbidden.toArray());
            forbidden.addAll(TensorUtils.getAllIndicesNamesT(factors[i]));
        }
    }

    /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.