romspline/helpers.py
def partitions(n, K):
  """Split array with n samples into K (nearly) equal partitions
  
  Input
  -----
    n -- number of elements to partition into K subsets
    K -- number of partitions
  
  Output
  ------
  K arrays whose elements are contiguous intervals of an array of
  sequential integers with length n.
  """
  
  assert n >= K, "Number of partitions must not exceed number of samples."
  return np.asarray( np.array_split(np.arange(n), K) )
Split array with n samples into K (nearly) equal partitions
  
  Input
  -----
    n -- number of elements to partition into K subsets
    K -- number of partitions
  
  Output
  ------
  K arrays whose elements are contiguous intervals of an array of
  sequential integers with length n.
  
Split array with n samples into K (nearly) equal partitions
Input

- number of elements to partition into K subsets
K -- number of partitions

Output

K arrays whose elements are contiguous intervals of an array of
sequential integers with length n.
Split array with n samples into K ( nearly ) equal partitions Input - number of elements to partition into K subsets K -- number of partitions Output K arrays whose elements are contiguous intervals of an array of sequential integers with length n .
def partitions(n, K):
  assert n >= K, "Number of partitions must not exceed number of samples."
  return np.asarray( np.array_split(np.arange(n), K) )
def partitions ( n , K ) : assert n >= K , "Number of partitions must not exceed number of samples." return np . asarray ( np . array_split ( np . arange ( n ) , K ) )
Split array with n samples into K (nearly) equal partitions
Input
Split array with n samples into K ( nearly ) equal partitions Input
"""Split array with n samples into K (nearly) equal partitions
  
  Input
  -----
    n -- number of elements to partition into K subsets
    K -- number of partitions
  
  Output
  ------
  K arrays whose elements are contiguous intervals of an array of
  sequential integers with length n.
  """
n
K