Package rdkit :: Package DataStructs :: Module SparseIntVect :: Class pySparseIntVect
[hide private]
[frames] | no frames]

Class pySparseIntVect

source code

object --+
         |
        pySparseIntVect

this class is pretty much obsolete (it's in C++ now) 

Instance Methods [hide private]
 
__init__(self, size)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
UpdateFromSequence(self, seq)
>>> c1=pySparseIntVect(10)...
source code
 
InitFromSequence(self, seq)
>>> c1=pySparseIntVect(10)...
source code
 
Sum(self, useAbs=False)
>>> c1=pySparseIntVect(10) >>> c1[0] = 3 >>> c1[2] = 2 >>> c1[4] = 5 >>> c1.Sum() 10
source code
 
GetTotalVal(self, useAbs=False) source code
 
__eq__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__iand__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__ior__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__iadd__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__isub__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__imul__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__add__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__sub__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__mul__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__and__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__or__(self, other)
>>> c1=pySparseIntVect(10)...
source code
 
__len__(self) source code
 
__getitem__(self, which)
>>> c1=pySparseIntVect(10)...
source code
 
__setitem__(self, which, val) source code
 
__iter__(self)
>>> c=pySparseIntVect(10) >>> c[0] = 3 >>> c[4] = 5 >>> c[7] = -1 >>> for idx,v in c: ...
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  size = 0
  container = {}
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, size)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

UpdateFromSequence(self, seq)

source code 

>>> c1=pySparseIntVect(10)
>>> c1.UpdateFromSequence((0,1,1,5))
>>> [x for x in c1]
[(0, 1), (1, 2), (5, 1)]
>>> c1.UpdateFromSequence((0,3))
>>> [x for x in c1]
[(0, 2), (1, 2), (3, 1), (5, 1)]

InitFromSequence(self, seq)

source code 

>>> c1=pySparseIntVect(10)
>>> c1.InitFromSequence((0,1,1,5))
>>> [x for x in c1]
[(0, 1), (1, 2), (5, 1)]

Sum(self, useAbs=False)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[2] = 2
>>> c1[4] = 5
>>> c1.Sum()
10

>>> c1[2] = -2
>>> c1.Sum()
6
>>> c1.Sum(useAbs=True)
10

__eq__(self, other)
(Equality operator)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[2] = 2
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 3
>>> c2[2] = 2
>>> c1 == c2
False
>>> c1 == c1
True

__iand__(self, other)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[2] = 2
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[2] = -2
>>> c2[5] = 6
>>> c1 &= c2
>>> [x for x in c1]
[(0, 2), (2, -2)]

__ior__(self, other)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[2] = 2
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[2] = -2
>>> c2[5] = 6
>>> c1 |= c2
>>> [x for x in c1]
[(0, 3), (2, 2), (4, 5), (5, 6)]

__iadd__(self, other)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[2] = 2
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[2] = -2
>>> c2[5] = 6
>>> c1 += c2
>>> [x for x in c1]
[(0, 5), (4, 5), (5, 6)]

__isub__(self, other)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[2] = 2
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[2] = 2
>>> c2[5] = 6
>>> c1 -= c2
>>> [x for x in c1]
[(0, 1), (4, 5), (5, -6)]

__imul__(self, other)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[5] = 6
>>> c1 *= c2
>>> [x for x in c1]
[(0, 6)]

__add__(self, other)
(Addition operator)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[5] = 6
>>> c3 = c2+c1
>>> [x for x in c3]
[(0, 5), (4, 5), (5, 6)]

__sub__(self, other)
(Subtraction operator)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[2] = 2
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[2] = 2
>>> c2[5] = 6
>>> c3 = c1-c2
>>> [x for x in c3]
[(0, 1), (4, 5), (5, -6)]
>>> [x for x in c1]
[(0, 3), (2, 2), (4, 5)]

__mul__(self, other)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[5] = 6
>>> c3 = c1*c2
>>> [x for x in c3]
[(0, 6)]
>>> [x for x in c1]
[(0, 3), (4, 5)]

__and__(self, other)
(And operator)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[2] = 2
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[2] = -2
>>> c2[5] = 6
>>> c3 = c1 & c2
>>> [x for x in c3]
[(0, 2), (2, -2)]
>>> [x for x in c1]
[(0, 3), (2, 2), (4, 5)]

__or__(self, other)
(Or operator)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[2] = 2
>>> c1[4] = 5
>>> c2=pySparseIntVect(10)
>>> c2[0] = 2
>>> c2[2] = -2
>>> c2[5] = 6
>>> c3 = c1 | c2
>>> [x for x in c3]
[(0, 3), (2, 2), (4, 5), (5, 6)]
>>> [x for x in c1]
[(0, 3), (2, 2), (4, 5)]

__getitem__(self, which)
(Indexing operator)

source code 

>>> c1=pySparseIntVect(10)
>>> c1[0] = 3
>>> c1[4] = 5
>>> c1[0]
3
>>> c1[1]
0

__iter__(self)

source code 

>>> c=pySparseIntVect(10)
>>> c[0] = 3
>>> c[4] = 5
>>> c[7] = -1
>>> for idx,v in c:
...  print idx,v
0 3
4 5
7 -1