%mathpiper,def="InProduct"

Function("InProduct",{aLeft,aRight})
[
  Local(length);
  length:=Length(aLeft);
  Check(length = Length(aRight), "Argument", "InProduct: error, vectors not of the same dimension");

  Local(result);
  result:=0;
  Local(i);
  For(i:=1,i<=length,i++)
  [
    result := result + aLeft[i] * aRight[i];
  ];
  result;
];

%/mathpiper



%mathpiper_docs,name="InProduct",categories="User Functions;Linear Algebra"
*CMD InProduct --- inner product of vectors (deprecated)
*STD
*CALL
	InProduct(a,b)

*PARMS

{a}, {b} -- vectors of equal length

*DESC

The inner product of the two vectors "a" and "b" is returned. The
vectors need to have the same size.

*E.G.

In> Dot({a,b,c}, {d,e,f});
Result: a*d+b*e+c*f;

*SEE Outer, Dot, CrossProduct
%/mathpiper_docs