def constr_unpack(constraints, vector):
 values = []
 offset = 0
 for constr in constraints:
  (rows, cols) = constr.size
  val = np.zeros((rows, cols))
  for col in range(cols):
   val[:, col] = vector[offset:(offset + rows)]
   offset += rows
  values.append(val)
 return values

def constr_unpack ( constraints , vector ) : values = [ ] offset = 0 for constr in constraints : ( rows , cols ) = constr . size val = np . zeros ( ( rows , cols ) ) for col in range ( cols ) : val [ : , col ] = vector [ offset : ( offset + rows ) ] offset += rows values . append ( val ) return values
unpacks a vector into a list of values for constraints .