{'fraction_non_alphanumeric': 0.04004004004004004, 'fraction_numerical': 0.009175842509175842, 'mean_word_length': 3.8994687372292605, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
The f-conditioned Phase Transform

We present a quantum algorithm for the f-conditioned phase transform which does not require any initialization of ancillary register. We also develop a quantum algorithm that can solve the generalized Deutsch-Jozsa problem by a single evaluation of a function.


Introduction
Several quantum algorithms have been implemented by NMR quantum computers [4,5,8,9,11,12,13,14,15,18,19,21,22] among which much attention has been paid to the Deutsch-Jozsa algorithm [10] due to its simplicity whereas the power of a quantum computer over a classical one can be demonstrated. In NMR implementation for Deutsch-Jozsa algorithm there are two approaches, one of which is the Cleve's version [6] that requires an n-qubit control register for storing function arguments and a one-qubit ancillary register for function evaluation to solve the n-bit Deutsch-Jozsa problem. It has been implemented by several research groups [4,18,19] up to four qubits following the first successful implementation [13] of a quantum algorithm on any physical system with two qubits. In general for a quantum computer with a larger numbers of qubits the associated requirement of appreciable coupling between any pair of spins raises difficulties. The conditional phase transform enables us to eliminate some ancillary register in the description of quantum algorithms, one of which examples is the refined Deutsch-Jozsa algorithm in [8]. Its realization has been reported with three-qubit arguments [9,12] and with four-qubit arguments [19].
To perform conditional phase transform we have to evaluate a given function on a quantum computer. Unitary evolution property of quantum computation necessitates at least one ancillary register from which we have to extract relative phases conditioned on a function. If we can initialize the ancillary register the phase-encoded information can easily be accomplished. We generalize the conditional phase transform to have arbitrary relative phases controlled by a given function, which we call the f -conditioned phase transform. We present an algorithm to implement the f -conditioned phase transform without initializing the ancillary register. Furthermore, the application of the algorithm turns the ancillary register back to its initial state. This implies that we are free to compose this temporary register while it is being used in another computational process without corrupting its computation. Our algorithm is optimal in that it involves two f -dependent operations. Because to realize the f -conditioned phase transform at least two operations dependent of f are necessary. This is because we do not require any initialization of the ancillary register. If some kind of initialization is involved, only one f -dependent operation is sufficient. Using the f -conditioned phase transform we develop a quantum algorithm that can solve the generalized Deutsch-Jozsa problem by a single evaluation of a given function.

The f -conditioned Phase Transform
For N ∈ N we denote by Z N = {0, 1, . . . , N − 1} the additive cyclic group of order N. Let {|a } a∈Z N be the standard basis of the Hilbert space H N representing the state of an n-qubit quantum register.
Given a function f : |x plays an important role in quantum algorithms for an appropriately chosen k ∈ Z M according to the problems and ω M = exp(2πi/M) is a primitive M-th root of unity. The resulting interference pattern is used to determine global property of the function and most known quantum algorithms rely on this f -conditioned phase transform. In order for the values of a function to be encoded in the phases we need a quantum circuit to evaluate a function.
On a quantum computer the evaluation of a function is performed by a unitary operation U f : |x |y → |x |y + f (x) . The first n-qubit register we call the control register contains the states we wish to interfere. The second m-qubit register we call the auxiliary or ancillary register is used to induce relative phase changes in the first register. In view of the second register the function evaluation employs a translation operator T z : |y → |y + z where z = f (x) is dependent of the state of the first register. That is, U f can be regarded as an operation |x |y → |x T f (x) |y . If we concentrate on the ancillary register, the required operation is J k,z : |y → ω kz M |y for all y ∈ Z M . J k,z has an eigenvalue ω kz M and the corresponding eigenspace is the whole Hilbert space H M .
For simplicity, let us assume that N and M are powers of 2, that is, N = 2 n and M = 2 m for some nonnegative integers n and m. Let R k,I = QFT −1 T −k QFT where I is an identity map and QFT is the quantum Fourier transform. Then it maps |y to ω ky M |y in which the phase-encoded information depends on the state.
We first describe an algorithm to implement J k,z . We prepare an arbitrary m-qubit register with no initialization and let |ψ = M −1 y=0 a y |y be its state. Now we proceed the following steps.
1. Applying the translation T z we get M −1 y=0 a y |y + z .

Applying
This algorithm realizes J k,z via R −1 k,I T −1 z R k,I T z . That is, for an arbitrary initial state |ψ The algorithm to implement J k,z is not unique. In fact, all cyclic rotational permutations of the operational steps are identical.
For example, we can start at Step 2, perform successive steps, and end at Step 1. Noting that S k,I = QFTT −k QFT maps |y to ω ky M |−y , we can easily check that We remark that S −1 k,I = S k,I . Thus we have another algorithm for J k,z . However, the number of T z or T −z in each implementation is always equal to or more than two and cannot be reduced. This is because we require no initialization, which we shall explain more precisely later. It follows that the f -conditioned phase transform requires two evaluations of f .
Especially when M = 2 and k = 1, QFT is the Walsh-Hadamard operator W and T z = T −z is the Pauli spin matrix σ x = ( 0 1 1 0 ) which represents a bitflip operator. Thus the operator R k,I is just a phase-flip operator σ z = ( 1 0 0 −1 ). The overall scheme [16] is σ z U f σ z U f .
We turn to the operator R k,f for a general function f . In this case we need two registers as we have already mentioned. In the ancillary register U f can be seen as a translation T f (x) conditioned on the control register which state is in |x . Using the above algorithm we can perform R k,f without any initialization of the ancillary register. We let |φ = N −1 x=0 a x |x and |ψ = M −1 y=0 b y |y be the states of the control and ancillary registers, respectively and perform the following algorithm.
1. Applying U f we get

Apply
If we discard the ancillary register, then we obtain the f -conditioned phase transform R k,f : |x → ω kf (x) M |x without any initialization of ancillary register. The ancillary register can consist of any m qubits which may be composed of parts of any other registers even though they are still being used in another computation regardless of their states possibly entangled with other qubits. We note that after extracting the desired relative phase the initial state of ancillary register is recovered. Thus this temporary register can be used in continuing the previously stopped computation.
Our algorithm requires both U f and U −f . In other words, at least two evaluations of f are necessary. If we can initialize the ancillary register, only one evaluation of f is sufficient. We see that QFT|−k is an eigenvector of T z with the corresponding eigenvalue ω kz M . If we let |ψ = QFTT −k |0 , then U f : |x |ψ → ω kf (x) M |x |ψ . The special case when k = 1 was studied in [6,7]. However, if we are to start with any state of ancillary register we have to find unitary operators V and W satisfying V T z W = ω kz M I. Notice that T z has to be used at least once whether we employ initialization or not. Since W † V T z = ω kz M I, it is enough to find a unitary operator V such that V T z = ω kz M I. Since V = ω kz M T −z , V has to depend on z. Thus in some step of the algorithm we have to use information on z once more and so we need at least two T z or T −z . Therefore to realize R k,f we need at least two evaluation of f . In this sense the algorithm presented here is optimal.
Let us consider the case f : Z N → [0, 1) ⊂ R. Then with m-bit approximationf : Z N → Z M of f the approximate f -conditioned phase transform R k,f can be accomplished. This approximate f -conditioned phase transform is useful in the conditional γ-phase transform and the β-phase diffusion transform which are constructed in [2,3]. Similarly we can achieve any mbit approximate of more general phase transform which can be described by R 1,g•f given a function g : Z M → [0, 1) ⊂ R.

Generalized Deutsch-Jozsa Problem
The Deutsch-Jozsa problem is to determine whether a function f : Z N → Z 2 is either constant or balanced under the assumption that f is either one. This problem, in which m = 1 and thus ω M = −1, can be solved by measuring W n R 1,f W n |0 n : when the outcome is |0 n f is constant and otherwise f is balanced. This procedure can easily be extended to solve the generalized Deutsch-Jozsa problem by employing f -conditioned phase transform. We say that f is evenly distributed if f has evenly distributed D > 0 values and the numbers of x which map to the same value are all equal. If f is evenly distributed, then there exist D > 0 and a ≥ 0 such the period of the range of f is L = M/D with a possible initial shift a; {f (x) : x ∈ Z N } = {jL + a : j ∈ Z D } and |A 1 | = |A 2 | = · · · |A D | where A j = {x ∈ Z N : f (x) = jL + a} for j ∈ Z D . The generalized Deutsch-Jozsa problem is to determine whether f is constant or evenly distributed when f is either one.
We now explain the procedure to solve the generalized Deutsch-Jozsa problem. We prepare an n-qubit register with its initial state being |0 n and apply W n R k,f W n for k = 0 where W n is the n-qubit Walsh-Hadamard transform. Then we have |y where x · y stands for the XOR of the bitwise AND of the binary strings x and y in Z n 2 . Let S be the inner summation in the final state; If f is constant, then If f is evenly distributed, then for y = 0 we have Hence when f is constant the final state is |0 while |0 disappears when f is evenly distributed. Now we measure the register. If the outcome of the measurement is |0 then we conclude that f is constant. Otherwise, we conclude that f is evenly distributed. Thus we can solve the generalized Deutsch-Jozsa problem by a single evaluation of f with known initialization of the ancillary register and by two evaluations of f with unknown state of the ancillary register. We note that our procedure is independent of D, L and a.
To determine whether f is constant or evenly distributed we need N/D + 1 evaluations of f classically in worst case. This is the case when D or L is known. However, if neither D nor L is available, any classical algorithm for this problem would require N/2 + 1 evaluations of f in the worst case before determining the answer with certainty. Whence the generalized Deutsch-Jozsa problem has the same complexity as the original Deutsch-Jozsa problem.
Furthermore, when f is evenly distributed we can determine D, L and a. The image of f has period L with initial shift a. Finding the period L of a function with an unknown initial shift a can easily be solved on a quantum computer. Actually the quantum Fourier transform wipes off the initial shift and changes its period to M/L = D. This useful property was used to solve factoring problem by Shor [20].
When f is onto, f is an evenly distributed function if and only if f is an r-to-one function where r = N/D. Thus the generalized Deutsch-Jozsa algorithm can determine whether f is constant or r-to-one. The r-to-one function appears in collision and claw problems [1] under the assumption that f is onto.
We note that for general positive integers N and M, the approximate Fourier transform in [17] can be used.