function A = loc_ker_fsa(alf,max_k) A = null_dfsa(alf); SS={}; S = length(alf); for L=1:max_k dim = ones(L,1)*S; winds = list_all_ind(dim); W = size(winds,1); PROGstart(W,['generating strings of length ' num2str(L)]); for j=1:W win = winds(j,:); str = alf(win); SS{end+1} = str; PROGupdate(j); end PROGend; end PROGstart(length(SS),'building fsa...'); for j=1:length(SS) R = jth_regexp(alf,SS{j}); Aj = gregexp2dfsa_fast(R,alf); A = union_dfsa(A,Aj); PROGupdate(j); end PROGend; return function reg = jth_regexp(alf,str) as = setstar(alf); reg = as; for j=1:length(str) reg = [reg str(j) as]; end return function re = setstar(u) k=length(u); P=repmat('+',1,k); up = [u;P]; up = up(:)'; re = ['(' up(1:end-1) ')*']; return