#NEWLINE# def test_hessian( ) : #NEWLINE# #INDENT# D = 5 #NEWLINE# H = npr . randn ( D , D ) #NEWLINE# def fun( x ) : #NEWLINE# #INDENT# return np . dot ( np . dot ( x , H ) , x ) #NEWLINE# #UNINDENT# hess = hessian ( fun ) #NEWLINE# x = npr . randn ( D ) #NEWLINE# check_equivalent ( hess ( x ) , ( H + H . T ) )