|
35 | 35 | class QubitizationWalkOperator(GateWithRegisters): |
36 | 36 | r"""Constructs a Szegedy Quantum Walk operator using LCU oracles SELECT and PREPARE. |
37 | 37 |
|
| 38 | + For a Hamiltonian $H = \sum_l w_l H_l$ (s.t. $w_l > 0$ and $H_l$ are unitaries), |
38 | 39 | Constructs a Szegedy quantum walk operator $W = R_{L} . SELECT$, which is a product of |
39 | 40 | two reflections $R_{L} = (2|L><L| - I)$ and $SELECT=\sum_{l}|l><l|H_{l}$. |
40 | 41 |
|
41 | 42 | The action of $W$ partitions the Hilbert space into a direct sum of two-dimensional irreducible |
42 | 43 | vector spaces. For an arbitrary eigenstate $|k>$ of $H$ with eigenvalue $E_k$, $|\ell>|k>$ and |
43 | 44 | an orthogonal state $\phi_{k}$ span the irreducible two-dimensional space that $|\ell>|k>$ is |
44 | 45 | in under the action of $W$. In this space, $W$ implements a Pauli-Y rotation by an angle of |
45 | | - $-2arccos(E_{k} / \lambda)$ s.t. $W = e^{i arccos(E_k / \lambda) Y}$. |
| 46 | + $-2arccos(E_{k} / \lambda)$ s.t. $W = e^{i arccos(E_k / \lambda) Y}$, |
| 47 | + where $\lambda = \sum_l w_l$. |
46 | 48 |
|
47 | 49 | Thus, the walk operator $W$ encodes the spectrum of $H$ as a function of eigenphases of $W$ |
48 | 50 | s.t. $spectrum(H) = \lambda cos(arg(spectrum(W)))$ where $arg(e^{i\phi}) = \phi$. |
@@ -92,6 +94,11 @@ def signature(self) -> Signature: |
92 | 94 | def reflect(self) -> ReflectionUsingPrepare: |
93 | 95 | return ReflectionUsingPrepare(self.prepare, control_val=self.control_val, global_phase=-1) |
94 | 96 |
|
| 97 | + @cached_property |
| 98 | + def sum_of_lcu_coefficients(self) -> Optional[float]: |
| 99 | + r"""value of $\lambda$, i.e. sum of absolute values of coefficients $w_l$.""" |
| 100 | + return self.prepare.l1_norm_of_coeffs |
| 101 | + |
95 | 102 | def decompose_from_registers( |
96 | 103 | self, |
97 | 104 | context: cirq.DecompositionContext, |
@@ -132,17 +139,13 @@ def controlled( |
132 | 139 | ): |
133 | 140 | c_select = self.select.controlled(control_values=control_values) |
134 | 141 | assert isinstance(c_select, SelectOracle) |
135 | | - return QubitizationWalkOperator( |
136 | | - c_select, self.prepare, control_val=control_values[0], power=self.power |
137 | | - ) |
| 142 | + return attrs.evolve(self, select=c_select, control_val=control_values[0]) |
138 | 143 | raise NotImplementedError( |
139 | 144 | f'Cannot create a controlled version of {self} with control_values={control_values}.' |
140 | 145 | ) |
141 | 146 |
|
142 | 147 | def with_power(self, new_power: int) -> 'QubitizationWalkOperator': |
143 | | - return QubitizationWalkOperator( |
144 | | - self.select, self.prepare, control_val=self.control_val, power=new_power |
145 | | - ) |
| 148 | + return attrs.evolve(self, power=new_power) |
146 | 149 |
|
147 | 150 | def __pow__(self, power: int): |
148 | 151 | return self.with_power(self.power * power) |
|
0 commit comments