0001 function [tensor tensorDim] = obtainTensorDec(dec, measureName, par, ...
0002 vecType, partIndex)
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 thisMeasureStruct = dec.measureData.(measureName);
0025 thisParitition = dec.simplexPartition{partIndex};
0026 tensorDim = thisMeasureStruct.dim;
0027
0028
0029 if thisMeasureStruct.isPar
0030 [~, parIndex] = eliminateRows(par, thisMeasureStruct.par, 0);
0031
0032 if length(parIndex) < size(par, 1)
0033 error('elk:decomposition:wrongInput', ...
0034 'the provided parameter(s) were not found in the decomposition struct');
0035 end
0036 else
0037 parIndex = 1;
0038 end
0039
0040 switch lower(vecType)
0041 case 'hc'
0042
0043 if thisMeasureStruct.isPar
0044 tensor = thisMeasureStruct.tensorHc{parIndex}{partIndex};
0045 else
0046 tensor = thisMeasureStruct.tensorHc{partIndex};
0047 end
0048 case 'se'
0049
0050 if thisMeasureStruct.isPar
0051 tensor = thisMeasureStruct.tensorSe{parIndex};
0052 else
0053 tensor = thisMeasureStruct.tensorSe;
0054 end
0055
0056
0057 switch thisMeasureStruct.dim
0058 case 1
0059 tensor = tensor(thisParitition.seIndexVector);
0060 case 2
0061 tensor = tensor(thisParitition.seIndexVector, ...
0062 thisParitition.seIndexVector);
0063 case 3
0064 tensor = tensor(thisParitition.seIndexVector, ...
0065 thisParitition.seIndexVector, ...
0066 thisParitition.seIndexVector);
0067 end
0068
0069
0070 tensor(isnan(tensor)) = 0;
0071
0072 case 'fullse'
0073 error('elk:decomposition:wrongType', ...
0074 'the named vector type is unknow. This should not happen.');
0075 otherwise
0076 error('elk:decomposition:wrongType', ...
0077 'the named vector type is unknow. This should not happen.');
0078 end