def __get_trace_facvar(self, polynomial):
facvar = [<NUM_LIT:0>] * (self.n_vars + <NUM_LIT:1>)<EOL>F = {}<EOL>for i in range(self.matrix_var_dim):<EOL><INDENT>for j in range(self.matrix_var_dim):<EOL><INDENT>for key, value inpolynomial[i, j].as_coefficients_dict().items():<EOL><INDENT>skey = apply_substitutions(key, self.substitutions,<EOL>self.pure_substitution_rules)<EOL>try:<EOL><INDENT>Fk = F[skey]<EOL><DEDENT>except KeyError:<EOL><INDENT>Fk = zeros(self.matrix_var_dim, self.matrix_var_dim)<EOL><DEDENT>Fk[i, j] += value<EOL>F[skey] = Fk<EOL><DEDENT><DEDENT><DEDENT>for key, Fk in F.items():<EOL><INDENT>if key == S.One:<EOL><INDENT>k = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>k = self.monomial_index[key]<EOL><DEDENT>for i in range(self.matrix_var_dim):<EOL><INDENT>for j in range(self.matrix_var_dim):<EOL><INDENT>sym_matrix = zeros(self.matrix_var_dim,<EOL>self.matrix_var_dim)<EOL>sym_matrix[i, j] = <NUM_LIT:1><EOL>facvar[k+i*self.matrix_var_dim+j] = (sym_matrix*Fk).trace()<EOL><DEDENT><DEDENT><DEDENT>facvar = [float(f) for f in facvar]<EOL>return facvar<EOL>
Return dense vector representation of a polynomial. This function is
        nearly identical to __push_facvar_sparse, but instead of pushing
        sparse entries to the constraint matrices, it returns a dense
        vector.