0001 function [vecType, vec, partitionIndex] = ...
0002 clarifyVectorInformation(vecType, vec, simplex, dec, zerotol, ...
0003 enforceValid)
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 if ~dec.isComplete
0032 if iscell(vec)
0033 if simplex
0034 partitionIndex = vec{1};
0035 else
0036 partitionIndex = dec.unifiedToSimplexVector(vec{1});
0037 end
0038 vec = vec{2};
0039 else
0040
0041 partitionIndex = dec.unifiedToSimplexVector*ones(1, size(vec, 2));
0042 end
0043 return
0044 end
0045
0046
0047
0048 if iscell(vec)
0049 if simplex
0050
0051 partitionIndex = vec{1};
0052 else
0053
0054 partitionIndex = dec.unifiedToSimplexVector(vec{1});
0055 end
0056
0057 vec = vec{2};
0058
0059 elseif strcmpi(vecType, 'hc')
0060
0061
0062 validVector = isValidDec(vec, dec, zerotol);
0063 partitionIndex = nan(size(validVector));
0064 if all(validVector)
0065
0066 elseif enforceValid == 1
0067
0068 vec = mapToValidityCone(vec, dec, zerotol);
0069 validVector = true(size(validVector));
0070 elseif enforceValid == -1
0071
0072
0073 partitionIndex = double(validVector);
0074 else
0075 error('elk:decomposition:invalidPoints', ['Not all input vectors ' ...
0076 'are valid. You might want to use the enforceValid option.']);
0077 end
0078
0079 if simplex
0080 partitionIndex(validVector) = computePartitionIndexDec(dec, ...
0081 vec(:, validVector), zerotol, 0);
0082 else
0083 partitionIndex(validVector) = computePartitionIndexDec(dec, ...
0084 vec(:, validVector), zerotol, 1);
0085 partitionIndex(validVector) = dec.unifiedToSimplexVector(...
0086 partitionIndex(validVector));
0087 end
0088
0089
0090 else
0091 error('elk:decomposition:wrongInput', ...
0092 ['For a given vector of scalar multiples of structuring elements ' ...
0093 'the partition must be provided']);
0094 end
0095
0096
0097
0098
0099
0100
0101 if size(vec, 1) ~= dec.nC
0102 if size(vec, 2) == dec.nC
0103 vec = vec';
0104 else
0105 error('elk:decomposition:wrongInput', ...
0106 ['the provided vector must be a row vector (or matrix of ' ...
0107 'vectors) with the dimension of: size(dec.se, 2)']);
0108 end
0109 end