


project a decomposition Syntax: dec = projectDec(decProper, mappingNewToProper) The input decomposition is projected according to the linear subspace, defined by mappingNewToProper that represents base vectors of the subspace in its columns. A proper and complete input representation is projected to obtain a (usually) improper representation. An incomplete representation is projected, no matter if proper or improper, because only a small subset of decomposition data is generated. A complete but inproper representation cannot be projected. The mapping cannot be generated. You should generate a proper embedding representation. Measures are NOT converted by this function, please use addMeasureDec to add the required measures again. See also: obtainDec


0001 function dec = projectDec(decOriginal, mappingNewToProper, varargin) 0002 % project a decomposition 0003 % 0004 % Syntax: dec = projectDec(decProper, mappingNewToProper) 0005 % 0006 % The input decomposition is projected according to the linear subspace, 0007 % defined by mappingNewToProper that represents base vectors of the 0008 % subspace in its columns. 0009 % A proper and complete input representation is projected to obtain a 0010 % (usually) improper representation. 0011 % An incomplete representation is projected, no matter if proper or 0012 % improper, because only a small subset of decomposition data is 0013 % generated. 0014 % A complete but inproper representation cannot be projected. The mapping 0015 % cannot be generated. You should generate a proper embedding 0016 % representation. 0017 % 0018 % Measures are NOT converted by this function, please use addMeasureDec to 0019 % add the required measures again. 0020 % 0021 % See also: obtainDec 0022 0023 % The elk-library: convex geometry applied to crystallization modeling. 0024 % Copyright (C) 2013 Alexander Reinhold 0025 % 0026 % This program is free software: you can redistribute it and/or modify it 0027 % under the terms of the GNU General Public License as published by the 0028 % Free Software Foundation, either version 3 of the License, or (at your 0029 % option) any later version. 0030 % 0031 % This program is distributed in the hope that it will be useful, but 0032 % WITHOUT ANY WARRANTY; without even the implied warranty of 0033 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0034 % General Public License for more details. 0035 % 0036 % You should have received a copy of the GNU General Public License along 0037 % with this program. If not, see <http://www.gnu.org/licenses/>. 0038 0039 %% input handling 0040 % parameters 0041 par = mapOptionStruct(varargin, ... 0042 'zerotol', elkZerotol, ... 0043 'verbose', 1); 0044 % improper representations cannot be projected 0045 if ~decOriginal.isProper && decOriginal.isComplete 0046 error('elk:decomposition:wrongInput', ['Projection from improper ' ... 0047 'decompositions is not supported.']); 0048 end 0049 % there should at least be a warning for incomplete representations 0050 if ~decOriginal.isComplete 0051 warning('elk:decomposition:incompleteRepresentation', ['An incomplete ' ... 0052 'representation is projected. Only a few properties will be ' ... 0053 'available.']); 0054 end 0055 0056 %% initial data 0057 % this is the part about facet normals, mapping and storing the original 0058 % proper representation, including the mapping to the improper 0059 % representation. 0060 dec.A = decOriginal.A; 0061 dec.nDim = decOriginal.nDim; 0062 dec.nH = decOriginal.nH; 0063 dec.mappingReducedToFull = decOriginal.mappingReducedToFull * mappingNewToProper; 0064 dec.mappingFullToReduced = pinv(dec.mappingReducedToFull); 0065 dec.constraintMatrix = eye(dec.nH) - dec.mappingReducedToFull * ... 0066 dec.mappingFullToReduced; 0067 dec.nC = size(mappingNewToProper, 2); 0068 dec.properData = decOriginal; 0069 dec.properData.mappingNewToProper = mappingNewToProper; 0070 dec.properData.mappingProperToNew = pinv(mappingNewToProper); 0071 dec.properData.projectionMatrix = mappingNewToProper*inv(mappingNewToProper'*mappingNewToProper)*... 0072 mappingNewToProper'; 0073 0074 %% fallback to complete/incomplete handling 0075 % this part handles the confinement/validity cones including facet validity 0076 % data and decomposition 0077 if decOriginal.isComplete 0078 dec = projectCompleteDec(dec, par); 0079 else 0080 dec = projectIncompleteDec(dec, par); 0081 end 0082 0083 %% cleanup of structure 0084 dec = cleanupDecStructure(dec);