I do not understand your suggestion.

__power_matrix function calculates the possible partitions of the degree given, all the produced solution have a total degree equal to the given degree. For example, degree = 5 and we have three variables x1, x2, x3

possible solutions are 

x1^2, x2^2, x3^1  --> total degree = 5

x1, x2, x3^2  --> total degree = 5