def constr_mul(constraints, var_dict, vec_size, is_abs):
 product = np.zeros(vec_size)
 offset = 0
 for constr in constraints:
  result = mul(constr.expr, var_dict, is_abs)
  (rows, cols) = constr.size
  for col in range(cols):
   if np.isscalar(result):
    product[offset:(offset + rows)] = result
   else:
    product[offset:(offset + rows)] = np.squeeze(result[:, col])
   offset += rows
 return product

def constr_mul ( constraints , var_dict , vec_size , is_abs ) : product = np . zeros ( vec_size ) offset = 0 for constr in constraints : result = mul ( constr . expr , var_dict , is_abs ) ( rows , cols ) = constr . size for col in range ( cols ) : if np . isscalar ( result ) : product [ offset : ( offset + rows ) ] = result else : product [ offset : ( offset + rows ) ] = np . squeeze ( result [ : , col ] ) offset += rows return product
multiplies a vector by the matrix implied by the constraints .