#NEWLINE# def func( self , x ) : #NEWLINE# #INDENT# self . funccalls += 1 #NEWLINE# if ( self . funccalls > 6000 ) : #NEWLINE# #INDENT# raise RuntimeError ( 'too many iterations in optimization routine' ) #NEWLINE# #UNINDENT# log_pdot = np . dot ( self . F , x ) #NEWLINE# logZ = np . log ( sum ( np . exp ( log_pdot ) ) ) #NEWLINE# f = ( logZ - np . dot ( logZ . K , x ) ) #NEWLINE# self . trace . append ( x ) #NEWLINE# return f