Skip to content

sumproduct

Sum of element-wise products of arrays.

v = sumproduct(array1, array2, ...)

Returns sum(array1 .* array2 .* ...) — the dot product / element-wise product summed. Arrays must have the same shape.

sumproduct([1 2 3], [4 5 6]) % 32
sumproduct([1 0 1; 0 1 1], [1 2 3; 4 5 6]) % 1+0+3+0+5+6 = 15
  • product — Product of all numeric arguments.
  • dot — Vector or array dot product.
  • sum — Sum elements of an array.