public static class ALS.LocalIndexEncoder
extends Object
implements scala.Serializable
We use the leading bits (including the sign bit) to store the block id and the rest to store the local index. This is based on the assumption that users/items are approximately evenly partitioned. With this assumption, we should be able to encode two billion distinct values.
Constructor and Description |
---|
ALS.LocalIndexEncoder(int numBlocks) |
Modifier and Type | Method and Description |
---|---|
int |
blockId(int encoded)
Gets the block id from an encoded index.
|
int |
encode(int blockId,
int localIndex)
Encodes a (blockId, localIndex) into a single integer.
|
int |
localIndex(int encoded)
Gets the local index from an encoded index.
|