Skip to content
Construct PsiQDK Algorithms

dyson_utils

dyson_utils

DysonSelectStrategyNaive

DysonSelectStrategyNaive(truncation: int, fast_forward_exp: Qubrick, hamiltonian: PauliSum, block_encoding: Qubrick)

A helper class to apply an operator of the form \(\exp(-iH_0 t)V \exp(iH_0 t)\).

Parameters:

Name Type Description Default
truncation int

a value of the truncation parameter.

required
fast_forward_exp Qubrick

a fast-forwardable part \(\exp(-iH_0 t)\) of a Hamiltonian to simulate.

required
hamiltonian PauliSum

a block-encoded part \(BE(V)\) of a Hamiltonian to simulate.

required
block_encoding Qubrick

a block-encoding/LCU subroutine.

required

truncation property

truncation

Getter for the truncation parameter.

hamiltonian property

hamiltonian

Getter for the block-encoded part of a Hamiltonian to simulate.

fast_forward_exp property

fast_forward_exp

Getter for the fast-forwardable part of the Hamiltonian.

block_encoding property

block_encoding

Getter for the block encoding subroutine.

apply_compression_gadget_block_encoding

apply_compression_gadget_block_encoding(register: DysonSeriesBinaryIndex, idx: int, ctrl: Qubits | int = 0)

Apply the Hamiltonian operator to the system register.

Parameters:

Name Type Description Default
register CompositeRegister

a composite register for Dyson Series.

required
idx int

an index of the time iteration for the time discretization register.

required
ctrl (Qubits, int)

a register to control this operation on. Default to 0.

0

DysonSeriesBinaryIndex dataclass

DysonSeriesBinaryIndex(trunc_reg: Qubits, discret_reg: list[Qubits], be_anc: Qubits, system_reg: Qubits, name: str)

Bases: CompositeRegister

Dataclass for the binary Dyson Series Composite Register.

trunc_reg instance-attribute

trunc_reg: Qubits

discret_reg instance-attribute

discret_reg: list[Qubits]

be_anc instance-attribute

be_anc: Qubits

system_reg instance-attribute

system_reg: Qubits

name instance-attribute

name: str

initialize classmethod

initialize(qc, name, trunc_param: int, t_disc_param: int, syst: int | Qubits, n_be_anc: int | list)

The binary Dyson Series Expansion composite index register.

Parameters:

Name Type Description Default
qc QPU

A QPU instance.

required
name str

The name of composite register.

required
trunc_param int

Truncation parameter.

required
t_disc_param int

Time-discretization parameter.

required
syst int | Qubits

The system register an operator is applied to.

required
n_be_anc int | list

A register for the operator block encoding.

required

DysonSeriesData dataclass

DysonSeriesData(discretization: int, truncation: int, collision: bool, hamiltonian: PauliSum, t0: float)

Dataclass for the DysonSeriesLCU Qubrick.

Parameters:

Name Type Description Default
discretization int

The time discretization value.

required
truncation int

The truncation bound value.

required
collision bool

Whether to flag a (time) collision in the time register.

required
hamiltonian PauliSum

A time independent part of the Hamiltinian to simulate.

required
t0 float

A time interval to simulate a Hamiltinian.

required

discretization instance-attribute

discretization: int

truncation instance-attribute

truncation: int

collision instance-attribute

collision: bool

hamiltonian instance-attribute

hamiltonian: PauliSum

t0 instance-attribute

t0: float

probabilities

probabilities()

Return the normalized probabilities for the state preparation routine.

DysonSeriesUnaryIndex dataclass

DysonSeriesUnaryIndex(trunc_reg: Qubits, discret_reg: list[Qubits], be_anc: Qubits, system_reg: Qubits, t_disc_param: int, name: str)

Bases: CompositeRegister

Dataclass for the unary Dyson Series Composite Register.

trunc_reg instance-attribute

trunc_reg: Qubits

discret_reg instance-attribute

discret_reg: list[Qubits]

