def _remove_redundant_rows(A_eq):
    n_rows_A = A_eq.shape[0]
    redundancy_warning = 'A_eq does not appear to be of full row rank. To improve performance, check the problem formulation for redundant equality constraints.'
    small_nullspace = 5
    if (A_eq.size > 0):
        try:
            rank = np.linalg.matrix_rank(A_eq)
        except Exception:
            rank = 0
    if ((A_eq.size > 0) and (rank < A_eq.shape[0])):
        warn(redundancy_warning, OptimizeWarning, stacklevel=3)
        dim_row_nullspace = (A_eq.shape[0] - rank)
        if (dim_row_nullspace <= small_nullspace):
            (d_removed, status, message) = _remove_redundancy(A_eq)
        if (dim_row_nullspace > small_nullspace):
            (d_removed, status, message) = _remove_redundancy_dense(A_eq)
        if (A_eq.shape[0] < rank):
            message = 'Due to numerical issues, redundant equality constraints could not be removed automatically. Try providing your constraint matrices as sparse matrices to activate sparse presolve, try turning off redundancy removal, or try turning off presolve altogether.'
            status = 4
        if (status != 0):
            complete = True
    return d_removed
def _remove_redundant_rows(A_eq):
    n_rows_A = A_eq.shape[0]
    redundancy_warning = 'A_eq does not appear to be of full row rank. To improve performance, check the problem formulation for redundant equality constraints.'
    small_nullspace = 5
    if (A_eq.size > 0):
        try:
            rank = np.linalg.matrix_rank(A_eq)
        except Exception:
            rank = 0
    if ((A_eq.size > 0) and (rank < A_eq.shape[0])):
        warn(redundancy_warning, OptimizeWarning, stacklevel=3)
        dim_row_nullspace = (A_eq.shape[0] - rank)
        if (dim_row_nullspace <= small_nullspace):
            (d_removed, status, message) = _remove_redundancy(A_eq)
        if (dim_row_nullspace > small_nullspace):
            (d_removed, status, message) = _remove_redundancy_dense(A_eq)
        if (A_eq.shape[0] < rank):
            message = 'Due to numerical issues, redundant equality constraints could not be removed automatically. Try providing your constraint matrices as sparse matrices to activate sparse presolve, try turning off redundancy removal, or try turning off presolve altogether.'
            status = 4
        if (status != 0):
            complete = True
    return d_removed