function X = mtimes(A, B)
%TIMES  Symbolic matrix multiplication.
%   MTIMES(A,B) overloads symbolic A * B.
    
%   Copyright (c) 1993-98 by The MathWorks, Inc.
%   $Revision: 1.9 $  $Date: 1997/11/29 01:05:54 $

A = sym(A);
B = sym(B);

if all(size(A) == 1) & all(size(B) == 1)
   % Scalar multiply
   X = maple(A,'*',B);

elseif all(size(A) == 1)
   % Scalar times matrix
   X = maple('scalarmul',B,A);

elseif all(size(B) == 1)
   % Matrix times scalar
   X = maple('scalarmul',A,B);

elseif size(A,2) == size(B,1)
   % Matrix multipliplication
   X = maple(A,'&*',B);

else
   error('Inner matrix dimensions must agree.')
end
