function monomialVector = convertHcMatrixToMonomials(hcMatrix, numberVector, dec)

if ~isfield(dec, 'monomialMatrix')
    error('elk:decMonomials:inputError', ['Please add the monomial matrix ' ...
        'via addMonomialMatrixDec before using this function']);
end

% adopt for handling of "0" in monomial matrix
monomialIndexMatrix = dec.monomialMatrix;
monomialIndexMatrix(monomialIndexMatrix == 0) = dec.nC+1;
hcMatrix = [hcMatrix; ones(1, size(hcMatrix, 2))];

% fill a matrix with multipliers
monomialMatrix = ones(size(monomialIndexMatrix, 1), size(hcMatrix, 2));
for iExpo = 1:size(dec.monomialMatrix, 2)
    monomialMatrix = monomialMatrix .* ...
        hcMatrix(monomialIndexMatrix(:, iExpo), :);
end

% multiply for particle number
monomialMatrix = bsxfun(@times, numberVector(:)', monomialMatrix);

% add the hcVector single monomials
monomialVector = sum(monomialMatrix, 2);