sparsegrad.impl.sparsevec package¶
Submodules¶
sparsegrad.impl.sparsevec.sparsevec module¶
This module contains implementation details of summing sparse vectors.
-
sparsegrad.impl.sparsevec.sparsevec.
sparsesum
(terms, hstack=<function hstack>, nvalue=<function <lambda>>, wrap=<function <lambda>>, check_unique=False, return_sparse=False)¶ Sum sparse vectors
This is a general function, which propagates index information and numerical values. Suitable functions must be supplied as arguments to propagate other information.
- terms : list of sparsevec
- terms
- hstack : callable(vectors)
- function to use for concatenating vectors
- nvalue : callable(vector)
- function to use for extracting numerical value
- wrap : callable(idx, v, result)
- function to use for wrapping the result, with idx, v being concatenated inputs
- check_unique : bool
- whether to perform test for double assignments (useful when this function is used to replace item assignment)
- return_sparse : bool
- whether to calculate sparse results
-
class
sparsegrad.impl.sparsevec.sparsevec.
sparsevec
(n, idx, v)¶ Bases:
object
Sparse vector of length n, with nonzero entries in arrays (idx,v) where idx contains the indices of entries, and v contains the corresponding values