Phase#

from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register
from qualtran import QBit, QInt, QUInt, QAny
from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma
from typing import *
import numpy as np
import sympy
import cirq

Phase#

Apply a phase to a block encoding.

Given \(B[A]\) as a \((\alpha, a, \epsilon)\)-block encoding of \(A\), produces a \((\alpha, a, \epsilon)\)-block encoding of \(\exp(i\pi\phi)A\).

Parameters#

  • block_encoding: The block encoding to apply a phase to.

  • phi: The phase angle.

  • eps: The precision of the phase angle.

Registers#

  • system: The system register.

  • ancilla: The ancilla register (present only if bitsize > 0).

  • resource: The resource register (present only if bitsize > 0).

from qualtran.bloqs.block_encoding import Phase

Example Instances#

from qualtran.bloqs.basic_gates import Hadamard
from qualtran.bloqs.block_encoding.unitary import Unitary

phase_block_encoding = Phase(Unitary(Hadamard()), phi=0.25, eps=0)

Graphical Signature#

from qualtran.drawing import show_bloqs
show_bloqs([phase_block_encoding],
           ['`phase_block_encoding`'])

Call Graph#

from qualtran.resource_counting.generalizers import ignore_split_join
phase_block_encoding_g, phase_block_encoding_sigma = phase_block_encoding.call_graph(max_depth=1, generalizer=ignore_split_join)
show_call_graph(phase_block_encoding_g)
show_counts_sigma(phase_block_encoding_sigma)
../../_images/5a66d619d44266b0854b26899dbfe021eea9fb962eef3cb36503fee655241734.svg

Counts totals:

  • B[H]: 1

  • GPhase((0.7071067811865476+0.7071067811865475j)): 1