To multiply the elements of an array by a number in python, a solution is to use the * operator, example:
>>> import numpy as np
>>> A = np.array([[1,2,0],[4,3,-1]])
>>> A
array([[ 1, 2, 0],
[ 4, 3, -1]])
>>> A * 2
array([[ 2, 4, 0],
[ 8, 6, -2]])
References
Liens | Site |
---|---|
Introduction to Python Operator | data-flair.training |