
上QQ阅读APP看书,第一时间看更新
Scalar operations
Scalar operations involve a vector (or matrix) and a scalar. To perform an operation with a scalar on a matrix, simply apply to the scalar to every item in the matrix:

In Python, we would simply do the following:
vector = np.array([[1,2], [1,2]])
new_vector = vector + 2