outer#
- class saiunit.math.outer(a, b, out=None, **kwargs)#
Compute the outer product of two vectors or quantities.
Given two 1-D arrays a of length M and b of length N, the outer product is an (M, N) array where
out[i, j] = a[i] * b[j]. The resulting unit isa.unit * b.unit.- Parameters:
a (
Union[Array,ndarray,number,bool, saiunit.Quantity]) – First argument (flattened if not 1-D).b (
Union[Array,ndarray,number,bool, saiunit.Quantity]) – Second argument (flattened if not 1-D).out (
Optional[Any]) – A location into which the result is stored. If not provided, a freshly-allocated array is returned.
- Returns:
output – The outer product of the inputs, shape
(M, N). The resulting unit isa.unit * b.unit.- Return type:
Union[Array, saiunit.Quantity]
Examples
>>> import saiunit as u >>> a = u.math.array([1.0, 2.0]) * u.meter >>> b = u.math.array([3.0, 4.0, 5.0]) * u.second >>> u.math.outer(a, b) # shape (2, 3), unit meter * second