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: ValueFnIter_Case1_QuasiHyperbolicNaive_LowMem_Par2_raw.m
    path of file: ./repos/VFIToolkit-matlab/ValueFnIter/ExoticPrefs
    
    the code of the file until where you have to start completion: function [VKron, Policy]=ValueFnIter_Case1_QuasiHyperbolicNaive_LowMem_Par2_raw(VKron, n_d, n_a, n_z, pi_z, DiscountFactorParamsVec(end), ReturnFn, ReturnFnParamsVec)
% (last two entries of) DiscountFactorParamNames contains the names for the two parameters relating to
% Quasi-hyperbolic preferences.
% Let V_j be the standard (exponential discounting) solution to the value fn problem
% The 'Naive' quasi-hyperbolic solution takes current actions as if the
% future agent take actions as if having time-consistent (exponential discounting) preferences.
% V_naive_j: Vtilde_j = u_t+ beta_0 *E[V_{j+1}]

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

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

l_z=length(n_z);
z_gridvals=CreateGridvals(n_z,z_grid,1); % 1 is to create z_gridvals as matrix

%%
VKronold=VKron;

for z_c=1:N_z

    
function [VKron, Policy]=ValueFnIter_Case1_QuasiHyperbolicNaive_LowMem_Par2_raw(VKron, n_d, n_a, n_z, pi_z, DiscountFactorParamsVec(end), ReturnFn, ReturnFnParamsVec)
% (last two entries of) DiscountFactorParamNames contains the names for the two parameters relating to
% Quasi-hyperbolic preferences.
% Let V_j be the standard (exponential discounting) solution to the value fn problem
% The 'Naive' quasi-hyperbolic solution takes current actions as if the
% future agent take actions as if having time-consistent (exponential discounting) preferences.
% V_naive_j: Vtilde_j = u_t+ beta_0 *E[V_{j+1}]

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

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

l_z=length(n_z);
z_gridvals=CreateGridvals(n_z,z_grid,1); % 1 is to create z_gridvals as matrix

%%
VKronold=VKron;

for z_c=1:N_z
    zvals=z_gridvals(z_c,:);
    ReturnMatrix_z=CreateReturnFnMatrix_Case1_Disc_Par2(ReturnFn,n_d, n_a, ones(l_z,1),d_grid, a_grid, zvals,ReturnFnParamsVec);
    
    %Calc the condl expectation term (except beta), which depend