fix unitary operator repr

This commit is contained in:
Daniel Tsvetkov 2020-02-04 16:16:26 +01:00
parent ba3be9b4ff
commit 00274ae217

View File

@ -466,9 +466,9 @@ class UnitaryOperator(LinearTransformation, UnitaryMatrix):
def __init__(self, m: ListOrNdarray, name: str = '', *args, **kwargs):
"""UnitaryOperator inherits from both LinearTransformation and a Unitary matrix
It is used to act on a State vector by defining the operator to be the dot product"""
self.name = name
UnitaryMatrix.__init__(self, m=m, *args, **kwargs)
LinearTransformation.__init__(self, m=m, func=self.operator_func, *args, **kwargs)
self.name = name
def operator_func(self, other):
return State(np.dot(self.m, other.m))
@ -1137,9 +1137,9 @@ def test_quantum_processor():
qc.add_row([_, x_partial])
qc.print()
qp = QuantumProcessor(qc)
qp.get_sample(100)
qp.print_sample(qp.get_sample(100))
if __name__ == "__main__":
test()
# test_quantum_processor()
test_quantum_processor()