inner#
- class saiunit.math.inner(a, b, *, precision=None, preferred_element_type=None, **kwargs)#
Compute the inner product of two arrays or quantities.
For 1-D arrays, this is the ordinary dot product. For higher dimensions, it is the sum product over the last axes. The resulting unit is
a.unit * b.unit.- Parameters:
a (
Union[Array,ndarray,number,bool, saiunit.Quantity]) – First argument.b (
Union[Array,ndarray,number,bool, saiunit.Quantity]) – Second argument.precision (
Union[None,str,Precision,tuple[str,str],tuple[Precision,Precision],DotAlgorithm,DotAlgorithmPreset]) – EitherNone(default) or aPrecisionenum value, or a tuple of two such values for a and b.preferred_element_type (
Union[str,type[Any],dtype,SupportsDType,None]) – Accumulation and result dtype.
- Returns:
output – The inner product of the inputs. The resulting unit is
a.unit * b.unit.- Return type:
Union[Array, saiunit.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.inner(a, b) # scalar Quantity with unit meter * second