obtainProjectionDataForVector

PURPOSE ^

extract projection matrices and validity regions

SYNOPSIS ^

function result = obtainProjectionDataForVector(dec, hE, zerotol)

DESCRIPTION ^

 extract projection matrices and validity regions

 THIS IS NO USER FUNCTION

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function result = obtainProjectionDataForVector(dec, hE, zerotol)
0002 % extract projection matrices and validity regions
0003 %
0004 % THIS IS NO USER FUNCTION
0005 
0006 % The elk-library: convex geometry applied to crystallization modeling.
0007 %   Copyright (C) 2013 Alexander Reinhold
0008 %
0009 % This program is free software: you can redistribute it and/or modify it
0010 %   under the terms of the GNU General Public License as published by the
0011 %   Free Software Foundation, either version 3 of the License, or (at your
0012 %   option) any later version.
0013 %
0014 % This program is distributed in the hope that it will be useful, but
0015 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0016 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017 %   General Public License for more details.
0018 %
0019 % You should have received a copy of the GNU General Public License along
0020 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 
0022 %% catch problems
0023 if ~dec.isProper
0024     error('elk:decomposition:numericalError', ['Developer uses wrong ' ...
0025         'function. This should not happen.']);
0026 end
0027 
0028 %% identify valid/invalid facet groups
0029 % violated constraints
0030 violatedIndexVector = find((dec.confinementMappingData.A * hE) > zerotol)';
0031 % violated facet groups
0032 invalidFacetGroupVector = dec.confinementMappingData.responsibleVector(...
0033     violatedIndexVector);
0034 
0035 %% initialize output
0036 result.constraintMatrix = zeros(0, length(hE));
0037 result.projectionMatrix = eye(length(hE));
0038 result.constraintList = cell([1, length(violatedIndexVector)]);
0039 result.projectionList = cell([1, length(violatedIndexVector)]);
0040 result.violatedConstraintIndexVector = violatedIndexVector;
0041 result.invalidFacetGroupVector = invalidFacetGroupVector;
0042 result.projectionIndexVector = 0*invalidFacetGroupVector;
0043 
0044 %% trivial case
0045 % everything is valid, no corrective projection would be found in the
0046 %   following
0047 if isempty(invalidFacetGroupVector)
0048     result.constraintMatrix = dec.confinementMappingData.A;
0049     %! DEV: This should not apply:
0050 %     result.constraintList{1} = dec.confinementMappingData.A;
0051 %     result.projectionList{1} = eye(length(hE));
0052     %/
0053     
0054     % immideate return, there is no projection that could be found.
0055     return
0056 end
0057 
0058 %% identify projections
0059 % Note that we might identify the same projection multiple times if more
0060 %   than one boundary of a group validity cone is violated. But this does
0061 %   not matter for the result and timing is not crucial.
0062 for iConstraint = 1:length(invalidFacetGroupVector)
0063     projectionData = dec.confinementMappingData.projectionData(...
0064         invalidFacetGroupVector(iConstraint));
0065     
0066     [dump thisProjectionIndex thisConstraintMatrixList] = ...
0067         projectFromData(hE, projectionData, zerotol, 1);
0068     thisProjectionMatrix = projectionData.projectionList{thisProjectionIndex};
0069     
0070     % evaluate / concatenate
0071     result.constraintMatrix = [result.constraintMatrix; ...
0072                                thisConstraintMatrixList{1}];
0073     result.projectionMatrix = result.projectionMatrix * ...
0074                               thisProjectionMatrix;
0075     result.constraintList{iConstraint} = thisConstraintMatrixList{1};
0076     result.projectionList{iConstraint} = thisProjectionMatrix;
0077     result.projectionIndexVector(iConstraint) = thisProjectionIndex;
0078 end

Generated on Sat 18-Jul-2015 16:45:31 by m2html © 2005