David, thank you very much for the detailed explanation, will read through it.
Steven, sorry for not explaining the problem clearly. My issue is basically trying to figure out a way to loop over all possible combinations of exponents (e1, e2, e3) for which the sum is less or equal to N and generate a vector with the terms Xj[1]^e1*Xj[2]^e2*Xj[3]^e3. The j-th column of the resulting matrix contains the terms of this polynomial evaluated at the j-th column of X. -Júlio
