public void setItemVector(String item, float[] vector) { Preconditions.checkNotNull(vector); Preconditions.checkArgument(vector.length == features); Lock lock = yLock.writeLock(); lock.lock(); try { Y.put(item, vector); } finally { lock.unlock(); } }
public void setUserVector(String user, float[] vector) { Preconditions.checkNotNull(vector); Preconditions.checkArgument(vector.length == features); Lock lock = xLock.writeLock(); lock.lock(); try { X.put(user, vector); } finally { lock.unlock(); } }