Dot product
C = dot(
returns
the scalar dot
product of A,B
)A
and B
.
If A
and B
are
vectors, then they must have the same length.
If A
and B
are
matrices or multidimensional arrays, then they must have the same
size. In this case, the dot
function treats A
and B
as
collections of vectors. The function calculates the dot product of
corresponding vectors along the first array dimension whose size does
not equal 1.
When inputs A
and B
are
real or complex vectors, the dot
function treats
them as column vectors and dot(A,B)
is the same
as sum(conj(A).*B)
.
When the inputs are matrices or multidimensional arrays,
the dim
argument determines which dimension the sum
function
operates on. In this case, dot(A,B)
is the same
as sum(conj(A).*B,dim)
.