%
% convering a PCC
%     A : face vectors (column vectors)
%     U : span vectors (column vectors)
%     E : null-space bases
%     V : proper cone span vectors
%
function [ U, E, V ] = PCC_convert( A )
    A = PCC_simplify(A);
    n = size(A,1); % dimension
    [ Ab, Au ] = PCC_bidirectional_constraints(A);

    if ( size(Ab,2) == 0) % no bidirectional constraints: full-dimensional PCC
        [ U, E, V ] = PCC_convert_full(A,n);
    else
        if size(Au,2) > 0 % bidirectional constraints + unidirectional constraints
            [ U, E, V ] = PCC_convert_less(Ab,Au,n);
        else % bidirectional constraints alone (no unidirectional constraints) --> linear space
            [E,B] = null_and_complement_null(Ab');
            if size(E,2) > 0 % null-space has non-zero basis
                U = [ E, -sum(E,2) ];
                V = [];
            else % null space == {0}
                U = zeros(n,0);
                V = [];
            end
        end
    end
end
