#NEWLINE# def K( self , X , X2 = None ) : #NEWLINE# #INDENT# slices = index_to_slices ( X [ : , self . index_dim ] ) #NEWLINE# kerns = ( itertools . repeat ( self . kern ) if self . single_kern else self . kern ) #NEWLINE# if ( X2 is None ) : #NEWLINE# #INDENT# target = np . zeros ( ( X . shape [ 0 ] , X . shape [ 0 ] ) ) #NEWLINE# [ [ target . __setitem__ ( ( s , ss ) , ( kern . K ( X [ s , : ] ) if ( s == ss ) else kern . K ( X [ s , : ] , X [ ss , : ] ) ) ) for ( s , ss ) in itertools . product ( slices_i , slices_i ) ] for ( kern , slices_i ) in zip ( kerns , slices ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# slices2 = index_to_slices ( X2 [ : , self . index_dim ] ) #NEWLINE# target = np . zeros ( ( X . shape [ 0 ] , X2 . shape [ 0 ] ) ) #NEWLINE# [ [ target . __setitem__ ( ( s , s2 ) , kern . K ( X [ s , : ] , X2 [ s2 , : ] ) ) for ( s , s2 ) in itertools . product ( slices_i , slices_j ) ] for ( kern , slices_i , slices_j ) in zip ( kerns , slices , slices2 ) ] #NEWLINE# #UNINDENT# return target