#NEWLINE# def gpu_kernels( self , node , name ) : #NEWLINE# #INDENT# code = ( '\nKERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) {\n    ga_size nb = n < m ? n : m;\n    for (ga_size i = LID_0; i < nb; i += LDIM_0) {\n        a[i*m + i] = %(write_a)s(1);\n    }\n}' % dict ( ctype = pygpu . gpuarray . dtype_to_ctype ( self . dtype ) , name = name , write_a = write_w ( self . dtype ) ) ) #NEWLINE# return [ Kernel ( code = code , name = 'k' , params = [ gpuarray . GpuArray , gpuarray . SIZE , gpuarray . SIZE ] , flags = Kernel . get_flags ( self . dtype ) , objvar = ( 'k_eye_' + name ) ) ]