You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: PolicyFnIter_Case1_Par2_raw.m
    path of file: ./repos/VFIToolkit-matlab/ValueFnIter/InfHorz/PFI
    
    the code of the file until where you have to start completion: function [VKron, Policy]=PolicyFnIter_Case1_Par2_raw(VKron, n_d,n_a,n_z, pi_z, beta, ReturnMatrix, Howards,Howards2, Tolerance) %Verbose,

N_d=prod(n_d);

    
function [VKron, Policy]=PolicyFnIter_Case1_Par2_raw(VKron, n_d,n_a,n_z, pi_z, beta, ReturnMatrix, Howards,Howards2, Tolerance) %Verbose,

N_d=prod(n_d);
N_a=prod(n_a);
N_z=prod(n_z);

PolicyIndexes=zeros(N_a,N_z,'gpuArray');

Ftemp=zeros(N_a,N_z,'gpuArray');

bbb=reshape(shiftdim(pi_z,-1),[1,N_z*N_z]);
ccc=kron(ones(N_a,1,'gpuArray'),bbb);
aaa=reshape(ccc,[N_a*N_z,N_z]);
% I suspect but have not yet double-checked that could instead just use
% aaa=kron(ones(N_a,1,'gpuArray'),pi_z);


%%
tempcounter=1;
currdist=Inf;
while currdist>Tolerance
    VKronold=VKron;
    
%     tic;
    for z_c=1:N_z
        ReturnMatrix_z=ReturnMatrix(:,:,z_c);     
        %Calc the condl expectation term (except beta), which depend