@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, view
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static ImmutableSparseVector create(Map<Long,Double> data)
data
- The data. It may not contain any null
values.public ImmutableSparseVector immutable()
SparseVector
immutable
in class SparseVector
public MutableSparseVector mutableCopy()
SparseVector
mutableCopy
in class SparseVector
public boolean hasChannelVector(Symbol channelSymbol)
SparseVector
hasChannelVector
in class SparseVector
channelSymbol
- the symbol under which the channel was
stored in the vector.public boolean hasChannel(TypedSymbol<?> channelSymbol)
SparseVector
hasChannel
in class SparseVector
channelSymbol
- the typed symbol under which the channel was
stored in the vector.public ImmutableSparseVector getChannelVector(Symbol channelSymbol)
SparseVector
getChannelVector
in class SparseVector
channelSymbol
- 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)
SparseVector
getChannel
in class SparseVector
channelSymbol
- the typed symbol under which the channel was/is
stored in the vector.null
if there is no such channel.public Set<Symbol> getChannelVectorSymbols()
SparseVector
getChannelVectorSymbols
in class SparseVector
public Set<TypedSymbol<?>> getChannelSymbols()
SparseVector
getChannelSymbols
in class SparseVector
public ImmutableSparseVector combineWith(SparseVector o)
SparseVector
o
override those from the
current vector.combineWith
in class SparseVector
o
- The other vectorpublic double norm()
SparseVector
norm
in class SparseVector
public double sum()
SparseVector
sum
in class SparseVector
public double mean()
SparseVector
mean
in class SparseVector