@Immutable public final class ImmutableSparseVector extends SparseVector implements Serializable
Use create(java.util.Map), SparseVector.empty(), immutable(), or
MutableSparseVector.freeze() to create immutable sparse vectors.
| Modifier and Type | Method and Description |
|---|---|
static ImmutableSparseVector |
create(Map<Long,Double> data)
Construct a new immutable sparse vector from a map.
|
<K> it.unimi.dsi.fastutil.longs.Long2ObjectMap<K> |
getChannel(TypedSymbol<K> channelSymbol)
Fetch the channel stored under a particular typed symbol.
|
Set<TypedSymbol<?>> |
getChannelSymbols()
Retrieve all symbols that map to typed side channels for this vector.
|
ImmutableSparseVector |
getChannelVector(Symbol channelSymbol)
Get the vector associated with a particular unboxed channel.
|
Set<Symbol> |
getChannelVectorSymbols()
Retrieve all symbols that map to side channels for this vector.
|
boolean |
hasChannel(TypedSymbol<?> channelSymbol)
Return whether this sparse vector has a channel stored under a
particular typed symbol.
|
boolean |
hasChannelVector(Symbol channelSymbol)
Return whether this sparse vector has a channel vector stored under a
particular symbol.
|
ImmutableSparseVector |
immutable()
Return an immutable snapshot of this sparse vector.
|
double |
mean()
Compute and return the mean of the vector's values.
|
MutableSparseVector |
mutableCopy()
Return a mutable copy of this sparse vector.
|
double |
norm()
Compute and return the L2 norm (Euclidian length) of the vector.
|
double |
sum()
Compute and return the L1 norm (sum) of the vector.
|
containsKey, countCommonKeys, dot, empty, equals, fast, fast, fastIterator, fastIterator, get, get, get, hashCode, isEmpty, isSet, iterator, keyDomain, keysByValue, keysByValue, keySet, size, toString, unsetKeySet, valuespublic static ImmutableSparseVector create(Map<Long,Double> data)
data - The data. It may not contain any null values.public ImmutableSparseVector immutable()
SparseVectorSparseVector.keySet() of this vector.immutable in class SparseVectorpublic MutableSparseVector mutableCopy()
SparseVectormutableCopy in class SparseVectorpublic boolean hasChannelVector(Symbol channelSymbol)
SparseVectorhasChannelVector in class SparseVectorchannelSymbol - the symbol under which the channel was
stored in the vector.public boolean hasChannel(TypedSymbol<?> channelSymbol)
SparseVectorhasChannel in class SparseVectorchannelSymbol - the typed symbol under which the channel was
stored in the vector.public ImmutableSparseVector getChannelVector(Symbol channelSymbol)
SparseVectorgetChannelVector in class SparseVectorchannelSymbol - the symbol under which the channel was/is
stored in the vector.null if
there is no such channel.public <K> it.unimi.dsi.fastutil.longs.Long2ObjectMap<K> getChannel(TypedSymbol<K> channelSymbol)
SparseVectorgetChannel in class SparseVectorchannelSymbol - the typed symbol under which the channel was/is
stored in the vector.null if there is no such channel.public Set<Symbol> getChannelVectorSymbols()
SparseVectorgetChannelVectorSymbols in class SparseVectorpublic Set<TypedSymbol<?>> getChannelSymbols()
SparseVectorgetChannelSymbols in class SparseVectorpublic double norm()
SparseVectornorm in class SparseVectorpublic double sum()
SparseVectorsum in class SparseVectorpublic double mean()
SparseVectormean in class SparseVectorCopyright © 2013 GroupLens Research. All Rights Reserved.