Class AtomVector
object --+
|
AtomVector
A dictionary-like object for representing sparse vectors.
Initialization:
>>> a = AtomVector(vec = None, name="")
>>> a = AtomVector.fromstring("1:10.0 2:25.0 7:13.0")
>>> a = b.copy()
>>> a.clear()
Iterating (behaves like a defaultdict(float)):
>>> a.iterkeys()
>>> a.iteritems()
>>> for atom in a:
... print atom
Printing (using an AtomFactory):
>>> a.tostring(af)
Operators:
>>> a + b
>>> a * b
>>> a / c
Length-related:
>>> a.Normalize()
>>> a.Normalized()
>>> a.CosineLeng()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__contains__(x,
y)
y in x |
|
|
|
|
__delitem__(x,
y)
del x[y] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
|
|
|
|
|
|
|
|
|
|
|
|
a new object with type S, a subtype of T
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__setitem__(x,
i,
y)
x[i]=y |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tostring(...)
Return a pretty-formatted string. |
|
|
|
Inherited from object:
__delattr__,
__format__,
__getattribute__,
__hash__,
__reduce_ex__,
__setattr__,
__sizeof__,
__str__,
__subclasshook__
|
|
|
name
|
|
Inherited from object:
__class__
|
__init__(...)
(Constructor)
|
|
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
- Overrides:
object.__init__
|
- Returns: a new object with type S, a subtype of T
- Overrides:
object.__new__
|
|
helper for pickle
- Overrides:
object.__reduce__
- (inherited documentation)
|
__repr__(x)
(Representation operator)
|
|
repr(x)
- Overrides:
object.__repr__
|
|
Return a pretty-formatted string.
- Parameters:
- Returns:
- A nicely formatted string, with "..." in case it's too
long.
|