Sparse Tensor
Back to glossary
- vals (numpy.ndarray) A 1-dimensional array of non-zero values of the sparse tensor.
- subs (numpy.ndarray) A 2-dimensional array of coordinates of the values in vals.
- shape(tuple)
- func(binary operator) This function is used to construct the sparse tensor as an accumulator.
- __init__(self, subs, vals, shape = None, func=sum.__call__) Consturctor for the sptensor class. subs and vals (numpy.ndarray) or (list) are coordinates and values of the sptensor.
- tondarray(self) This function returns a numpy. ndarray object that has the same values with the sptensor.
- permute(self, order) By applying this function it will return the sptensor object that is permuted by the given order (list).
- ipermute(self, order) Returns the sptensor object that is permuted by the inverse of the given order (list).
- copy(self) Returns the copied sptensor object of the sptensor.
- totensor(self) Returns the tensor object that has the same values with the sptensor.
- nnz(self) Returns the number of non-zero elements in the sptensor.
- ndims(self) Returns the number of dimensions of the tensor.
- dimsize(self, ind) Returns the size of the specified dimension. Same as shape[ind].
Additional Resources
Back to glossary