@Deprecated @Immutable public final class ImmutableSparseVector extends SparseVector implements Serializable
Immutable sparse vectors. These vectors cannot be changed, even by other code, and are therefore safe to store and are thread-safe.
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)
Deprecated.
Combine this vector with another vector by taking the union of the key domains of two vectors.
|
static ImmutableSparseVector |
create(Map<Long,Double> data)
Deprecated.
Construct a new immutable sparse vector from a map.
|
<K> Long2ObjectMap<K> |
getChannel(TypedSymbol<K> channelSymbol)
Deprecated.
Fetch the channel stored under a particular typed symbol.
|
Set<TypedSymbol<?>> |
getChannelSymbols()
Deprecated.
Retrieve all symbols that map to typed side channels for this vector.
|
ImmutableSparseVector |
getChannelVector(Symbol channelSymbol)
Deprecated.
Get the vector associated with a particular unboxed channel.
|
Set<Symbol> |
getChannelVectorSymbols()
Deprecated.
Retrieve all symbols that map to side channels for this vector.
|
boolean |
hasChannel(TypedSymbol<?> channelSymbol)
Deprecated.
Return whether this sparse vector has a channel stored under a particular typed symbol.
|
boolean |
hasChannelVector(Symbol channelSymbol)
Deprecated.
Return whether this sparse vector has a channel vector stored under a particular symbol.
|
ImmutableSparseVector |
immutable()
Deprecated.
Return an immutable snapshot of this sparse vector.
|
double |
mean()
Deprecated.
Compute and return the mean of the vector’s values.
|
MutableSparseVector |
mutableCopy()
Deprecated.
Return a mutable copy of this sparse vector.
|
double |
norm()
Deprecated.
Compute and return the L2 norm (Euclidian length) of the vector.
|
double |
sum()
Deprecated.
Compute and return the L1 norm (sum) of the vector.
|
asMap, containsKey, countCommonKeys, dot, empty, equals, fast, fast, fastIntersect, 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)
Construct a new immutable sparse vector from a map.
data
- The data. It may not contain any null
values.public ImmutableSparseVector immutable()
SparseVector
Return an immutable snapshot of this sparse vector. The new vector’s key domain may be shrunk to remove storage of unused keys; no keys in the key set will be removed.
immutable
in class SparseVector
public MutableSparseVector mutableCopy()
SparseVector
Return a mutable copy of this sparse vector. The key domain of the mutable vector will be the same as this vector’s key domain.
mutableCopy
in class SparseVector
public boolean hasChannelVector(Symbol channelSymbol)
SparseVector
Return whether this sparse vector has a channel vector stored under a particular symbol.
hasChannelVector
in class SparseVector
channelSymbol
- the symbol under which the channel was stored in the vector.public boolean hasChannel(TypedSymbol<?> channelSymbol)
SparseVector
Return whether this sparse vector has a channel stored under a particular typed symbol.
hasChannel
in class SparseVector
channelSymbol
- the typed symbol under which the channel was stored in the vector.public ImmutableSparseVector getChannelVector(Symbol channelSymbol)
SparseVector
Get the vector associated with a particular unboxed channel.
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
Fetch the channel stored under a particular typed symbol.
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
Retrieve all symbols that map to side channels for this vector.
getChannelVectorSymbols
in class SparseVector
public Set<TypedSymbol<?>> getChannelSymbols()
SparseVector
Retrieve all symbols that map to typed side channels for this vector.
getChannelSymbols
in class SparseVector
public ImmutableSparseVector combineWith(SparseVector o)
SparseVector
Combine this vector with another vector by taking the union of the key domains of two vectors. If both vectors have values the same key, the values in o
override those from the current vector.
combineWith
in class SparseVector
o
- The other vectorpublic double norm()
SparseVector
Compute and return the L2 norm (Euclidian length) of the vector.
norm
in class SparseVector
public double sum()
SparseVector
Compute and return the L1 norm (sum) of the vector.
sum
in class SparseVector
public double mean()
SparseVector
Compute and return the mean of the vector’s values.
mean
in class SparseVector