@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 |
|---|---|
ImmutableSparseVector |
combineWith(SparseVector o)
Combine this vector with another vector by taking the union of the key domains of two vectors.
|
static ImmutableSparseVector |
create(Map<Long,Double> data)
Construct a new immutable sparse vector from a map.
|
<K> 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, iterator, keyDomain, keysByValue, keysByValue, keySet, size, sumAbs, toString, unsetKeySet, values, viewclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static ImmutableSparseVector create(Map<Long,Double> data)
data - The data. It may not contain any null values.public ImmutableSparseVector immutable()
SparseVectorimmutable 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> 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 ImmutableSparseVector combineWith(SparseVector o)
SparseVectoro override those from the
current vector.combineWith in class SparseVectoro - The other vectorpublic double norm()
SparseVectornorm in class SparseVectorpublic double sum()
SparseVectorsum in class SparseVectorpublic double mean()
SparseVectormean in class SparseVector