function M=pdeasma(it1,it2,it3,np,ar,x,y,sd,u,ux,uy,time,a)
%PDEASMA Assemble the A coefficient.

%       A. Nordmark 12-19-94.
%       Copyright (c) 1994-98 by The MathWorks, Inc.
%       $Revision: 1.7 $  $Date: 1997/11/25 17:05:08 $

avoid_arithmetics_on_NaNs=0;
if ~isieee & any(isnan(time))
  % PARABOLIC and HYPERBOLIC probes with time=NaN for
  % explicit time dependence. We must not cause any floating point
  % exceptions in this case.
  avoid_arithmetics_on_NaNs=1;
end

a=pdetexpd(x,y,sd,u,ux,uy,time,a);
if avoid_arithmetics_on_NaNs & any(isnan(a))
  M=sparse(1,1,NaN,np,np);
  return
end
aod=a.*ar/12; % Off diagonal element
ad=2*aod; % Diagonal element
M=sparse(it1,it2,aod,np,np);
M=M+sparse(it2,it3,aod,np,np);
M=M+sparse(it3,it1,aod,np,np);
M=M+M.';
M=M+sparse(it1,it1,ad,np,np);
M=M+sparse(it2,it2,ad,np,np);
M=M+sparse(it3,it3,ad,np,np);

