#NEWLINE# def get_quad_terms( vec ) : #NEWLINE# #INDENT# N = vec . shape [ 0 ] #NEWLINE# v_t_v = np . dot ( vec [ : , None ] , vec [ None , : ] ) #NEWLINE# inds = np . triu_indices ( N ) #NEWLINE# return np . r_ [ ( vec , v_t_v [ v_t_v ] ) ]