An example of Python: Numpy seeking average vector
- 2021-07-06 11:12:20
- OfStack
As shown below:
>>> import numpy as np
>>> a = np.array([[1, 2, 3], [3, 1, 2]])
>>> b = np.array([[5, 2, 6], [5, 1, 2]])
>>> a
array([[1, 2, 3],
[3, 1, 2]])
>>> b
array([[5, 2, 6],
[5, 1, 2]])
>>> c = a + b
>>> c
array([[6, 4, 9],
[8, 2, 4]])
>>> c = (a+b)/2
>>> c
array([[ 3. , 2. , 4.5],
[ 4. , 1. , 2. ]])
>>>