pygsti.extras.idletomography.pauliobjs.NQPauliOp#

class NQPauliOp(string_rep, sign=1)#

Bases: object

A N-qubit pauli operator, consisting of a 1-qubit Pauli operation on each qubits.

Create a NQPauliOp.

Parameters:
  • string_rep (str) – A string with letters in {I,X,Y,Z}, specifying the Pauli operator for each qubit.

  • sign ({1, -1}) – An overall sign (prefactor) for this operator.

Methods

__init__(string_rep[, sign])

Create a NQPauliOp.

commuteswith(other)

Determine whether this operator commutes (or anticommutes) with other.

dot(other)

Computes the Hilbert-Schmidt dot product (normed to 1) between this Pauli operator and other.

icommutator_over_2(other)

Compute i[self, other]/2 where [,] is the commutator.

statedot(state)

Computes a dot product between state and this operator.

subpauli(indices)

Returns a new NQPauliOp object which sets all (1-qubit) operators to "I" except those in indices, which remain as they are in this object.

weight_1_pauli(n, i, pauli)

Creates a n-qubit Pauli operator with the Pauli indexed by pauli in location i.

weight_2_pauli(n, i, j, pauli1, pauli2)

Creates a n-qubit Pauli operator with the Paulis indexed by pauli1 and pauli2 in locations i and j respectively.

commuteswith(other)#

Determine whether this operator commutes (or anticommutes) with other.

Parameters:

other (NQPauliOp)

Return type:

bool

dot(other)#

Computes the Hilbert-Schmidt dot product (normed to 1) between this Pauli operator and other.

Parameters:

other (NQPauliOp) – The other operator to take a dot product with.

Returns:

Either 0, 1, or -1.

Return type:

integer

icommutator_over_2(other)#

Compute i[self, other]/2 where [,] is the commutator.

Parameters:

other (NQPauliOp or NQPauliState) – The operator to take a commutator with. A NQPauliState is treated as an operator (i.e. ‘X’ basis state => ‘X’ Pauli operation) with sign given by the product of its 1-qubit basis signs.

Return type:

NQPauliOp

statedot(state)#

Computes a dot product between state and this operator. (note that an X-basis ‘+’ state is represented by (I+X) not just X)

Parameters:

state (NQPauliState)

Return type:

int

subpauli(indices)#

Returns a new NQPauliOp object which sets all (1-qubit) operators to “I” except those in indices, which remain as they are in this object.

Parameters:

indices (iterable) – A sequence of integer indices between 0 and N-1, where N is the number of qubits in this pauli operator.

Return type:

NQPauliOp

classmethod weight_1_pauli(n, i, pauli)#

Creates a n-qubit Pauli operator with the Pauli indexed by pauli in location i.

Parameters:
  • n (int) – The number of qubits

  • i (int) – The index of the single non-trivial Pauli operator.

  • pauli (int) – An integer 0 <= P <= 2 indexing the non-trivial Pauli at location i as follows: 0=’X’, 1=’Y’, 2=’Z’.

Return type:

NQPauliOp

classmethod weight_2_pauli(n, i, j, pauli1, pauli2)#

Creates a n-qubit Pauli operator with the Paulis indexed by pauli1 and pauli2 in locations i and j respectively.

Parameters:
  • n (int) – The number of qubits

  • i (int) – The indices of the non-trivial Pauli operators.

  • j (int) – The indices of the non-trivial Pauli operators.

  • pauli1 (int) – Integers 0 <= pauli <= 2 indexing the non-trivial Paulis at locations i and j, respectively, as follows: 0=’X’, 1=’Y’, 2=’Z’.

  • pauli2 (int) – Integers 0 <= pauli <= 2 indexing the non-trivial Paulis at locations i and j, respectively, as follows: 0=’X’, 1=’Y’, 2=’Z’.

Return type:

NQPauliOp