%
% find bidirectional constraints among face vectors
%     A : face vectors (column vectors)
%     Ab : bidirectional constraints
%     Au : unidirectional constraints
%
function [ Ab, Au ] = PCC_bidirectional_constraints (A)
    options = optimoptions('linprog');
    options.Display = 'none';
    
    n = size(A,1); % dimension
    m = size(A,2); % number of face vectors
    Aeq = A;
    beq = zeros(n,1);
    lower = zeros(m,1);
    upper = ones(m,1);
    f = -ones(m,1);
    c = linprog(f,[],[],Aeq,beq,lower,upper,options);
    Ab = A(:,find(c>eps));
    Au = A(:,find(c<=eps));
end
