


reduce a H-representation to non-redundant support hyperplanes Syntax: hrep = reduceVrep(hrep) This function wraps a cddlib function that reduces a set of inequalities to a non-redundant set. Scaling of the input is important, because cddlib applies a fixed zero tolerance. This tolerance is stored in the function zerotolCddlib during initialization of this library (buildCddlib). See also: convertPolytope


0001 function hrep = reduceHrep(hrep, zerotol) 0002 % reduce a H-representation to non-redundant support hyperplanes 0003 % 0004 % Syntax: hrep = reduceVrep(hrep) 0005 % 0006 % This function wraps a cddlib function that reduces a set of inequalities 0007 % to a non-redundant set. 0008 % 0009 % Scaling of the input is important, because cddlib applies a fixed zero 0010 % tolerance. This tolerance is stored in the function zerotolCddlib 0011 % during initialization of this library (buildCddlib). 0012 % 0013 % See also: convertPolytope 0014 0015 % The elk-library: convex geometry applied to crystallization modeling. 0016 % Copyright (C) 2012 Alexander Reinhold 0017 % 0018 % This program is free software: you can redistribute it and/or modify it 0019 % under the terms of the GNU General Public License as published by the 0020 % Free Software Foundation, either version 3 of the License, or (at your 0021 % option) any later version. 0022 % 0023 % This program is distributed in the hope that it will be useful, but 0024 % WITHOUT ANY WARRANTY; without even the implied warranty of 0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0026 % General Public License for more details. 0027 % 0028 % You should have received a copy of the GNU General Public License along 0029 % with this program. If not, see <http://www.gnu.org/licenses/>. 0030 0031 if isempty(hrep.A) 0032 return 0033 end 0034 0035 %! Todo: Zerotol added for empty-polytope handling which must be considered 0036 % in corresponding calls. 0037 if ~exist('zerotol', 'var') || isempty(zerotol) 0038 zerotol = elkZerotol; 0039 end 0040 0041 %% handle empty polytopes 0042 % these are unfortunately not handled properly by cddlib 0043 [hrepScaled, scale] = scaleHrep(hrep, zerotol); 0044 if scale == -inf 0045 hrep = []; 0046 return; 0047 end 0048 0049 hrep = callCddLib('reduce_h', struct('A', hrep.A, 'B', hrep.h)); 0050 0051 hrep = struct('A', hrep.A, 'h', hrep.B);