Package gmisclib :: Module dict_vector :: Class dict_vector
[frames] | no frames]

Class dict_vector

source code


Instance Methods
a shallow copy of D
copy(self) source code
 
incr(self, k, v)
Increment slot k by v.
source code
 
__add__(self, other) source code
 
__gt__(self, other)
x>y
source code
 
__lt__(self, other)
x<y
source code
 
__ge__(self, other)
x>=y
source code
 
__le__(self, other)
x<=y
source code
 
__mul__(self, other) source code
 
__div__(self, other) source code
 
__iadd__(self, other) source code
 
__isub__(self, other) source code
 
__sub__(self, other) source code
 
__radd__(self, other) source code
 
__rmul__(self, other) source code
 
__rsub__(self, other) source code
 
__abs__(self) source code
 
__invert__(self) source code
 
sum(self)
Sum all the items in a vector.
source code
 
median(self)
Take the median value of a vector.
source code
bool
all(self)
Returns: true if all values are true.
source code
 
float(self)
Returns: a dict_vector with float values.
source code
 
int(self)
Returns: a dict_vector with int values.
source code
 
iint(self)
Convert to integer, in place.
source code
 
ifloat(self)
Convert to float, in place.
source code
dict_vector of int.
sign(self)
Returns: a dict_vector which is -1, 0, or 1, showing the sign of each value.
source code
dict_vector of ints.
round(self)
Round to the nearest int.
source code
 
iround(self)
Round to the nearest int, in place.
source code
 
idropzero(self)
Drop all zeros, in place.
source code
 
dropzero(self)
Returns: a dict_vector without any zeros.
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __getattribute__, __getitem__, __init__, __iter__, __len__, __ne__, __new__, __repr__, __setitem__, __sizeof__, clear, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Variables
  SCALARS = (<type 'int'>, <type 'float'>)
  ZERO = 0

Inherited from dict: __hash__

Properties

Inherited from object: __class__

Method Details

copy(self)

source code 
Returns: a shallow copy of D
Overrides: dict.copy
(inherited documentation)

__gt__(self, other)
(Greater-than operator)

source code 

x>y

Overrides: dict.__gt__
(inherited documentation)

__lt__(self, other)
(Less-than operator)

source code 

x<y

Overrides: dict.__lt__
(inherited documentation)

__ge__(self, other)
(Greater-than-or-equals operator)

source code 

x>=y

Overrides: dict.__ge__
(inherited documentation)

__le__(self, other)
(Less-than-or-equals operator)

source code 

x<=y

Overrides: dict.__le__
(inherited documentation)

all(self)

source code 
Returns: bool
true if all values are true.

float(self)

source code 
Returns:
a dict_vector with float values.

int(self)

source code 
Returns:
a dict_vector with int values.

sign(self)

source code 
Returns: dict_vector of int.
a dict_vector which is -1, 0, or 1, showing the sign of each value.

round(self)

source code 

Round to the nearest int.

Returns: dict_vector of ints.
rounded dict vector.

dropzero(self)

source code 
Returns:
a dict_vector without any zeros.