%INNER   Euclidean inner product of two tensor images.
%   INNER(A,B) returns the Euclidean inner product of the tensors
%   in the dip_image_arrays A and B. Either A or B can be a
%   numeric tensor.
%
%   See also: DOT, OUTER, CROSS

% (C) Copyright 1999-2009               Pattern Recognition Group
%     All rights reserved               Faculty of Applied Physics
%                                       Delft University of Technology
%                                       Lorentzweg 1
%                                       2628 CJ Delft
%                                       The Netherlands
%
% Bernd Rieger and Cris Luengo, July 2000.
% 10 December 2009: Removed loop. (CL)

function out = inner(in1,in2)
try
   [in1,in2,arrayop] = doarrayinputs(in1,in2);
catch
   error(di_firsterr)
end
if arrayop
   s1 = imarsize(in1);
   s2 = imarsize(in2);
   if length(s1) ~= length(s2) | s1 ~= s2
      error('Tensor sizes do not match.')
   end
   out = sum(in1.*in2);
else
   error('Operation only defined for tensor images.')
end