be_anc instance-attribute

be_anc: Qubits

system_reg instance-attribute

system_reg: Qubits

t_disc_param instance-attribute

t_disc_param: int

name instance-attribute

name: str

initialize classmethod

initialize(qc, name, trunc_param: int, t_disc_param: int, syst: int | Qubits, n_be_anc: int | list)

The unary Dyson Series Expansion composite index register.

Parameters:

Name Type Description Default
qc QPU

A QPU instance.

required
name str

The name of composite register.

required
trunc_param int

Truncation parameter.

required
t_disc_param int

Time-discretization parameter.

required
syst int | Qubits

The system register an operator is applied to.

required
n_be_anc int | list

A register for the operator block encoding.

required

dyson_series_numpy

dyson_series_numpy(trunc_param, t_disc_param, t, H0, V, flag_collision)

Compute the matrix representation of the (K, M)-Dyson series.

Computes the matrix representation of the K-truncated & M-discretized Dyson series:

\[\sum_{k = 0}^{K} (\frac{- i t}{k! M})^k (k! B_k + C_k)\]

Here

\[B_k = \sum_{0 \le m_1 < m_2 < ... < m_k < M} \prod_{j=1}^{k} \exp{(i H_0 t m_i/ M)} V \exp{(- iH_0 t m_i/ M)}\]

and \(C_k = 0\) if one desires to exclude the collisions. To keep the collisions, \(C_k\) captures terms simuilar to \(B_k\) but where at least one pair of indices \(m_j = m_d\) collide for \(j \neq d\). See eq.16 in "Hamiltonian Simulation in the Interaction Picture" (arXiv:1805.00675 ⧉).

Parameters:

Name Type Description Default
trunc_param int

Truncation.

required
t_disc_param int

Discretization.

required
t float

Time.

required
H0 ndarray

Hermitian operator (diagonal operator, time dependent).

required
V ndarray

Hermitian operator (offdiagonal operator, time independent).

required
flag_collision bool

If flag_collision == True, the collisions will be flagged and the flag being in the 0 states excludes the collisions (\(C_k = 0\)). If flag_collision == False, the collisions will not be flagged and thus, will be included (\(C_k \neq 0\)).

required

Returns:

Type Description
ndarray

the matrix representation of the (trunc_param, t_disc_param)-Dyson series.

dyson_target_prob

dyson_target_prob(t0, cutoff)

Compute the normalized probabilities for the state preparation routine (Dyson Series).

Parameters:

Name Type Description Default
t0 float

Time step.

required
cutoff int

Cutoff of the Dyson series.

required

evaluate_ham

evaluate_ham(t, H0, V)

Evaluate the operator of the form \(V(t)=\exp(iH_0t)V\exp(-iH_0t)\).

Parameters:

Name Type Description Default
t float

Evolution time.

required
H0 array

Matrix representation of the fast-forwardable part of the Hamiltonian.

required
V array

Matrix representation of the perturbation part of the Hamiltonian.

required

Returns:

Type Description
array

The result of evaluating the operator \(V(t)\).

norm_beta

norm_beta(t0, cutoff)

Compute normalization beta (Dyson series).

Parameters:

Name Type Description Default
t0 float

Time step.

required
cutoff int

Cutoff of the Dyson series.

required

num_qubits_DysonSeriesExpansionIndex

num_qubits_DysonSeriesExpansionIndex(trunc_param, t_disc_param, syst, n_be_anc, reg_type='unary') -> int

Calculate the total size of the Dyson register.

Parameters:

Name Type Description Default
trunc_param int

Truncation parameter.

required
t_disc_param int

Time-discretization parameter

required
n_be_anc int

Size of the register for block-encoding ancilla qubits.

required
syst int | Qubits

The system register an operator is applied to.

required
reg_type str

Type of the truncation register of the Dyson Series (unary or binary).

'unary'

Returns:

Type Description
int

The total number of qubits required for the Dyson Series expansion.