def vec_to_dict(vector, var_offsets, var_sizes):
 val_dict = {}
 for (id_, offset) in var_offsets.items():
  size = var_sizes[id_]
  value = np.zeros(size)
  offset = var_offsets[id_]
  for col in range(size[1]):
   value[:, col] = vector[offset:(size[0] + offset)]
   offset += size[0]
  val_dict[id_] = value
 return val_dict

def vec_to_dict ( vector , var_offsets , var_sizes ) : val_dict = { } for ( id_ , offset ) in var_offsets . items ( ) : size = var_sizes [ id_ ] value = np . zeros ( size ) offset = var_offsets [ id_ ] for col in range ( size [ 1 ] ) : value [ : , col ] = vector [ offset : ( size [ 0 ] + offset ) ] offset += size [ 0 ] val_dict [ id_ ] = value return val_dict
converts a vector to a map of variable id to value .