fn

dot

Tensor
dot(x: Tensor, y: Tensor)
source

Dot product of two 1-D tensors.

Computes the scalar inner product

xy=ixiyi.x \cdot y \,=\, \sum_{i} x_i\, y_i.

Parameters

xTensor
1-D tensors of equal length.
yTensor
1-D tensors of equal length.

Returns

Tensor

Scalar dot product.

Notes

For higher-rank tensors use inner (last-dim contraction) or vecdot (explicit axis), and matmul for matrix products.

Examples

>>> import lucid
>>> from lucid.linalg import dot
>>> dot(lucid.tensor([1.0, 2.0, 3.0]), lucid.tensor([4.0, 5.0, 6.0]))
Tensor(32.0)