(P[0] * P[3] + P[1] * P[2]) xInVec = xIn.reshape((L * M * N, 1), order='F') idx_all = np.ones((L, M, N), dtype=bool) # def mvp(x): # 'Matrix-vector product operator' # return mvp_volume_potential(x, circ_op, idx, Mr) # Voxel permittivities for volume potential (all ones) Mr_vol_pot = np.ones((L, M, N), dtype=np.complex128) # Perform matrix-vector product start = time.time() # P_inc[i_harm] = mvp(xInVec).reshape(L, M, N, order='F') P_inc[i_harm] = mvp_volume_potential(xInVec, circ_op, idx_all, Mr_vol_pot)\ .reshape(L, M, N, order='F') # New Mr and Mr_box at new frequency Mr_box[idx_scat_box] = refInd2**2 - 1 Mr[idx_scat] = refInd2**2 - 1 # Solve scattering problem sol, J, u_sca = vie_solver(Mr_box, r_box, idx_scat_box, P_inc[i_harm][idx_scat], k2) # Evaluate scattered field in total domain # Toeplitz operator T = k2**2 * volume_potential(k2, r) # Circulant embedding of Toeplitz operator circ = circulant_embed_fftw(T, L, M, N)
def mvp(x): 'Matrix-vector product operator' return mvp_volume_potential(x, circ_op, idx, Mr)