#NEWLINE# def get_solver_mats( self , x_nd , rot_coef ) : #NEWLINE# #INDENT# ( n , d ) = x_nd . shape #NEWLINE# K_nn = tps . tps_kernel_matrix ( x_nd ) #NEWLINE# A = np . r_ [ ( np . zeros ( ( ( d + 1 ) , ( d + 1 ) ) ) , np . c_ [ ( np . ones ( ( n , 1 ) ) , x_nd ) ] ) ] . T #NEWLINE# n_cnts = A . shape [ 0 ] #NEWLINE# ( _u , _s , _vh ) = np . linalg . svd ( A . T ) #NEWLINE# N = _u [ : , n_cnts : ] . copy ( ) #NEWLINE# NR = ( N [ 1 : ( 1 + d ) , : ] . T * rot_coef ) . copy ( ) #NEWLINE# N_gpu = gpuarray . to_gpu ( N [ ( 1 + d ) : , : ] ) #NEWLINE# K_gpu = gpuarray . to_gpu ( K_nn ) #NEWLINE# KN_gpu = culinalg . dot ( K_gpu , N_gpu ) #NEWLINE# QN = ( np . c_ [ ( np . ones ( ( n , 1 ) ) , x_nd ) ] . dot ( N [ : ( 1 + d ) , : ] ) + KN_gpu . get ( ) ) #NEWLINE# NKN_gpu = culinalg . dot ( N_gpu , KN_gpu , transa = 'T' ) #NEWLINE# NKN = NKN_gpu . get ( ) #NEWLINE# NRN = NR . dot ( N [ 1 : ( 1 + d ) , : ] ) #NEWLINE# return ( N , QN , NKN , NRN , NR , K_nn )