fn

vdot

Tensor
vdot(a: Tensor, b: Tensor)
source

Vector dot product (complex-conjugating on the first argument).

Forwards to lucid.linalg.dot. For real tensors this is the usual inner product; for complex tensors (when supported) the first argument is conjugated, matching NumPy's vdot convention.

Parameters

aTensor
1-D tensor.
bTensor
1-D tensor of the same length as a.

Returns

Tensor

0-D scalar tensor holding the dot product.

Notes

Mathematical definition (general case):

out=i=0N1aibi.\text{out} = \sum_{i = 0}^{N - 1} \overline{a_i} \cdot b_i.

For real a this reduces to the standard inner product iaibi\sum_i a_i b_i. Tensors must be 1-D and of equal length.

Examples

>>> import lucid
>>> a = lucid.tensor([1., 2., 3.])
>>> b = lucid.tensor([4., 5., 6.])
>>> lucid.vdot(a, b)
Tensor(32.)