qib.operator.pauli_operator.WeightedPauliString

class qib.operator.pauli_operator.WeightedPauliString(paulis: PauliString, weight)[source]

Bases: AbstractOperator

Pauli string with a weight factor.

Methods

as_matrix

Generate the sparse matrix representation of the weighted Pauli string.

commutes_with

Test whether the weighted Pauli string commutes with another weighted Pauli string.

fields

List of fields the weighted Pauli string acts on.

is_hermitian

Whether the operator is Hermitian.

is_unitary

Whether the operator is unitary.

set_field

Set a field which the weighted Pauli string acts on (such that it can be used like a Hamiltonian).

Attributes

num_qubits

Number of qubits, i.e., length of Pauli string, including identities.

as_matrix()[source]

Generate the sparse matrix representation of the weighted Pauli string.

commutes_with(other)[source]

Test whether the weighted Pauli string commutes with another weighted Pauli string.

fields()[source]

List of fields the weighted Pauli string acts on.

is_hermitian()[source]

Whether the operator is Hermitian.

is_unitary()[source]

Whether the operator is unitary.

property num_qubits

Number of qubits, i.e., length of Pauli string, including identities.

set_field(field: Field)[source]

Set a field which the weighted Pauli string acts on (such that it can be used like a Hamiltonian).