The problem of encoded quantum gate generation is studied in this paper. The idea is to consider a quantum system of higher dimension (n) than the dimension (\bar n) of the quantum gate to be synthesized. Given two orthonormal subsets (\mathbb{E} = \{e_1, e_2, \ldots, e_{\bar n}\}) and (\mathbb F = \{f_1, f_2, \ldots, f_{\bar n}\}) of (\mathbb{C}^n), the problem of encoded quantum gate generation consists in obtaining an open loop control law defined in an interval ([0, T_f]) in a way that all initial states (e_i) are steered to (\exp(\jmath \phi) f_i, i=1,2, \ldots ,\bar n) up to some desired precision and to some global phase (\phi \in \mathbb{R}). This problem includes the classical (full) quantum gate generation problem, when (\bar n = n), the state preparation problem, when (\bar n = 1), and finally the encoded gate generation when ( 1 < \bar n < n). Hence, three problems are unified here within a unique common approach. The Reference Input Generation Algorithm (RIGA) is generalized in this work for considering the encoded gate generation problem for closed quantum systems. A suitable Lyapunov function is derived from the orthogonal projector on the support of the encoded gate. Three case-studies of physical interest indicate the potential interest of such numerical algorithm: two coupled transmon-qubits, a cavity mode coupled to a transmon-qubit, and a chain of (N) qubits, including a large dimensional case for which (N=10).