mopsy package¶
Submodules¶
mopsy.adders module¶
mopsy.checkutils module¶
mopsy.helpers module¶
- mopsy.helpers.apply(func, mat, axis, group=None, non_zero=False)[source]¶
A generic apply function.
- Parameters:
- Returns:
A matrix containing the result of the function.
- mopsy.helpers.multi_apply(funcs, mat, axis, group=None, non_zero=False)[source]¶
A generic multi_apply to apply multiple function over the subset matrices.
- Parameters:
- Returns:
A list of matrices, in the same order as the functions containing the result of each the function.
mopsy.mops module¶
- class mopsy.mops.Mops(mat, non_zero=False)[source]¶
Bases:
object
Base class for all matrix operations.
- __init__(mat, non_zero=False)[source]¶
Intialize the matrix.
- Parameters:
mat – Input matrix.
non_zero (
bool
) – Whether to filter zero values. Defaults to False.
- apply(func, group=None, axis=0)[source]¶
Apply a function to groups along an axis.
- Parameters:
- Return type:
- Returns:
A tuple of matrix and its labels.
- groupby_indices(group)[source]¶
From a group vector, get the list of indices that map to each group.
mopsy.nops module¶
mopsy.sops module¶
- class mopsy.sops.Sops(mat, non_zero=False)[source]¶
Bases:
Mops
Sops, Sparse Matrix Operation Class.
- __annotations__ = {}¶
- apply(func, group=None, axis=0)[source]¶
Apply a function to groups along an axis.
- Parameters:
- Raises:
Exception – ApplyFuncError, when a function cannot be applied.
- Return type:
- Returns:
A tuple of matrix and its labels.
- multi_apply(funcs, group=None, axis=0)[source]¶
Apply multiple functions, the first axis of the ndarray specifies the results of the inputs functions in the same order.
- Parameters:
- Raises:
Exception – ApplyFuncError, when a function cannot be applied.
- Return type:
- Returns:
A tuple of matrix and its labels.