Reference
A sparse boolean array, i.e., set of indices.
Provides a memory efficient set interface, with optimized conversion between numpy arrays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys |
Iterable
|
optional iterable of keys |
required |
add(key)
method descriptor
Add an index key.
clear()
method descriptor
Remove all indices.
difference(*others)
method descriptor
Return the difference of sets as a new set.
discard(key)
method descriptor
Remove an index key, if present.
dot(*others)
method descriptor
Return the intersection count of sets.
fromdense(values)
classmethod
Return indices from a dense array representation.
intersection(*others)
method descriptor
Return the intersection of sets as a new set.
isdisjoint(other)
method descriptor
Return whether two indices have a null intersection.
todense(minlength=0, dtype=bool)
method descriptor
Return a dense array representation of indices.
union(*others)
method descriptor
Return the union of sets as a new set.
update(*others)
method descriptor
Update from indices, arrays, or iterables.
A sparse array of index keys mapped to numeric values.
Provides a memory efficient Counter interface, with optimized conversion between numpy arrays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys |
Iterable[int]
|
optional iterable of keys |
required |
values |
optional scalar or iterable of values |
required |
argmax(**kwargs)
method descriptor
Return key with maximum value.
argmin(**kwargs)
method descriptor
Return key with minimum value.
argpartition(kth, **kwargs)
method descriptor
Return keys partitioned by values.
argsort(**kwargs)
method descriptor
Return keys sorted by values.
clear()
method descriptor
Remove all items.
difference(*others)
method descriptor
Provisional set difference; return vector without keys.
equal(other)
method descriptor
Return whether vectors are equal as scalar bool; == is element-wise.
filter(ufunc, *args, **kwargs)
method descriptor
Return element-wise array of keys from applying predicate across vectors.
fromdense(values)
classmethod
Return vector from a dense array representation.
items()
method descriptor
Return zipped keys and values.
keys()
method descriptor
Return keys as numpy array.
map(ufunc, *args, **kwargs)
method descriptor
Return element-wise array of values from applying function across vectors.
max(initial=None, **kwargs)
method descriptor
Return maximum value.
maximum(value)
method descriptor
Return element-wise maximum vector.
min(initial=None, **kwargs)
method descriptor
Return minimum value.
minimum(value)
method descriptor
Return element-wise minimum vector.
sum(initial=0.0, dtype=float, **kwargs)
method descriptor
Return sum of values.
todense(minlength=0, dtype=float)
method descriptor
Return a dense array representation of vector.
update(keys, values=1.0)
method descriptor
Update from vector, arrays, mapping, or keys with scalar.
values(dtype=float)
method descriptor
Return values as numpy array.
Bases: defaultdict
A sparse vector of vectors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Iterable
|
|
()
|
Source code in spector/matrix.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
col: np.ndarray
property
COO format column index array of the matrix
data: np.ndarray
property
COO format data array of the matrix
row: np.ndarray
property
COO format row index array of the matrix
filter(func, *args, **kwargs)
Return matrix with function applies across vectors.
Source code in spector/matrix.py
114 115 116 |
|
fromcoo(row, col, data)
classmethod
Return matrix from COOrdinate format arrays.
Source code in spector/matrix.py
118 119 120 121 |
|
map(func, *args, **kwargs)
Return matrix with function applies across vectors.
Source code in spector/matrix.py
107 108 109 110 111 112 |
|
sum(axis=None)
Return sum of matrix elements across axis, by default both.
Source code in spector/matrix.py
97 98 99 100 101 102 103 104 105 |
|
transpose()
Return matrix with reversed dimensions.
Source code in spector/matrix.py
123 124 125 |
|
update(data)
Update from mapping or iterable.
Source code in spector/matrix.py
62 63 64 65 66 67 68 69 |
|
Generate unique keys with associated groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys |
Iterable
|
|
required |
*arrays |
Iterable
|
|
()
|
Source code in spector/matrix.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|