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: pcg12.m
    path of file: ./repos/2D_3D_PolarFourierTransform/MATLAB CodeBase/BTTBSystemsStudy
    
    the code of the file until where you have to start completion: function [ u ] = pcg12( b,ig, tev,ev, tol )
%PCG12 uses PCG method for solving T_{mn}u = b with the BCCB preconditioner
%    b : the right hand side vector
%   ig : initial guess
%  tev : the matrix generated by gentev.m , see A. 11
%  ev  : the matrix generated by gent12ev.m, see A. 17
%  tol : the tolerance 
%    u : the output solution

mmax = 1000;    % the maximal number of iterations
u = ig;

 r = b - tx(tev,u);
 e(1)= norm(r);

    
function [ u ] = pcg12( b,ig, tev,ev, tol )
%PCG12 uses PCG method for solving T_{mn}u = b with the BCCB preconditioner
%    b : the right hand side vector
%   ig : initial guess
%  tev : the matrix generated by gentev.m , see A. 11
%  ev  : the matrix generated by gent12ev.m, see A. 17
%  tol : the tolerance 
%    u : the output solution

mmax = 1000;    % the maximal number of iterations
u = ig;

 r = b - tx(tev,u);
 e(1)= norm(r);
 fprintf ('\n Initial residual = %e', e(1));
 
 iter = 1;
 t1 = 1.0;
 d = zeros (length(ig),1);
 while iter < mmax & e(iter)/e(1) > tol,
     z = l2cinvx(ev,r);
     t1old = t1; t1 = z' * r;
     beta = t1/t1old;
     d = z+ beta*d; 
     s= tx(tev,d);
     suma = d'*s;
     tau  = t1/suma;
     u = u+ tau*d;
     r = r - tau*s;
     iter = iter +1;
     e(iter)= norm (r);
     fprintf('\n At step %1.0f , relative residual = % e', iter-1,e(iter)/e(1));
 end