function fct = stopCritMaxIterEpsilonCreator(M,maxIter, epsilon) % stopCritMaxIterEpsilonCreator(M,maxIter,epsilon) a maxIt minEps criterion % based on a maximal number of iterations or a minimal max-norm change % % INPUT % M : the manifold the data lives on % maxIter : the maximal number of iterations % epsilon : the maximal change within an iteration % % OUTPUT % fct : a functional @(x,xold,s,iter) suitable for both (sub) gradient % descent or cyclic proximal point % --- % MVIRT 1.1 | R. Bergmann | 2018-01-25 fct = @(x,xold,~,iter) ... (max(M.dist(... x(M.allDims{:},... reshape(any(reshape(~isnan(xold)&~isnan(x),prod(M.ItemSize),[]),1),[],1)... ),... xold(M.allDims{:},... reshape(any(reshape(~isnan(xold)&~isnan(x),prod(M.ItemSize),[]),1),[],1)... )... )) < epsilon ... || (iter >= maxIter) ) && iter>1 && ~isnan(any(x(:))) && ~isnan(any(xold(:))); end