Here the SGVector and SGMatrix have  to be reference type because they are initialized inside gen_data.