# coding: utf-8 # # Practice: Matrix Products # Do the following: # # * Implement a matrix-matrix product $A\overline{B}^T$ in loopy. Let $A$ be real-valued and $B$ be complex-valued. The overline symbolizes complex conjugation. # ## Setup code # In[17]: import numpy as np import numpy.linalg as la import pyopencl as cl import pyopencl.array import pyopencl.clrandom import loopy as lp # In[18]: ctx = cl.create_some_context() queue = cl.CommandQueue(ctx) # In[19]: n = 1024 A = cl.clrandom.rand(queue, (n, n), dtype=np.float64) B = ( cl.clrandom.rand(queue, (n, n), dtype=np.float64) + 1j * cl.clrandom.rand(queue, (n, n), dtype=np.float64)) # ## Implementing the Kernel # Implement the basic kernel here: # In[20]: knl = lp.make_kernel( "{[i,j,k]: 0<=i,j,k