quiche.core#

Core data structures for quantum primites, routines and errors.

Pauli operators#

Quantum primitives and data structures.

class Pauli(*values)#

Single-qubit Pauli operators.

class PauliWord(*, terms, qubits)#

Multi-qubit tensor products of Pauli operators.

model_config = {'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

check_nonzero_lengths()#

Validate number of terms and number of qubits is nonzero.

Return type:

Self

check_lengths_match()#

Validate number of terms and number of qubits.

Return type:

Self

check_qubits_unique()#

Validate each target qubit appears at most once.

Return type:

Self

property greatest_qubit: int#

Identify highest index qubit included in targets.

to_str(length=None, *, big_endian)#

Get the string representation of a PauliWord for a given register size.

Endianness must be explicitly set with the big_endian arg:

Big endian:    |psi> = |q_0, q_1, q_2, ..., q_n>
Little endian: |psi> = |q_n, ..., q_2, q_1, q_0>
Return type:

str

to_cirq(length)#

Get dense cirq representation of a PauliWord.

Return type:

DensePauliString

to_quest(length)#

Get the QuEST representation of a PauliWord.

Return type:

PauliStr

class PauliSum(*, coefficients, terms, identity_coefficient=0.0)#

Linear combinations of multi-qubit Pauli operators.

model_config = {'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

check_nonzero_lengths()#

Validate number of terms is nonzero.

Return type:

Self

check_lengths_match()#

Validate number of terms and coefficients match.

Return type:

Self

check_for_zero_coefficients()#

Validate linear combination has no zero coefficient terms.

Return type:

Self

property n_qubits: int#

Get the number of qubits targeted by all the operators.

property has_identity: bool#

Whether the identity term contributes to the operator.

property n_terms: int#

Get number of terms in linear combination.

property n_terms_with_identity: int#

Get the number of terms including the identity if non-zero.

property lam: float#

Get the 1-norm of the operator.

without_identity()#

Get a copy of the PauliSum with the identity coefficient zeroed.

Return type:

PauliSum

split_identity()#

Get the identity coefficient and the remaining terms separately.

Return type:

tuple[float, PauliSum]

to_quest()#

Get the QuEST representation of a PauliSum.

Will raise if called outside of a QuESTEnv.

Return type:

PauliStrSum

Electronic systems#

Structures for specifying electronic systems.

class ElectronicHamiltonian(electrons, mapping, paulis)#

Class encompassing a physical electronic Hamiltonian.

class SecondQuantisedHamiltonian(*, one_body, two_body, electrons, core_energy=0.0)#

Class encompassing a second quantisation electronic Hamiltonian.

One body integrals are indexed h[p, q] and two body integrals are in chemist notation, h[p, q, r, s] = (pq|rs), over spatial orbitals.

model_config = {'arbitrary_types_allowed': True, 'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod as_immutable_array(value)#

Coerce the integrals to an immutable real float array.

Return type:

ndarray[tuple[Any, …], dtype[float64]]

check_dims()#

Validate the integral tensors have correct number of dimensions.

Return type:

Self

check_shapes()#

Validate the integral tensors are square and mutually consistent.

Return type:

Self

check_electrons()#

Validate the electron count fits in the given orbital space.

Return type:

Self

property num_spatial_orbitals: int#

Get the number of spatial molecular orbitals.

property num_spin_orbitals: int#

Get the number of spin orbitals.

to_qubit_hamiltonian(mapping)#

Get the qubit Hamiltonian after applying fermion-to-qubit mapping.

Return type:

ElectronicHamiltonian

Algorithms#

Structures for specifying quantum algorithms and routines.

class PhaseEstimation(*values)#

Quantum algorithm to perform phase estimation.

class Simulation(*values)#

Hamiltonian simulation algorithm for phase estimation algorithms.

class Mapping(*values)#

Fermion-to-Qubit mappings.

Errors#

Structures for specifying calculation error sources.

class Errors(estimation, simulation, rotations, state_prep, overlap)#

Error budget tracker for approximate quantum methods.