fn
mv
→Tensormv(mat: Tensor, vec: Tensor)Matrix-vector product.
Computes the standard matrix-vector product
. Equivalent to M @ v for 2-D / 1-D inputs.
Parameters
matTensor2-D matrix of shape
(M, N).vecTensor1-D vector of shape
(N,).Returns
Tensor1-D tensor of shape (M,).
Notes
Element-wise definition:
Implemented by promoting vec to a column vector, calling
lucid.matmul, and then squeezing the trailing axis. Dispatches
to BLAS-2 gemv on the CPU stream and the matmul kernel on the
GPU stream.
Examples
>>> import lucid
>>> M = lucid.tensor([[1., 2.], [3., 4.]])
>>> v = lucid.tensor([5., 6.])
>>> lucid.mv(M, v)
Tensor([17., 39.])