mimiqcircuits.operations.operators.custom¶
Classes
|
N-qubit operator specified by a \(2^N \times 2^N\) matrix. |
- class mimiqcircuits.operations.operators.custom.Operator(mat)[source]¶
Bases:
AbstractOperatorN-qubit operator specified by a \(2^N \times 2^N\) matrix.
Note
Only one and two qubit operators are supported.
This operator does not have to be unitary.
See also
AbstractOperator,ExpectationValue,KrausChannel- Parameters:
matrix (list or np.ndarray) – The \(2^N \times 2^N\) matrix representing the operator.
Examples
>>> from mimiqcircuits import * >>> from symengine import Matrix >>> op = Operator(Matrix([[1, 2], [3, 4]])) >>> op 1-qubit Operator: ├── 1 2 └── 3 4 >>> op = Operator(Matrix([[1, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 1]])) >>> op 2-qubit Operator: ├── 1 0 0 1 ├── 0 0 0 0 ├── 0 0 0 0 └── 1 0 0 1
Operators can be used for expectation values:
>>> c = Circuit() >>> c.push(ExpectationValue(Operator(Matrix([[0, 1], [0, 0]]))), 1, 1) 2-qubit, 2-zvar circuit with 1 instruction: └── ⟨Operator([[0, 1], [0, 0]])⟩ @ q[1], z[1]
- property parnames¶
Return the parameter names.