cf.Data.outerproduct¶
-
Data.
outerproduct
(a, inplace=False, i=False)[source]¶ Compute the outer product with another data array.
The axes of result will be the combined axes of the two input arrays.
See also
np.multiply.outer
- Parameters
- Returns
Examples
>>> d = cf.Data([1, 2, 3], 'm') >>> d <CF Data(3): [1, 2, 3] m> >>> f = d.outerproduct([4, 5, 6, 7]) >>> f <CF Data(3, 4): [[4, ..., 21]] m> >>> print(f.array) [[ 4 5 6 7] [ 8 10 12 14] [12 15 18 21]]
>>> e = cf.Data([[4, 5, 6, 7], [6, 7, 8, 9]], 's-1') >>> e <CF Data(2, 4): [[4, ..., 9]] s-1> >>> f = d.outerproduct(e) >>> f <CF Data(3, 2, 4): [[[4, ..., 27]]] m.s-1> >>> print(f.array) [[[ 4 5 6 7] [ 6 7 8 9]]
- [[ 8 10 12 14]
[12 14 16 18]]
- [[12 15 18 21]
[18 21 24 27]]]