def weld_vec_of_struct_to_struct_of_vec(vec_of_structs, weld_types):
    """Create a struct of vectors.

    Parameters
    ----------
    vec_of_structs : WeldObject
        Encoding a vector of structs.
    weld_types : list of WeldType
        The Weld types of the arrays in the same order.

    Returns
    -------
    WeldObject
        Representation of this computation.

    """
    obj_id, weld_obj = create_weld_object(vec_of_structs)

    appenders = struct_of('appender[{e}]', weld_types)
    types = struct_of('{e}', weld_types)
    merges = struct_of('merge(b.${i}, e.${i})', weld_types)
    result = struct_of('result(vecs.${i})', weld_types)

    weld_template = """let vecs = for({vec_of_struct},
    {appenders},
    |b: {appenders}, i: i64, e: {types}|
        {merges}
);
{result}
"""

    weld_obj.weld_code = weld_template.format(vec_of_struct=obj_id,
                                              appenders=appenders,
                                              types=types,
                                              merges=merges,
                                              result=result)

    return weld_obj
def weld_vec_of_struct_to_struct_of_vec ( vec_of_structs , weld_types ) : obj_id , weld_obj = create_weld_object ( vec_of_structs ) appenders = struct_of ( 'appender[{e}]' , weld_types ) types = struct_of ( '{e}' , weld_types ) merges = struct_of ( 'merge(b.${i}, e.${i})' , weld_types ) result = struct_of ( 'result(vecs.${i})' , weld_types ) weld_template = """let vecs = for({vec_of_struct},
    {appenders},
    |b: {appenders}, i: i64, e: {types}|
        {merges}
);
{result}
""" weld_obj . weld_code = weld_template . format ( vec_of_struct = obj_id , appenders = appenders , types = types , merges = merges , result = result ) return weld_obj
Create a struct of vectors.

    Parameters
    ----------
    vec_of_structs : WeldObject
        Encoding a vector of structs.
    weld_types : list of WeldType
        The Weld types of the arrays in the same order.

    Returns
    -------
    WeldObject
        Representation of this computation.