function [x1,w1] = tstep(XX,WW,q,ord)
%
%  Validated evaluation of one step with the Taylor method.
%
%  input:
% 	XX(N,4,ord+1)	(intval) Taylor coefficients of solution
% 	WW(N,16,ord+1)	(intval) Taylor coefficients of derivative
% 	q or q(1,N)	stepsize correction factor
% 	ord		order of Taylor expansion
%
%  output:
% 	x1(N,4)		(intval) solution
% 	w1(N,16)	(intval) derivative
%
N=size(XX,1);
Nq=size(q,2);
XX=reshape(XX,N*4,ord+1);
WW=reshape(WW,N*16,ord+1);
if isintval(q),
  qq=cumpotenz(q,ord);
else
  if Nq==1,
    qq=q.^(0:ord)';
  else
    qq=[ones(1,Nq);cumprod(ones(ord,1)*q)];
  end
end
if Nq==1,
  x1=reshape(XX*qq,N,4);
  w1=reshape(WW*qq,N,16);
else
  x1=reshape(sum(kron(qq',ones(4,1)).*XX,2),N,4);
  w1=reshape(sum(kron(qq',ones(16,1)).*WW,2),N,16);
end

return

%
% written   Sept/10/02   D.Stoffer
%



