def vector_mx_mult(v, m):
    """
    Pre-multiply matrix m by vector v
    """
    rows = len(m)
    if len(v) != rows:
        raise ValueError('vectormatmult mismatched rows')
    columns = len(m[0])
    result = []
    for c in range(0, columns):
        result.append(sum(v[r]*m[r][c] for r in range(rows)))
    return result