dot
dot(x, y) â‹…(x,y)
Compute the dot product. For complex vectors, the first vector is conjugated.
Examples

Compute the dot product of two vectors:
julia> x = [1, 2, 3]; julia> y = [4, 5, 6]; julia> dot(x, y) 32
This example calculates the dot product of the vectors
x
andy
.  Handle complex vectors:
julia> x = [1+2im, 23im, 3+4im]; julia> y = [45im, 5+6im, 67im]; julia> dot(x, y) 62 + 35im
When dealing with complex vectors, the dot function conjugates the first vector before computing the dot product.
Common mistake example:
julia> x = [1, 2, 3];
julia> y = [4, 5];
julia> dot(x, y)
ERROR: DimensionMismatch("dot product arguments have lengths 3 and 2")
In this example, the dimensions of the vectors x
and y
do not match. The dot function requires the vectors to have the same length. Make sure the input vectors are of the same dimension to avoid this error.
See Also
User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.