it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet Java Examples
The following examples show how to use
it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Int2Int2DoubleArrayTable.java From metanome-algorithms with Apache License 2.0 | 5 votes |
@Override public DoubleSet values() { DoubleSet result = new DoubleOpenHashSet(); Arrays.stream(array) .filter(Objects::nonNull) .map(Int2DoubleRow::values) .flatMap(DoubleCollection::stream) .mapToDouble(Double::doubleValue) .forEach(result::add); return result; }
Example #2
Source File: MultiThresholdProviderTest.java From metanome-algorithms with Apache License 2.0 | 5 votes |
@Test public void testGetNext() { List<DoubleSet> similarities = Arrays .asList(new DoubleOpenHashSet(Sets.newHashSet(Double.valueOf(0.7), Double.valueOf(0.6))), new DoubleOpenHashSet(Sets.newHashSet(Double.valueOf(0.8)))); ThresholdProvider provider = create(similarities); assertThat(provider.getNext(0, 0.5).boxed()).hasValue(Double.valueOf(0.6)); assertThat(provider.getNext(0, 0.6).boxed()).hasValue(Double.valueOf(0.7)); assertThat(provider.getNext(1, 0.8).boxed()).isEmpty(); }
Example #3
Source File: UniformTrimmerTest.java From metanome-algorithms with Apache License 2.0 | 5 votes |
@Test public void test() { ThresholdFilter thresholdFilter = new UniformDistributionThresholdProviderThresholdFilter(3, new ExactThresholdFilter()); DoubleSet similarities = new DoubleOpenHashSet(new double[]{0.2, 0.3, 0.4, 0.5}); Iterable<Double> thresholds = thresholdFilter.filter(similarities); assertThat(thresholds).hasSize(3); assertThat(thresholds).contains(Double.valueOf(0.2), Double.valueOf(0.3), Double.valueOf(0.5)); }
Example #4
Source File: UniformTrimmerTest.java From metanome-algorithms with Apache License 2.0 | 5 votes |
@Test public void testExact() { ThresholdFilter thresholdFilter = new UniformDistributionThresholdProviderThresholdFilter(3, new ExactThresholdFilter()); DoubleSet similarities = new DoubleOpenHashSet(new double[]{0.2, 0.3, 0.4, 0.5, 0.6}); Iterable<Double> thresholds = thresholdFilter.filter(similarities); assertThat(thresholds).hasSize(3); assertThat(thresholds).contains(Double.valueOf(0.2), Double.valueOf(0.4), Double.valueOf(0.6)); }
Example #5
Source File: InPredicateEvaluatorFactory.java From incubator-pinot with Apache License 2.0 | 5 votes |
DoubleRawValueBasedInPredicateEvaluator(InPredicate inPredicate) { List<String> values = inPredicate.getValues(); _matchingValues = new DoubleOpenHashSet(HashUtil.getMinHashSetSize(values.size())); for (String value : values) { _matchingValues.add(Double.parseDouble(value)); } }
Example #6
Source File: StepThresholdProviderTest.java From metanome-algorithms with Apache License 2.0 | 5 votes |
@Test public void testGetNext() { ThresholdFilter thresholdFilter = new StepThresholdFilter( Arrays.asList(Double.valueOf(0.9), Double.valueOf(0.8), Double.valueOf(0.4), Double.valueOf(0.7))); Iterable<Double> thresholds = thresholdFilter .filter(new DoubleOpenHashSet(Sets.newHashSet(Double.valueOf(0.7), Double.valueOf(0.6)))); assertThat(thresholds).hasSize(4); assertThat(thresholds).contains(Double.valueOf(0.9), Double.valueOf(0.8), Double.valueOf(0.4), Double.valueOf(0.7)); }
Example #7
Source File: NotInPredicateEvaluatorFactory.java From incubator-pinot with Apache License 2.0 | 5 votes |
DoubleRawValueBasedNotInPredicateEvaluator(NotInPredicate notInPredicate) { List<String> values = notInPredicate.getValues(); _nonMatchingValues = new DoubleOpenHashSet(HashUtil.getMinHashSetSize(values.size())); for (String value : values) { _nonMatchingValues.add(Double.parseDouble(value)); } }
Example #8
Source File: ExactThresholdProviderTest.java From metanome-algorithms with Apache License 2.0 | 5 votes |
@Test public void testGetNext() { ThresholdFilter thresholdFilter = new ExactThresholdFilter(); Iterable<Double> thresholds = thresholdFilter .filter(new DoubleOpenHashSet(Sets.newHashSet(Double.valueOf(0.7), Double.valueOf(0.6)))); assertThat(thresholds).hasSize(2); assertThat(thresholds).contains(Double.valueOf(0.7), Double.valueOf(0.6)); }
Example #9
Source File: DoubleColumn.java From tablesaw with Apache License 2.0 | 5 votes |
@Override public DoubleColumn unique() { final DoubleSet doubles = new DoubleOpenHashSet(); for (int i = 0; i < size(); i++) { doubles.add(getDouble(i)); } final DoubleColumn column = DoubleColumn.create(name() + " Unique values"); doubles.forEach((DoubleConsumer) column::append); return column; }
Example #10
Source File: DoubleColumn.java From tablesaw with Apache License 2.0 | 5 votes |
@Override public int countUnique() { DoubleSet uniqueElements = new DoubleOpenHashSet(); for (int i = 0; i < size(); i++) { uniqueElements.add(getDouble(i)); } return uniqueElements.size(); }
Example #11
Source File: DoubleColumn.java From tablesaw with Apache License 2.0 | 5 votes |
@Override public DoubleColumn unique() { final DoubleSet doubles = new DoubleOpenHashSet(); for (int i = 0; i < size(); i++) { doubles.add(getDouble(i)); } final DoubleColumn column = DoubleColumn.create(name() + " Unique values"); doubles.forEach((DoubleConsumer) column::append); return column; }
Example #12
Source File: DoubleColumn.java From tablesaw with Apache License 2.0 | 5 votes |
@Override public int countUnique() { DoubleSet uniqueElements = new DoubleOpenHashSet(); for (int i = 0; i < size(); i++) { uniqueElements.add(getDouble(i)); } return uniqueElements.size(); }
Example #13
Source File: ImmutableDictionaryTest.java From incubator-pinot with Apache License 2.0 | 4 votes |
@BeforeClass public void setUp() throws Exception { FileUtils.deleteQuietly(TEMP_DIR); IntOpenHashSet intSet = new IntOpenHashSet(); while (intSet.size() < NUM_VALUES) { intSet.add(RANDOM.nextInt()); } _intValues = intSet.toIntArray(); Arrays.sort(_intValues); LongOpenHashSet longSet = new LongOpenHashSet(); while (longSet.size() < NUM_VALUES) { longSet.add(RANDOM.nextLong()); } _longValues = longSet.toLongArray(); Arrays.sort(_longValues); FloatOpenHashSet floatSet = new FloatOpenHashSet(); while (floatSet.size() < NUM_VALUES) { floatSet.add(RANDOM.nextFloat()); } _floatValues = floatSet.toFloatArray(); Arrays.sort(_floatValues); DoubleOpenHashSet doubleSet = new DoubleOpenHashSet(); while (doubleSet.size() < NUM_VALUES) { doubleSet.add(RANDOM.nextDouble()); } _doubleValues = doubleSet.toDoubleArray(); Arrays.sort(_doubleValues); Set<String> stringSet = new HashSet<>(); while (stringSet.size() < NUM_VALUES) { stringSet.add(RandomStringUtils.random(RANDOM.nextInt(MAX_STRING_LENGTH)).replace('\0', ' ')); } _stringValues = stringSet.toArray(new String[NUM_VALUES]); Arrays.sort(_stringValues); Set<ByteArray> bytesSet = new HashSet<>(); while (bytesSet.size() < NUM_VALUES) { byte[] bytes = new byte[BYTES_LENGTH]; RANDOM.nextBytes(bytes); bytesSet.add(new ByteArray(bytes)); } _bytesValues = bytesSet.toArray(new ByteArray[NUM_VALUES]); Arrays.sort(_bytesValues); try (SegmentDictionaryCreator dictionaryCreator = new SegmentDictionaryCreator(_intValues, new DimensionFieldSpec(INT_COLUMN_NAME, FieldSpec.DataType.INT, true), TEMP_DIR)) { dictionaryCreator.build(); } try (SegmentDictionaryCreator dictionaryCreator = new SegmentDictionaryCreator(_longValues, new DimensionFieldSpec(LONG_COLUMN_NAME, FieldSpec.DataType.LONG, true), TEMP_DIR)) { dictionaryCreator.build(); } try (SegmentDictionaryCreator dictionaryCreator = new SegmentDictionaryCreator(_floatValues, new DimensionFieldSpec(FLOAT_COLUMN_NAME, FieldSpec.DataType.FLOAT, true), TEMP_DIR)) { dictionaryCreator.build(); } try (SegmentDictionaryCreator dictionaryCreator = new SegmentDictionaryCreator(_doubleValues, new DimensionFieldSpec(DOUBLE_COLUMN_NAME, FieldSpec.DataType.DOUBLE, true), TEMP_DIR)) { dictionaryCreator.build(); } try (SegmentDictionaryCreator dictionaryCreator = new SegmentDictionaryCreator(_stringValues, new DimensionFieldSpec(STRING_COLUMN_NAME, FieldSpec.DataType.STRING, true), TEMP_DIR)) { dictionaryCreator.build(); _numBytesPerStringValue = dictionaryCreator.getNumBytesPerEntry(); } try (SegmentDictionaryCreator dictionaryCreator = new SegmentDictionaryCreator(_bytesValues, new DimensionFieldSpec(BYTES_COLUMN_NAME, FieldSpec.DataType.BYTES, true), TEMP_DIR)) { dictionaryCreator.build(); assertEquals(dictionaryCreator.getNumBytesPerEntry(), BYTES_LENGTH); } }
Example #14
Source File: SlimSimilarityIndex.java From metanome-algorithms with Apache License 2.0 | 4 votes |
@Override public DoubleSet getSimilarities() { Collection<Double> values = similarityTable.values(); return new DoubleOpenHashSet(values); }
Example #15
Source File: ExactThresholdProviderTest.java From metanome-algorithms with Apache License 2.0 | 4 votes |
@Test public void testEmpty() { ThresholdFilter thresholdFilter = new ExactThresholdFilter(); Iterable<Double> thresholds = thresholdFilter.filter(new DoubleOpenHashSet()); assertThat(thresholds).isEmpty(); }
Example #16
Source File: StepThresholdProviderTest.java From metanome-algorithms with Apache License 2.0 | 4 votes |
@Test public void testEmpty() { ThresholdFilter thresholdFilter = new StepThresholdFilter(Collections.emptyList()); Iterable<Double> thresholds = thresholdFilter.filter(new DoubleOpenHashSet()); assertThat(thresholds).isEmpty(); }
Example #17
Source File: MultiThresholdProviderTest.java From metanome-algorithms with Apache License 2.0 | 4 votes |
@Test public void testEmpty() { List<DoubleSet> similarities = Collections.singletonList(new DoubleOpenHashSet()); ThresholdProvider provider = create(similarities); assertThat(provider.getNext(0, 0.0).boxed()).isEmpty(); }