Skip to main content
Functions:

qsvt_step

qsvt_step(
phase1: CReal,
phase2: CReal,
proj_cnot_1: QCallable[QBit],
proj_cnot_2: QCallable[QBit],
u: QCallable,
aux: QBit
) -> None
[Qmod Classiq-library function] Applies a single QSVT step, composed of 2 projector-controlled-phase rotations, and applications of the block encoding unitary u and its inverse: Πϕ2UΠ~ϕ1U\Pi_{\phi_2}U^{\dagger}\tilde{\Pi}_{\phi_{1}}U Parameters:

qsvt

qsvt(
phase_seq: CArray[CReal],
proj_cnot_1: QCallable[QBit],
proj_cnot_2: QCallable[QBit],
u: QCallable,
aux: QBit
) -> None
[Qmod Classiq-library function] Implements the Quantum Singular Value Transformation (QSVT) - an algorithmic framework, used to apply polynomial transformations of degree d on the singular values of a block encoded matrix, given as the unitary u. Given a unitary UU, a list of phase angles ϕ1,ϕ2,...,ϕ{d+1}\phi_1, \phi_2, ..., \phi_\{d+1\} and 2 projector-controlled-not operands C{Π}NOT,C{{~Π}}NOTC_\{\Pi\}NOT,C_\{\tilde\{\Pi\}\}NOT, the QSVT sequence is as follows: Given a unitary UU, a list of phase angles ϕ1,ϕ2,...,ϕ{d+1}\phi_1, \phi_2, ..., \phi_\{d+1\} and 2 projector-controlled-not operands C{Π}NOT,C{{~Π}}NOTC_\{\Pi\}NOT,C_\{\tilde\{\Pi\}\}NOT, the QSVT sequence is as follows: Π~ϕd+1Uk=1(d1)/2(Πϕd2kUΠ~ϕd(2k+1)U)Πϕ1\tilde{\Pi}_{\phi_{d+1}}U \prod_{k=1}^{(d-1)/2} (\Pi_{\phi_{d-2k}} U^{\dagger}\tilde{\Pi}_{\phi_{d - (2k+1)}}U)\Pi_{\phi_{1}} for odd dd, and: k=1d/2(Πϕd(2k1)UΠ~ϕd2kU)Πϕ1\prod_{k=1}^{d/2} (\Pi_{\phi_{d-(2k-1)}} U^{\dagger}\tilde{\Pi}_{\phi_{d-2k}}U)\Pi_{\phi_{1}} for even dd. Each of the Π\Pis is a projector-controlled-phase unitary, according to the given projectors. Parameters:

projector_controlled_phase

projector_controlled_phase(
phase: CReal,
proj_cnot: QCallable[QBit],
aux: QBit
) -> None
[Qmod Classiq-library function] Assigns a phase to the entire subspace determined by the given projector. Corresponds to the operation: \Pi_{\phi} = (C_{\Pi}NOT) e^{-i rac{\phi}{2}Z}(C_{\Pi}NOT) Parameters:

qsvt_inversion

qsvt_inversion(
phase_seq: CArray[CReal],
block_encoding_cnot: QCallable[QBit],
u: QCallable,
aux: QBit
) -> None
[Qmod Classiq-library function] Implements matrix inversion on a given block-encoding of a square matrix, using the QSVT framework. Applies a polynomial approximation of the inverse of the singular values of the matrix encoded in u. The phases for the polynomial should be pre-calculated and passed into the function. Parameters:

projector_controlled_double_phase

projector_controlled_double_phase(
phase_even: CReal,
phase_odd: CReal,
proj_cnot: QCallable[QBit],
aux: QBit,
lcu: QBit
) -> None
[Qmod Classiq-library function] Assigns 2 phases to the entire subspace determined by the given projector, each one is controlled differentely on a given lcu qvar. Used in the context of the qsvt_lcu function. Corresponds to the operation: Πϕodd,ϕeven=(CΠNOT)(Clcu=1eiϕeven2Z)(Clcu=0eiϕodd2Z)(CΠNOT)\Pi_{\phi_{odd}, \phi_{even}} = (C_{\Pi}NOT) (C_{lcu=1}e^{-i\frac{\phi_{even}}{2}Z}) (C_{lcu=0}e^{-i\frac{\phi_{odd}}{2}Z}) (C_{\Pi}NOT) Parameters:

qsvt_lcu_step

qsvt_lcu_step(
phases_even: CArray[CReal],
phases_odd: CArray[CReal],
proj_cnot_1: QCallable[QBit],
proj_cnot_2: QCallable[QBit],
u: QCallable,
aux: QBit,
lcu: QBit
) -> None
[Qmod Classiq-library function] Applies a single QSVT-lcu step, composed of 2 double phase projector-controlled-phase rotations, and applications of the block encoding unitary u and its inverse: (Clcu=1Πϕ2even)(Clcu=0Πϕ2odd)U(Clcu=1Π~ϕ1even)(Clcu=0Π~ϕ1odd)U(C_{lcu=1}\Pi^{even}_{\phi_2})(C_{lcu=0}\Pi^{odd}_{\phi_2})U^{\dagger}(C_{lcu=1}\tilde{\Pi}^{even}_{\phi_1})(C_{lcu=0}\tilde{\Pi}^{odd}_{\phi_1})U Parameters:

qsvt_lcu

qsvt_lcu(
phase_seq_even: CArray[CReal],
phase_seq_odd: CArray[CReal],
proj_cnot_1: QCallable[QBit],
proj_cnot_2: QCallable[QBit],
u: QCallable,
aux: QBit,
lcu: QBit
) -> None
[Qmod Classiq-library function] Implements the Quantum Singular Value Transformation (QSVT) for a linear combination of odd and even polynomials, so that it is possible to encode a polynomial of indefinite parity, such as approximation to exp(i*A) or exp(A). Should work for Hermitian block encodings. The function is equivalent to applying the qsvt function for odd and even polynomials with a LCU function, but is more efficient as the two polynomials share the same applications of the given unitary. The function is intended to be called within a context of LCU, where it is called as the SELECT operator, and wrapped with initialization of the lcu qubit to get the desired combination coefficients. The even polynomial corresponds to the case where the lcu=0lcu=|0\rangle, while the odd to lcu=1lcu=|1\rangle. Note: the two polynomials should have the same degree up to a difference of 1. Parameters:

gqsp

gqsp(
u: QCallable,
aux: QBit,
phases: CArray[CArray[CReal, Literal[3]]],
negative_power: CInt
) -> None
Implements Generalized Quantum Signal Processing (GQSP), which realizes a (Laurent) polynomial transformation of degree d on the eigenvalues of the given signal unitary u. The protocol is according to https://arxiv.org/abs/2308.01501 Fig.2. Notes:
  • The user is encouraged to use the function gqsp_phases to find phases that correspond to the wanted polynomial transformation.
  • Feasibility: the target polynomial must satisfy P(e{itheta})|P(e^\{i*theta\})| <= 1 for all theta in [0,2pi)[0, 2*pi). This ensures a unitary completion exists.
  • Using negative_power = m (m >= 0) you can realize Laurent polynomials with negative exponents: the implemented transform is equivalent to applying z{m}P(z)z^\{-m\} * P(z) (i.e., shift the minimal degree to -m). For ordinary (non-Laurent) polynomials, set negative_power = 0.
Parameters: