com.davidbracewell.apollo.hash.InMemoryLSHStorage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apollo Show documentation
Show all versions of apollo Show documentation
A machine learning library for Java.
The newest version!
package com.davidbracewell.apollo.hash;
import com.davidbracewell.apollo.linear.NDArray;
import com.davidbracewell.guava.common.collect.HashMultimap;
import com.davidbracewell.tuple.Tuple2;
import java.io.Serializable;
import java.util.Set;
import static com.davidbracewell.tuple.Tuples.$;
/**
* @author David B. Bracewell
*/
public class InMemoryLSHStorage implements LSHStorage, Serializable {
private static final long serialVersionUID = 1L;
private final HashMultimap, NDArray> store = HashMultimap.create();
@Override
public void add(NDArray vector, int band, int bucket) {
store.put($(band, bucket), vector);
}
@Override
public void clear() {
store.clear();
}
@Override
public Set get(int band, int bucket) {
return store.get($(band, bucket));
}
}// END OF InMemoryLSHStorage
© 2015 - 2025 Weber Informatics LLC | Privacy Policy