  The generalized eigenvalue (GE) problems are of particular importance in
various areas of science engineering and machine learning. We present a
variational quantum algorithm for finding the desired generalized eigenvalue of
the GE problem, $\mathcal{A}|\psi\rangle=\lambda\mathcal{B}|\psi\rangle$, by
choosing suitable loss functions. Our approach imposes the superposition of the
trial state and the obtained eigenvectors with respect to the weighting matrix
$\mathcal{B}$ on the Rayleigh-quotient. Furthermore, both the values and
derivatives of the loss functions can be calculated on near-term quantum
devices with shallow quantum circuit. Finally, we propose a full quantum
generalized eigensolver (FQGE) to calculate the minimal generalized eigenvalue
with quantum gradient descent algorithm. As a demonstration of the principle,
we numerically implement our algorithms to conduct a 2-qubit simulation and
successfully find the generalized eigenvalues of the matrix pencil
$(\mathcal{A},\,\mathcal{B})$. The numerically experimental result indicates
that FQGE is robust under Gaussian noise.
