mimiqcircuits.operations.operators.diagonals

Classes

DiagonalOp(a, b)

One-qubit diagonal operator.

class mimiqcircuits.operations.operators.diagonals.DiagonalOp(a, b)[source]

Bases: AbstractOperator

One-qubit diagonal operator.

The corresponding matrix is given by:

Matrix Representation

\[\begin{split}\begin{pmatrix} a & 0 \\ 0 & b \end{pmatrix}\end{split}\]

where a and b are complex numbers.

See also

Operator, Projector0, Projector1

Parameters:
  • a (complex) – The top-left entry of the diagonal matrix.

  • b (complex) – The bottom-right entry of the diagonal matrix.

Examples

>>> from mimiqcircuits import *
>>> op = DiagonalOp(1, 0.5)
>>> c = Circuit()
>>> c.push(ExpectationValue(DiagonalOp(1, 0.5)), 1, 2)
2-qubit, 3-zvar circuit with 1 instruction:
└── ⟨D(1, 0.5)⟩ @ q[1], z[2]
__init__(a, b)[source]
property parnames
rescale(scale)[source]

Return a new rescaled DiagonalOp operator.

rescale_inplace(scale)[source]

In-place rescaling of the DiagonalOp operator.

opsquared()[source]

Return the operator with each parameter squared.