qrisp.QuantumArray.__mul__#

QuantumArray.__mul__(other: QuantumArray) QuantumArray[source]#

Performs element-wise multiplication.

Parameters:
otherQuantumArray

The QuantumArray to be multiplied.

Returns:
QuantumArray

A new QuantumArray containing the element-wise product.

Examples

>>> import numpy as np
>>> from qrisp import QuantumArray, QuantumFloat
>>> a_array = QuantumArray(QuantumFloat(2), shape=(2,2))
>>> b_array = QuantumArray(QuantumFloat(2), shape=(2,2))
>>> a_array[:] = np.eye(2)
>>> b_array[:] = np.eye(2)
>>> r_array = a_array * b_array
>>> print(r_array)
# {OutcomeArray([[1, 0], [0, 1]]): 1.0}