#NEWLINE# @ Cache_this ( limit = 3 ) #NEWLINE# def K( self , X , X2 = None ) : #NEWLINE# #INDENT# if hasattr ( X , 'values' ) : #NEWLINE# #INDENT# X = X . values #NEWLINE# #UNINDENT# index = np . int_ ( X [ : , 1 ] ) #NEWLINE# index = index . reshape ( index . size ) #NEWLINE# X_flag = ( index [ 0 ] >= self . output_dim ) #NEWLINE# if ( X2 is None ) : #NEWLINE# #INDENT# if X_flag : #NEWLINE# #INDENT# index -= self . output_dim #NEWLINE# return self . _Kuu ( X , index ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise NotImplementedError #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( X2 , 'values' ) : #NEWLINE# #INDENT# X2 = X2 . values #NEWLINE# #UNINDENT# index2 = np . int_ ( X2 [ : , 1 ] ) #NEWLINE# index2 = index2 . reshape ( index2 . size ) #NEWLINE# X2_flag = ( index2 [ 0 ] >= self . output_dim ) #NEWLINE# if ( ( not X_flag ) and X2_flag ) : #NEWLINE# #INDENT# index2 -= self . output_dim #NEWLINE# return self . _Kfu ( X , index , X2 , index2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# index -= self . output_dim #NEWLINE# return self . _Kfu ( X2 , index2 , X , self ) . T