Automatic differentiation of dominant eigensolver and its applications in quantum physics