<filename>cpstructures/arrayfunctions.py
from cpstructures.raggedshape import CU_RaggedView

import numpy as np
import cupy as cp

def get_ra_func(name):
   return lambda ragged_array, *args, **kwargs: getattr(ragged_array, name)(*args, **kwargs)
REDUCTIONS = {np.add: "sum",
              np.logical_and: "all",
              np.logical_or: "any",
              np.maximum: "max",
              np.minimum: "min",
              np.multiply: "prod"}

ACCUMULATIONS = {np.multiply: "cumprod",
                 np.add: "cumsum"}

HANDLED_FUNCTIONS = {getattr(np, name): get_ra_func(name) for name in 
                     list(REDUCTIONS.values()) + list(ACCUMULATIONS.values()) + ["nonzero", "mean", "std", "argmax", "argmin"]}

<filename>cpstructures/arrayfunctions.py
from cpstructures.raggedshape import CU_RaggedView

import numpy as np
import cupy as cp

def get_ra_func(name):
   return lambda ragged_array, *args, **kwargs: getattr(ragged_array, name)(*args, **kwargs)
REDUCTIONS = {np.add: "sum",
              np.logical_and: "all",
              np.logical_or: "any",
              np.maximum: "max",
              np.minimum: "min",
              np.multiply: "prod"}

ACCUMULATIONS = {np.multiply: "cumprod",
                 np.add: "cumsum"}

HANDLED_FUNCTIONS = {getattr(np, name): get_ra_func(name) for name in 
                     list(REDUCTIONS.values()) + list(ACCUMULATIONS.values()) + ["nonzero", "mean", "std", "argmax", "argmin"]}
