vecdot

Contents

vecdot#

class brainunit.linalg.vecdot(a, b, /, *, axis=-1, precision=None, preferred_element_type=None, **kwargs)#

Perform a conjugate multiplication of two batched vectors.

Computes the conjugate dot product of a and b along the given axis. The resulting unit is a.unit * b.unit.

Parameters:
  • a (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Left-hand side array.

  • b (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Right-hand side array. Size of b[axis] must match a[axis], and remaining dimensions must be broadcast-compatible.

  • axis (int) – Axis along which to compute the dot product (default: -1).

  • precision (None | str | Precision | tuple[str, str] | tuple[Precision, Precision] | DotAlgorithm | DotAlgorithmPreset) – Either None (default) or a Precision enum value, or a tuple of two such values.

  • preferred_element_type (str | type[Any] | dtype | SupportsDType | None) – Accumulation and result dtype.

Returns:

output – The conjugate dot product of a and b along axis. The resulting unit is a.unit * b.unit.

Return type:

ndarray or Quantity

Examples

>>> import saiunit as u
>>> a = u.math.array([1.0, 2.0, 3.0]) * u.meter
>>> b = u.math.array([4.0, 5.0, 6.0]) * u.second
>>> u.math.vecdot(a, b)  # scalar Quantity with unit meter * second