function muaa = eval1dPnitsp(s, ix, aphib, xlen, Pblen, Lx, deg)

%  We compute the approximate matrix aa(.,.) of size (xlen, xlen)
%  and its largest eigenvalue muaa.
%
%    Initialize matrix
format long
  aa = zeros(xlen,xlen);
  aphibs = aphib.^s;
      parfor k = 1:xlen
       	 for l = 1:Pblen
               caa = zeros(1,xlen);
             ixkl = ix(k,l);
             aphibskl = aphibs(k,l);
             for i = 1:deg+1
		 kli = ixkl + i-1;
		 if (kli > xlen)
                    display(['kli > xlen'])
	            display([i, kli, xlen, ixkl])  % error check
                 end
%    	      aa(k,kli) = aa(k,kli) + aphibskl*Lx(k,l,i);
              caa(kli) =  caa(kli) + aphibskl*Lx(k,l,i);
             end
             aa(k,:) = aa(k,:) + caa;
         end
       end
%
%  Computation of the largest eigenvalue of the matrix aa
%  by the Matlab routine eigs.
	 muaa = eigs(aa,1);
%  end of function eval1dPnitsp
