function c = dot(a,b)
%DOT	Vector dot product.
%	C = DOT(A,B) returns the scalar product of the vectors
%	A and B. A and B must be vectors of the same length.
%
%	Also works if A and B are M-by-N matrices (with
%	vectors as columns), in which case C is a row 
%	vector of length N containing the dot product 
%	between the corresponding columns of A and B.
%
%	For column vectors, use A'*B instead.
%
%	See also: CROSS.

%	Clay M. Thompson
%	Copyright (c) 1984-94 by The MathWorks, Inc.

if isstr(a) & isstr(b),
   c = ['norm(' a ') * norm(' b ') * cos(angle(' a ',' b '))'];
else
  if min(size(a))==1, a = a(:); end
  if min(size(b))==1, b = b(:); end
  if any(size(a)~=size(b)),
    error('A and B must be same size.');
  end
  c = sum(a.*b);
end
