mindquantum.utils.mod

View Source On Gitee
mindquantum.utils.mod(vec_in, axis=0)[source]

Calculate the mod of input vectors.

Parameters
Returns

numpy.ndarray, The mod of input vector.

Examples

>>> from mindquantum.utils import mod
>>> vec_in = np.array([[1, 2, 3], [4, 5, 6]])
>>> mod(vec_in)
array([[4.12310563, 5.38516481, 6.70820393]])
>>> mod(vec_in, 1)
array([[3.74165739],
       [8.77496439]])