ofex.propagator

This module provides Hamiltonian propagators for both real time evolution (RTE) and imaginary time evolution (ITE). It includes exact and trotterized approaches for the simulation of quantum systems.

ofex.propagator.exact_rte(ham: QubitOperator | ndarray | spmatrix, t: float, n_qubits: int | None = None, exact_sparse=False) spmatrix | ndarray[source]

Compute the real-time evolution operator for a given Hamiltonian.

Parameters:
  • ham (Union[QubitOperator, np.ndarray, spmatrix]) – The Hamiltonian operator.

  • t (float) – The evolution time parameter.

  • n_qubits (Optional[int]) – The number of qubits, required in some cases to determine the matrix dimensions.

  • exact_sparse (bool) – If True, converts a sparse matrix to dense for exact exponential computation. Defaults to False.

Returns:

The resulting matrix exponential representing the time evolution operator.

Return type:

Union[spmatrix, np.ndarray]

ofex.propagator.exact_ite(ham: QubitOperator | ndarray | spmatrix, beta: float, n_qubits: int | None = None, exact_sparse=False) spmatrix | ndarray[source]

Compute the imaginary-time evolution operator for a given Hamiltonian.

Parameters:
  • ham (Union[QubitOperator, np.ndarray, spmatrix]) – The Hamiltonian operator.

  • beta (float) – The evolution parameter, representing inverse temperature.

  • n_qubits (Optional[int]) – The number of qubits, required in some cases to determine the matrix dimensions.

  • exact_sparse (bool) – If True, converts a sparse matrix to dense for exact exponential computation. Defaults to False.

Returns:

The resulting matrix exponential representing the imaginary-time evolution operator.

Return type:

Union[spmatrix, np.ndarray]

ofex.propagator.trotter_rte_by_si_ref(ham: QubitOperator, t: float, n_qubits: int, n_trotter: int, exact_sparse: bool = False)[source]

Perform real-time evolution using the Suzuki-Trotter decomposition with sorted insertion and a reflective strategy.

The reflective approach is more efficient for classical simulation compared to the commuting grouping strategy.

Parameters:
  • ham (QubitOperator) – The Hamiltonian operator.

  • t (float) – The evolution time parameter.

  • n_qubits (int) – The total number of qubits in the system.

  • n_trotter (int) – The number of Trotter steps for the decomposition.

  • exact_sparse (bool, optional) – If True, use an exact sparse matrix representation for computation. Defaults to False.

Returns:

The evolution operator.

Return type:

ndarray or spmatrix

ofex.propagator.trotter_rte_by_si_comm(ham: QubitOperator, t: float, n_qubits: int, n_trotter: int, exact_sparse: bool = False)[source]

Perform real-time evolution using the Suzuki-Trotter decomposition with sorted insertion and commuting terms grouping.

Parameters:
  • ham (QubitOperator) – The Hamiltonian operator.

  • t (float) – The evolution time parameter.

  • n_qubits (int) – The total number of qubits in the system.

  • n_trotter (int) – The number of Trotter steps for the decomposition.

  • exact_sparse (bool, optional) – If True, use an exact sparse matrix representation for computation. Defaults to False.

Returns:

The evolution operator.

Return type:

ndarray or spmatrix

ofex.propagator.trotter_rte_by_single_pauli(ham: QubitOperator, t: float, n_qubits: int, n_trotter: int, exact_sparse: bool = False)[source]

Perform real-time evolution using the Suzuki-Trotter decomposition with a single Pauli operator ordering.

Parameters:
  • ham (QubitOperator) – The Hamiltonian operator.

  • t (float) – The evolution time parameter.

  • n_qubits (int) – The total number of qubits in the system.

  • n_trotter (int) – The number of Trotter steps for the decomposition.

  • exact_sparse (bool, optional) – If True, use an exact sparse matrix representation for computation. Defaults to False.

Returns:

The evolution operator.

Return type:

ndarray or spmatrix

ofex.propagator.trotter_ite_by_si_ref(ham: QubitOperator, beta: float, n_qubits: int, n_trotter: int, exact_sparse: bool = False)[source]

Perform imaginary-time evolution using the Suzuki-Trotter decomposition with sorted insertion and a reflective strategy.

The reflective approach is more efficient for classical simulation compared to the commuting grouping strategy.

Parameters:
  • ham (QubitOperator) – The Hamiltonian operator.

  • beta (float) – Imaginary time evolution parameter.

  • n_qubits (int) – The total number of qubits in the system.

  • n_trotter (int) – The number of Trotter steps for the decomposition.

  • exact_sparse (bool, optional) – If True, use an exact sparse matrix representation for computation. Defaults to False.

Returns:

The evolution operator.

Return type:

ndarray or spmatrix

ofex.propagator.trotter_ite_by_si_comm(ham: QubitOperator, beta: float, n_qubits: int, n_trotter: int, exact_sparse: bool = False)[source]

Perform imaginary-time evolution using the Suzuki-Trotter decomposition with sorted insertion and commuting terms grouping.

Parameters:
  • ham (QubitOperator) – The Hamiltonian operator.

  • beta (float) – Imaginary time evolution parameter.

  • n_qubits (int) – The total number of qubits in the system.

  • n_trotter (int) – The number of Trotter steps for the decomposition.

  • exact_sparse (bool, optional) – If True, use an exact sparse matrix representation for computation. Defaults to False.

Returns:

The evolution operator.

Return type:

ndarray or spmatrix

ofex.propagator.trotter_ite_by_single_pauli(ham: QubitOperator, beta: float, n_qubits: int, n_trotter: int, exact_sparse: bool = False)[source]

Perform imaginary-time evolution using the Suzuki-Trotter decomposition with a single Pauli operator ordering.

Parameters:
  • ham (QubitOperator) – The Hamiltonian operator.

  • beta (float) – Imaginary time evolution parameter.

  • n_qubits (int) – Number of qubits.

  • n_trotter (int) – The number of Trotter steps.

  • exact_sparse (bool, optional) – Flag to indicate if exact sparse matrix representation should be used. Defaults to False.

Returns:

The resulting matrix after simulation.

Return type:

ndarray or spmatrix