function upVector = computeUpVector(pbeDef, hcMatrix, zerotol)
%
%
% THIS IS NO USER FUNCTION

% The elk-library: convex geometry applied to crystallization modeling.
%   Copyright (C) 2012 Alexander Reinhold
%
% This program is free software: you can redistribute it and/or modify it 
%   under the terms of the GNU General Public License as published by the 
%   Free Software Foundation, either version 3 of the License, or (at your 
%   option) any later version.
%
% This program is distributed in the hope that it will be useful, but 
%   WITHOUT ANY WARRANTY; without even the implied warranty of 
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
%   General Public License for more details.
%
% You should have received a copy of the GNU General Public License along 
%   with this program.  If not, see <http://www.gnu.org/licenses/>.
if pbeDef.dec.isProper
    upVector = computePartitionIndexDec(pbeDef.dec, hcMatrix, zerotol, 1);
elseif pbeDef.dec.isComplete && ~pbeDef.dec.isProper
    if pbeDef.optionStruct.useEmbeddingPartitions
        hcMatrix = mapToValidityCone(...
            pbeDef.dec.properData.mappingNewToProper*hcMatrix, ...
            pbeDef.dec.properData, zerotol);
        upVector = computePartitionIndexDec(pbeDef.dec.properData, ...
            hcMatrix, zerotol, 1);
    else
        upVector = computePartitionIndexDec(pbeDef.dec, hcMatrix, zerotol, 1);
    end
elseif ~pbeDef.dec.isComplete
    upVector(1, end + (1:nNew)) = 1;
else
    error('elk:pbeSolver:inputError', ['The given representation is neither ' ...
        'proper, nor improper but complete, nor incomplete. This does not ' ...
        'makes sense. Please check your decomposition, dude.']);
end