Skip to main content
Functions:
NameDescription
qsvt_step[Qmod Classiq-library function].
qsvt[Qmod Classiq-library function].
projector_controlled_phase[Qmod Classiq-library function].
qsvt_inversion[Qmod Classiq-library function].
projector_controlled_double_phase[Qmod Classiq-library function].
qsvt_lcu_step[Qmod Classiq-library function].
qsvt_lcu[Qmod Classiq-library function].
gqspImplements Generalized Quantum Signal Processing (GQSP), which realizes a (Laurent) polynomial transformation of degree d on the eigenvalues of the…

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:
NameTypeDescriptionDefault
phase1CReal1st rotation phase.required
phase2CReal2nd rotation phase.required
proj_cnot_1QCallable[QBit]Projector-controlled-not unitary that locates the encoded matrix columns within U. Accepts a qubit that should be set to `|1>` when the state is in the block.required
proj_cnot_2QCallable[QBit]Projector-controlled-not unitary that locates the encoded matrix rows within U. Accepts a qubit that should be set to `|1>` when the state is in the block.required
uQCallableA block encoding unitary matrix.required
auxQBitA zero auxilliary qubit, used for the projector-controlled-phase rotations. Given as an inout so that qsvt can be used as a building-block in a larger algorithm.required

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:
NameTypeDescriptionDefault
phase_seqCArray[CReal]A sequence of phase angles of length d+1.required
proj_cnot_1QCallable[QBit]Projector-controlled-not unitary that locates the encoded matrix columns within U. Accepts a qubit that should be set to `|1>` when the state is in the block.required
proj_cnot_2QCallable[QBit]Projector-controlled-not unitary that locates the encoded matrix rows within U. Accepts a qubit that should be set to `|1>` when the state is in the block.required
uQCallableA block encoding unitary matrix.required
auxQBitA zero auxilliary qubit, used for the projector-controlled-phase rotations. Given as an inout so that qsvt can be used as a building-block in a larger algorithm.required

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:
NameTypeDescriptionDefault
phaseCRealA rotation phase.required
proj_cnotQCallable[QBit]Projector-controlled-not unitary that sets an auxilliary qubit to `|1>` when the state is in the projection.required
auxQBitA zero auxilliary qubit, used for the projector-controlled-phase rotation.required

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:
NameTypeDescriptionDefault
phase_seqCArray[CReal]A sequence of phase angles of length d+1, corresponding to an odd polynomial approximation of the scaled inverse function.required
block_encoding_cnotQCallable[QBit]Projector-controlled-not unitary that locates the encoded matrix columns within U. Accepts a quantum variable that should be set to `|1>` when the state is in the block.required
uQCallableA block encoding unitary matrix.required
auxQBitA zero auxilliary qubit, used for the projector-controlled-phase rotations. Given as an inout so that qsvt can be used as a building-block in a larger algorithm.required

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:
NameTypeDescriptionDefault
phase_evenCRealRotation phase, corresponds to ‘lcu’=0.required
phase_oddCRealRotation phase, corresponds to ‘lcu’=1.required
proj_cnotQCallable[QBit]Projector-controlled-not unitary that sets an auxilliary qubit to `|1>` when the state is in the projection.required
auxQBitA zero auxilliary qubit, used for the projector-controlled-phase rotation. Given as an inout so that qsvt can be used as a building-block in a larger algorithm.required
lcuQBitThe quantum variable used for controlling the phase assignment.required

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:
NameTypeDescriptionDefault
phases_evenCArray[CReal]2 rotation phases for the even polynomialrequired
phases_oddCArray[CReal]2 rotation phases for the odd polynomialrequired
proj_cnot_1QCallable[QBit]Projector-controlled-not unitary that locates the encoded matrix columns within U. Accepts a qubit that should be set to `|1>` when the state is in the block.required
proj_cnot_2QCallable[QBit]Projector-controlled-not unitary that locates the encoded matrix rows within U. Accepts a qubit that should be set to `|1>` when the state is in the block.required
uQCallableA block encoding unitary matrix.required
auxQBitA zero auxilliary qubit, used for the projector-controlled-phase rotations. Given as an inout so that qsvt can be used as a building-block in a larger algorithm.required
lcuQBitA qubit used for the combination of 2 polynomials within a single qsvt applicationrequired

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:
NameTypeDescriptionDefault
phase_seq_evenCArray[CReal]A sequence of phase angles of length d+(d+1)%2 for the even polynomial.required
phase_seq_oddCArray[CReal]A sequence of phase angles of length d+(d%2) for the odd polynomial.required
proj_cnot_1QCallable[QBit]Projector-controlled-not unitary that locates the encoded matrix columns within U. Accepts a qubit that should be set to `|1>` when the state is in the block.required
proj_cnot_2QCallable[QBit]Projector-controlled-not unitary that locates the encoded matrix rows within U. Accepts a qubit that should be set to `|1>` when the state is in the block.required
uQCallableA block encoding unitary matrix.required
auxQBitA zero auxilliary qubit, used for the projector-controlled-phase rotations. Given as an inout so that qsvt can be used as a building-block in a larger algorithm.required
lcuQBitA qubit used for the combination of 2 polynomials within a single qsvt applicationrequired

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:
NameTypeDescriptionDefault
uQCallableThe signal unitary.required
auxQBitAuxiliary qubit used for the phase rotations. Should start in `|0>`.required
phasesCArray[CArray[CReal, Literal[3]]](d+1) x 3 real array of angles: each element is (theta, phi, lambda).required
negative_powerCIntInteger m in [0, d]. Encodes the minimal Laurent power -m of the realized transformation.required