fix unitary operator repr
This commit is contained in:
parent
ba3be9b4ff
commit
00274ae217
@ -466,9 +466,9 @@ class UnitaryOperator(LinearTransformation, UnitaryMatrix):
|
|||||||
def __init__(self, m: ListOrNdarray, name: str = '', *args, **kwargs):
|
def __init__(self, m: ListOrNdarray, name: str = '', *args, **kwargs):
|
||||||
"""UnitaryOperator inherits from both LinearTransformation and a Unitary matrix
|
"""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"""
|
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)
|
UnitaryMatrix.__init__(self, m=m, *args, **kwargs)
|
||||||
LinearTransformation.__init__(self, m=m, func=self.operator_func, *args, **kwargs)
|
LinearTransformation.__init__(self, m=m, func=self.operator_func, *args, **kwargs)
|
||||||
|
self.name = name
|
||||||
|
|
||||||
def operator_func(self, other):
|
def operator_func(self, other):
|
||||||
return State(np.dot(self.m, other.m))
|
return State(np.dot(self.m, other.m))
|
||||||
@ -1137,9 +1137,9 @@ def test_quantum_processor():
|
|||||||
qc.add_row([_, x_partial])
|
qc.add_row([_, x_partial])
|
||||||
qc.print()
|
qc.print()
|
||||||
qp = QuantumProcessor(qc)
|
qp = QuantumProcessor(qc)
|
||||||
qp.get_sample(100)
|
qp.print_sample(qp.get_sample(100))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test()
|
test()
|
||||||
# test_quantum_processor()
|
test_quantum_processor()
|
||||||
|
Loading…
Reference in New Issue
Block a user