0001 function par = validateInput(hcMatrix, dec, par)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 methodApproxList = {'PCA ' 'nonlinear ' 'nonlinearLocal '};
0028 methodErrorList = {'relativeSquared ', 'relativeMean ', 'relativeMax ', ...
0029 'relativeTotal ', 'absoluteSquared ', 'absolute ', 'absoluteMax ', ...
0030 'absoluteTotal ', 'relativeMaxGroupedMean ', 'PCA '};
0031 methodProjectionList = {'true ', 'confined '};
0032
0033 msgMethod = ['Supported approximation methods are: ' methodApproxList{:}];
0034 msgError = ['Supported error types are: ' methodErrorList{:}];
0035 msgProjection = ['Supported projection types are: ' methodProjectionList{:}];
0036
0037
0038 if ~dec.isProper && dec.isComplete
0039 error('elk:decomposition:wrongInput', ['input representation dec ' ...
0040 'must be proper or incomplete (via computeExtendedEmbedding).']);
0041 end
0042 if dec.nC ~= size(hcMatrix, 1)
0043 error('elk:decomposition:wrongInput', ['dimension of vectors in ' ...
0044 ' must match dec.nC.']);
0045 end
0046 if size(hcMatrix, 1) < 1
0047 error('elk:decomposition:wrongInput', ['please give me a vector to ' ...
0048 'work with - the provided hcMatrix is empty']);
0049 end
0050
0051 if size(hcMatrix, 2) <= par.targetDim && ~strcmpi(par.method, 'pca')
0052 warning('elk:decomposition:input', ['Are you kidding me? The '...
0053 'number of hC-vectors just define a subspace perfectly, ' ...
0054 ' you do not need nonlinear optimization to find it. ' ...
0055 ' You shall pass, however.']);
0056 end
0057 if size(hcMatrix, 2) < par.targetDim
0058 warning('elk:decomposition:input', ['Have you recognized that your ' ...
0059 'problem allows a not countable and infinite number of solutions? ' ...
0060 'I will provide you one, but you have to find all of them by ' ...
0061 'yourself. Have fun. :D']);
0062 end
0063
0064
0065
0066
0067
0068 checkArgumentList(methodApproxList, msgMethod, par.method);
0069
0070
0071 if par.targetDim >= dec.nC
0072 error('elk:decomposition:wrongInput', ['The target dimension should be ' ...
0073 'lower than the dimension of the input representation in dec.']);
0074 end
0075
0076
0077
0078
0079
0080 if strcmpi(par.method, 'pca')
0081 return
0082 end
0083
0084
0085 if isempty(par.measureList)
0086 par.measureList = {'volume'};
0087 end
0088 if ~iscell(par.measureList)
0089 par.measureList = {par.measureList};
0090 end
0091
0092 try
0093 sampleMeasureVector = computeMeasureDec(dec, 'hC', hcMatrix(:,1), ...
0094 par.measureList, par.zerotol, 0, 1);
0095 catch thisError
0096 warning(['elk:decomposition:wrongInput', 'Something is wrong with ' ...
0097 'the measure list or the hcMatrix you provided for approximateDec']);
0098 rethrow(thisError);
0099 end
0100
0101
0102 checkArgumentList(methodErrorList, msgError, par.errorType);
0103
0104
0105 if isempty(par.measureWeightVector)
0106 par.measureWeightVector = ones(1, length(sampleMeasureVector));
0107 else
0108
0109 par.measureWeightVector = par.measureWeightVector(:)';
0110 end
0111
0112
0113 checkArgumentList(methodProjectionList, msgProjection, par.projectionType);
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133 if ~(numel(par.manualScaling) == 1) && all(par.manualScaling(:) == 0.5)
0134 warning('elk:decomposition:scalingMatrix', ['I hope, you know what ' ...
0135 'you are doing, providing a manual scaling (matrix).']);
0136 end
0137 if ~isempty(par.manualBoundingCone)
0138 warning('elk:decomposition:boundingCone', ['I hope, you know what ' ...
0139 'you are doing, providing a manual bounding cone']);
0140 end
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174