import collections


def decompose_mat2cols(mat, params):
    """Decomposes the matrix for linear systems into vectors for parameters

    Some solvers, like that in GNU R, do not accept the rectangular matrix and
    vectors for linear systems, but rather, the coefficient vectors for each of
    the parameters are needed. This function will decompose the matrix into an
    ordered dictionary of vectors with the keys being the name of the
    parameters and values being the columns of the matrix, ie the coefficient
    vectors of the parameters.

    :param Array mat: The matrix for the linear system.
    :param params: The sequence of parameters for the linear system.
    :returns: An ordered dictionary for the coefficient vectors of the
        parameters.
    :rtype: OrderedDict
    """

    vecs = collections.OrderedDict()

    # Loop over the columns of the matrix along with the parameters.
    for col, param in zip(mat.T, params):
        vecs[param.symb.name] = col
        continue

    # Return the result.
    return vecs