def format_system(A, Y):
    """Extract data from A/Y matrices."""
    assert Y.ndim > 0
    m, n = A.shape
    matrix_in = Y.ndim > 1
    d = Y.shape[1] if matrix_in else 1
    Y = Y if matrix_in else Y[:, (None)]
    return Y, m, n, d, matrix_in
