function [ z ] = Av(v, K, H, R, dt, nt, mt, rho )
%
% Evaluate z=A*v where A is the matrix in the
% regularized least squares problem
%
% Matthias Heinkenschloss
% Jan 9, 2017 (revised Jan 14, 2020)

mh = size(H,1);

z  = [ zeros(mh*mt,1);
       sqrt(rho)*(R*v) ];
  
I = speye(size(K,1));

for j = 1:mt
    for i = 1:nt/mt
        v  = (I-(0.5*dt)*K) \ ((I+(0.5*dt)*K)*v); 
    end
    z((j-1)*mh+1:j*mh) = H*v;
end


