convertHcMatrixToMonomials

PURPOSE ^

SYNOPSIS ^

function monomialVector = convertHcMatrixToMonomials(hcMatrix, numberVector, dec)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function monomialVector = convertHcMatrixToMonomials(hcMatrix, numberVector, dec)
0002 
0003 if ~isfield(dec, 'monomialMatrix')
0004     error('elk:decMonomials:inputError', ['Please add the monomial matrix ' ...
0005         'via addMonomialMatrixDec before using this function']);
0006 end
0007 
0008 % adopt for handling of "0" in monomial matrix
0009 monomialIndexMatrix = dec.monomialMatrix;
0010 monomialIndexMatrix(monomialIndexMatrix == 0) = dec.nC+1;
0011 hcMatrix = [hcMatrix; ones(1, size(hcMatrix, 2))];
0012 
0013 % fill a matrix with multipliers
0014 monomialMatrix = ones(size(monomialIndexMatrix, 1), size(hcMatrix, 2));
0015 for iExpo = 1:size(dec.monomialMatrix, 2)
0016     monomialMatrix = monomialMatrix .* ...
0017         hcMatrix(monomialIndexMatrix(:, iExpo), :);
0018 end
0019 
0020 % multiply for particle number
0021 monomialMatrix = bsxfun(@times, numberVector(:)', monomialMatrix);
0022 
0023 % add the hcVector single monomials
0024 monomialVector = sum(monomialMatrix, 2);

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