Characterizing quantum circuits with qubit functional configurations

We develop a systematic framework for characterizing all quantum circuits with qubit functional configurations. The qubit functional configuration is a mathematical structure that can classify the properties and behaviors of quantum circuits collectively. Major benefits of classifying quantum circuits in this way include: 1. All quantum circuits can be classified into corresponding types; 2. Each type characterizes important properties (such as circuit complexity) of the quantum circuits belonging to it; 3. Each type contains a huge collection of possible quantum circuits allowing systematic investigation of their common properties. We demonstrate the theory’s application to analyzing the hardware-efficient ansatzes of variational quantum algorithms. For potential applications, the functional configuration theory may allow systematic understanding and development of quantum algorithms based on their functional configuration types.


Introduction
The development of quantum algorithms with efficient quantum circuits has been a central part of quantum computation, which has seen enormous progress in the last 30 years in both the theoretical and experimental fronts [1][2][3][4][5][6][7][8][9][10][11][12][13].Over the years, numerous quantum algorithms have been developed targeting a great variety of applications: these include the phase estimation algorithm [14], Shor's factorization algorithm [15], the Harrow-Hassidim-Lloyd algorithm for linear systems [16], the hybrid classical-quantum algorithms [17][18][19], the quantum machine learning algorithms [20,21], and quantum algorithms for open quantum dynamics [22][23][24].Despite the success, the design of efficient quantum circuits to implement new quantum algorithms remains an accidental process, and a systematic way to understand how quantum circuits work may lead to improvements in existing algorithms and discovery of new ones.To systematically study quantum circuit complexity, we have previously developed a theory of characterizing quantum states with their creation complexity [25].In this work, we shift our attention from quantum states to quantum circuits and develop a systematic framework of characterizing quantum circuits with qubit functional configurations.The qubit functionals are first introduced in our previous work [26] as objects living in the dual space of the linear space formed by the basis states of the qubit state space.In this work we relate the qubit functionals to how the state vector entries are collectively modified by quantum gates.In particular, any arbitrary quantum circuit can be decomposed into alternating sequences of 1-qubit unitary gates and CNOT gates.Each CNOT sequence prepares the current quantum state into a layer of qubit functional configuration to specify the rule for the next k U sequence on how to collectively modify the state vector entries.All the layers together form a sequence of functional configurations that defines a unique type of quantum circuits with great variety.Characterizing quantum circuits by these functional configuration types has several major benefits: 1. all quantum circuits can be characterized by the corresponding functional configuration types; 2. each type characterizes important properties (such as circuit complexity) of the quantum circuits belonging to it; 3. each type contains a huge collection of possible quantum circuits allowing systematic investigation of their common properties.We demonstrate an application of the theory to the hardware-efficient ansatzes of variational quantum algorithms [27][28][29][30] by comparing the qubit functional configurations of two ansatzes used in Refs.[29] and [30].
We also propose a systematic process of creating any arbitrary functional configuration with the help of ancilla qubits.For potential applications, the functional configuration picture may allow us to systematically find a minimal gate decomposition sequence of any given quantum circuit.In addition, the classification may allow systematic understanding of quantum algorithms based on their quantum circuit types, which may benefit the development of new algorithms.

Theory of the qubit functional configuration
2.1 The qubit functionals.An n-qubit quantum state vector can be written as   , where the basis states i can be associated with the bit strings   i with i in the binary form.For example a 3-qubit state vector has 8 basis states corresponding to 8 bit strings:   000 ,   001 ,   010 , …,

 
111 .As discussed in Ref. [26] the collection of all these bit strings can be considered as a 3- dimensional linear space V over the binary field   0,1 and any bit string can be expressed as a linear combination of the three basis vectors (100), (010), and (001): , , 100 010 001 q q q q q q     v , where the coefficients i q 's take values 0 or 1, and the addition "+" is bit-wise addition modulo 2. Now by the theory of linear vector spaces, the dual space * V of V is formed by the linear functionals over V: , , f f q q q g q g q g q     v .Here the three basis functionals are , , f q q q q  , the coefficients i g 's take values 0 or 1, and the "  " is addition modulo 2. In Ref. [26] we have associated each functional with a "0" condition that specifies a half-set of the bit strings and studied the quantum condition space generated by these "0" conditions.In this work we call these functionals "qubit functionals" (because they are functionals on the qubit values) and focus on their roles in how the entries of the quantum state vectors are modified collectively by quantum gates.
2.2 Roles of elementary gates in modifying state vector entries.The universality of quantum circuits says that any unitary operation can be decomposed into a sequence of 1-qubit unitaries and CNOT gates.Consider an arbitrary n-qubit quantum state as the starting point, if we apply 1-qubit unitaries k U only without CNOT gates, then at most one k U can be applied on each qubit k q without redundancy.This is because k U 's on different k q 's all commute, so if e.g.

1
U has already been applied to 1 q , then any additional unitary 1 V applied to 1 q at any point after 1 U will be equivalent to a single gate 1 1 1 W V U  applied to 1 q , thus applying more than one gates on the same qubit is redundant and can be reduced to just one gate.Next to examine the actual effects of 1-qubit unitaries, we study a 3-qubit state ; where the 1-qubit unitary k U has the same basic form , thus we can say 0 a plays the role of "0" in this 2dimensional subspace while 4 a plays the role of "1".Now we see the effect of 1 U is dividing the total space into four 2-dimensional subspaces and then modifying the entries in pairs of , , , , , , , a a a a a a a a     where the 1 st entry in each parenthesis is considered "0" and the 2 nd entry is considered "1".Similarly, the effect of q  term with a unique 1 1 q  term and mix them to produce e.g.
. Finally putting all these pairs back to the proper locations in the total vector, we obtain the vector result of 1 1 U  as in Equation (1).Similarly, 2 U separates the total space into two half-spaces spanned by basis states with 2 0 q  versus 2 1 q  , while 3 U separates into half-spaces with 3 0 Now what happens if we apply some CNOT gates before the 1-qubit k U 's?
In Equation (2) we apply CNOT  and then CNOT  to produce 1 '  , where i j  in the subscripts means i q is the control and j q is the target.By studying either the truth table of the CNOT gates or the results from previous works [26,31,32], the 1 2 CNOT  calculates 1 2 q q  and stores its value on 2 q , and afterwards the 2 3 CNOT  calculates 1 2 3 q q q   and stores its value on 3 q .In other words, after CNOT  have been applied, the value on 2 q now represents the value of 1 2 q q  , and the value on 3 q now represents the value of 1 2 3 q q q   , as compared to the state 1  before the two CNOT gates are applied.Since both 1 2 q q  and 1 2 3 q q q   are linear functionals in * V , we can understand the vector 1 '  as having a functional configuration of   . Now by the same reasoning as the previous paragraph we predict that, if we apply 1-qubit unitaries to 1 '  now, 1 U will still separate the total space into two half-spaces spanned by basis states with 1 0 q  versus 1 1 q  , but exactly which "0" term is paired with which "1" term will be different.2 U now will separate into two half-spaces with 1 2 0 q q   versus 1 2 1 q q   , and 3 U will separate into two half-spaces with 1 2 3 0 q q q    versus 1 2 3 1 q q q    .Indeed this prediction is verified by carrying out the algebra on 1 '  in the same manner as in Equation ( 1):  ; ' u a u a u a u a u a u a u a u a U u a u a u a u a u a u a u a u a u a u a u a u a u a u a u a u a In Equation ( 3) we see the effect of 1 , , , , , , ,  a a a a a a a a     with the same "0" entries and "1" entries but different pairing from the previous  , , , , , , ,  a a a a a a a a     .
On the other hand, the effect of 2 , , , , , , ,  a a a a a a a a     where the "0" entries are now { 0 a , 1 a , 6 a , 7 a } -these entries in the original 1 a a a a a a     where the "0" entries are { 0 a , 3 a , 6 a , 5 a } which correspond to 1 2 3 0 q q q    in the original 1  vector.

Characterizing quantum circuits with functional configurations.
With these results we are now ready to introduce the idea of using qubit functional configurations to characterize quantum circuits.Starting with an arbitrary initial state   , we can consider the qubits as functional holders with the initial qubit functional configuration of   . As long as there is no CNOT gate applied, this functional configuration remains in place and specifies a unique rule for all possible 1-qubit unitaries: which entries are considered "0", which are considered "1", and how the "0" and "1" entries are paired for each k U .As long as the configuration stays in place, a maximum number of 3 n  k U 's can be applied with one unitary on each qubit, and any additional 1-qubit unitary would be redundant.After the last k U under this configuration has been applied and before the first CNOT happens, the state changes to   with new entries in the state vector.Now suppose a sequence of CNOT gates are applied without any 1-qubit unitary in between, right before the next k U happens, the entries are not modified but only shuffled, and this creates a new layer of functional configuration such as , , f q f q q f q q q       discussed above.This second layer of functional configuration now in place specifies its own unique rule for all possible 1-qubit unitaries that happen after, before the next CNOT gate is applied.Repeating this process we can analyze any arbitrary quantum circuits as follows: Figure 1.Graphical illustration of an arbitrary quantum circuit analyzed with multiple layers of qubit functional configurations.Note here we use the symbol k U to mean "any 1-qubit gate on the th k qubit", thus k U is not a particular gate and may represent different 1-qubit gates across different layers.
In Figure 1 an arbitrary quantum circuit can be decomposed into alternating sequences of 1-qubit k U and CNOT gates.Each CNOT sequence prepares the current quantum state into a new layer of qubit functional configuration to specify the rule for the next k U sequence on how the total space should be separated into "0" entries and "1" entries and how the "0" and "1" entries are paired.In particular, any k U finds the appropriate "0" and "1" entries according to the th k functional k f and the pairing pattern is defined by the entire functional configuration.After this k U sequence is completed, right before the next CNOT sequence begins, a quantum state with new entries is created, which can then be used as the initial state for the next iteration.This process can be repeated many times until the end of the circuit where the last layer of functional configuration specifies the rule for the final k U sequence to create the final state.Together, all the layers of functional configurations form a sequence of configurations that allows us to define a type of quantum circuits.
Next we demonstrate the application of the functional configuration picture in Figure 1 to analyzing the hardware-efficient ansatzes that are widely used in variational quantum algorithms [27][28][29][30].The hardware-efficient ansatzes commonly include many identical layers, and within each layer there are two sub-layers: one sub-layer of parameterized 1-qubit unitaries and one sub-layer of two-qubit entanglers.The two-qubit entanglers are usually all CNOT gates with no 1-qubit unitaries in between, such that each entangler sub-layer can be considered as a single layer of qubit functional configuration as described above -this makes the hardware-efficient ansatzes natural application candidates for the qubit functional configuration theory.In the following examples, the ansatzes used in Ref. [29] and Ref. [30] are shown in Figure 2 and Figure 3 respectively, and the corresponding qubit functional configurations are shown in Equations ( 4) and ( 5) respectively.The qubit functional configuration of the ansatz in Ref. [29] , , , , f q q q q q f q q f q q q f q q q q f q q q q q f q q q q q q Figure 3.The quantum circuit of one layer of the hardware-efficient ansatz in Ref. [30].The qubit functional configuration of the ansatz in Ref. [30] , , , , , f q q f q f q q q f q q f q q q f q In Equations ( 4) and (5) the differences between the two ansatzes in Figure 2 and Figure 3 are clearly shown by the corresponding qubit functional configurations.For example, in Equation ( 5) 2 f and 6 f still keep their initial values 2 q and 6 q , while in Equation (4) all the qubit functionals have been changed.In general, the qubit functionals in Equation (4) contain more qubit terms than those in Equation ( 5), thus we should expect the qubits of the circuit in Figure 2 to be more interconnected than those in Figure 3.This demonstrates the ability of the qubit functional configuration theory to characterize the properties of different ansatzes.In this particular case, the ansatzes will repeat the same functional configuration for all the following layers; however, if we apply the theory to other types of quantum circuits, such as the quantum Fourier transform circuit studied in the Supplementary Information (SI) Section S1, each layer may have a different functional configuration and the whole sequence of configuration layers characterize the circuit's properties.
Studying quantum circuits in terms of the qubit functional configuration types has various benefits: 1.Because the process in Figure 1 is entirely general, any arbitrary quantum circuit can be analyzed by this picture and thus belongs to one of the types defined by the functional configuration sequence.2. As explained earlier, for any particular layer of functional configuration, a maximum number of n 1-qubit unitaries can be applied without redundancy, with one unitary for each qubit.In addition, the number of CNOT gates required to achieve any given functional configuration is also bounded.Therefore the total length L of a quantum circuit is closely related to the total number N of functional configuration layers in the circuit.In other words, the functional configuration picture captures the important property of circuit complexity.The exact relation between L and N will be derived in Section 2.5.3.More importantly, any particular sequence of the functional configurations contains the characteristic information of how the state vector entries are collectively modified by 1qubit unitaries, while not fixing the actual k U sequences -this allows us to group a large collection of quantum circuits together to be classified under a single type defined by the functional configuration sequence.In fact, as the parameters of any 1-qubit unitary can be varied continuously in the complex number domain, there are uncountably infinite number of possible quantum circuits with a given length.However, for a functional configuration sequence of a given length, there are only finite number of possible sequences, thus by this picture we are able to classify an uncountably infinite collection with finite number of types.
Any particular type of quantum circuits has its unique sequence of functional configurations, and each layer of functional configuration defines a unique way by which 1-qubit unitaries work on the state vector entries.As detailed in Ref. [26], the duality between the linear functional space * V and the bit string space V leads to a one-to-one correspondence between each functional and a unique partition of the bit strings -defined by two half-sets specified by setting "0" and "1" for the functional value respectively.When k U acts on k q , the partition of k f specifies which entries are "0" and which are "1", while the partitions of all other functionals define how the "0" entries are paired with the "1" entries.Consequently if a particular functional k f appears in one configuration but not in another, then the 1-qubit unitaries will behave differently in the two configurations and thus two quantum circuits of different configuration types have different characteristics.Even if two configurations contain the same collection of functionals, two different permutations of these functionals will in general produce different quantum circuits.As detailed in the Supplementary Information (SI) Section S2, if there is only one layer, then e.g. the configuration   , , , , f f f obeys the same rules as , , f f f with 3 1 1 U U   .However, when multiple layers of configurations are present, then each corresponding configuration must permute in the same way for this equivalence to hold: e.g.    , , , , , , , , f f f f f f  .Hence we can conclude that the types of quantum circuits as defined by different sequences of functional configurations do not in general overlap with each other.When studying properties of quantum circuits with the gate decomposition sequence one often encounters the problem of having multiple gate sequences that produce the same total unitary operation, which means that gate sequences do not uniquely characterize quantum circuits.In the functional configuration picture however, all these "equivalent" gate sequences must produce the same functional configuration sequence, and the types defined by the functional configuration sequences uniquely characterize quantum circuits.This is another benefit offered by the functional configuration picture.A detailed example of how different gate sequences can produce the same functional configuration is presented in the SI Section S3.
2.4 Number of possible functional configuration types.Now a natural question is to ask how many possible functional configuration types there are for a single layer and over a fixed number of layers.For a single layer, because the functional space is the dual of the bit string space with 2 n elements, there are 2 n functionals (for details see Ref. [26]).Excluding the "0" functional, there are 2 1 n  to choose from, and n locations to allocate them.The most naïve count would be (  , but not all of these are valid configurations.To see this first note that it is impossible for duplicate functionals to appear in two or more different locations.This is because e.g. if we have a configuration of   , , ..., n f f f f f  then the state vector will only have entries associated with the basis states 00... and 11... but not 01... and 10... (half of all dimensions have been lost for the state vector), and this cannot be always satisfied when the initial state are chosen arbitrarily.It turns out this non-duplication rule is a special example of a more general condition for valid configurations: for a configuration of   f is no longer free such that the subspace defined by   , , f f f and half of the dimensions have been lost for the state vector.When we view the functionals as members of the linear space * V , then requiring any k f is not the sum of any number of other functionals is the same as requiring linear independence for all k f 's for 1, 2, ..., has only the trivial solution of all k c 's being 0. Note that this linear independence is automatically enforced by using CNOT gates to create functional configurations.
To see this start with any configuration of   which has linear independence for all functionals, so indeed any CNOT sequence will automatically enforce the linear independence.Now back to counting the possible configurations for a single layer, considering linear independence there are 2 1 n  choices for 1 f , 2 2 n  for 2 f , …, for k f there are f N number of choices: So the total possible number of configurations for one layer is: Now over multiple layers, for clarity we reinforce the definition of layers of functional configurations.Referring to Figure 1, start with the initial state 1  and the initial configuration , if the first gate applied is a 1-qubit unitary (i.e. the case in Figure 1), we consider the initial configuration as the first layer; if the first gate is a CNOT gate (i.e. the case obtained by removing the first k U sequence and combining the first two blocks in Figure 1), we consider the configuration created by the first CNOT sequence as the first layer.After the first layer has been established, a sequence of 1-qubit unitaries can be applied according to the rule set by this configuration, and as long as there is no CNOT gate, the system stays in the first layer.Right before the next CNOT sequence happens, the state changes to 2  , and the configuration is reset to   . Now the next CNOT sequence applies, and right before the next 1-qubit unitary sequence we create the configuration of the second layer, which stays in place until the next CNOT sequence.Subsequent layers can be defined accordingly.
We require that all layers after the first one cannot be the initial configuration -because otherwise no CNOT gate is applied after the reset and we can combine this layer with the previous one -then the total possible number of types defined by N layers of functional configurations is: where the accounts for "all layers after the first one cannot be the initial configuration", and !n accounts for the equivalence due to permutation of functionals in the first layer.To get a concrete idea of t N , for a 5-qubit system (like the simplest IBM quantum devices [33] but with unlimited connectivity between qubits) over 1 layer of functional configuration, there are: Over 3 layers of functional configurations, there are: So the number of types t N can be a gigantic number even with quite small values for n and N, but this is reasonable because we are considering all quantum circuits that are ever possible on n qubits and N layers with a finite number of types.In fact, the gigantic number t N illustrates the immense potential of quantum computation as a small number of qubits can support such enormous variety of quantum circuits over few layers.
2.5 Circuit length in relation to the number of layers of functional configurations.How does the number N of layers relate to the length of the quantum circuit?As explained earlier, for any particular layer of functional configuration, a maximum number of n 1-qubit unitaries can be applied without redundancy, with one unitary for each qubit.So for any quantum circuit with N layers of functional configurations, the total number U N of 1-qubit unitaries is least one unitary for each layer).This means that once the circuit type defined by the sequence of functional configurations has been fixed, the length of the circuit can only vary by up to nN .Now if more generally the circuit type is not fixed but the number of layers is fixed, to evaluate how many CNOT gates are possible for one layer, we need to study how many CNOT gates are required to reach an arbitrary functional configuration.Starting with any functional configuration   such that the process of creating functional configurations is dynamical and it is difficult to exactly evaluate how many CNOT gates are required.However, we can calculate an upper bound for the number of CNOT gates by storing the initial configuration of   on n ancilla qubits.
To do this we start with the initial configuration   on the computational qubits, prepare the ancilla qubits as with the computational qubits as controls and the ancilla qubits as targets, such to copy the configuration   on the ancilla qubits.
This way when we modify the configuration on the computational qubits, the ancilla qubits still retain the initial configuration.After this we can create the wanted functionals one by one, e.g. if for the next layer the wanted configuration requires 1 2 3 5 f q q q    , then we can use the corresponding ancilla qubits as controls and the 1 st computational qubit as target such as CNOT a  (order does not matter), and we will create 2 3 5 q q q   on the 1 st functional location.Note here 1 1 CNOT a  is to remove 1 q from 1 f .As the ancilla configuration is never changed in this process, we can repeat the same procedure when creating 2 f , 3 f , and all the way to n f .This systematic process of creating any functional configuration is illustrated in Figure 4 with a 3-qubit example.With this process, for each k f , the functional that requires the most CNOT gates is the sum of all qubits except k q , e.g. 1 2 3 ... n f q q q     , which requires n CNOT gates.Therefore the number of CNOT gates required to reach any functional configuration cannot exceed 2 n n n   .The situation is similar for all subsequent layers, hence the number of CNOT gates over N layers cannot exceed 2  n N .In practice this upper bound may not be reached due to the linear independence constraint.Overall to achieve any single layer of configuration we need at most n CNOT we need is one CNOT for all the layers after the first one, so it is   1 N  gates, and we have , with the right equality not necessarily achievable.Now we see that even with just 5 qubits and a single layer 1 N  , the possible length of the quantum circuits is 1 5 CNOT gates, so the number of types at 83328 in Equation ( 9) becomes more reasonable.Here we remark that on a case-by-case basis, the procedure to create functional configurations by ancilla qubits may be far less efficient compared to working with the computational qubits only.For example, the configuration , , f q f q q f q q q       can be easily reached by 1 2 CNOT  and then in n then the maximum length of the quantum circuits classified by N layers of functional configurations is also polynomial in n: this means that not only the quantum circuits belonging to the same type are either all polynomial or all exponential, but also the quantum circuits of types with the same number of layers are either all polynomial or all exponential.In other words, the functional configuration picture captures the important property of circuit complexity.

Potential applications
The qubit functional configuration picture described in Section 2 provides a systematic framework for characterizing quantum circuits.As discussed in Section 2.3, the framework assigns all possible quantum circuits of a given length into finite types that in general do not overlap.In addition, the characteristic information of how the state vector entries are collectively modified by 1-qubit unitaries is described by the functional configuration sequence.In the following we discuss potential applications provided by this new theory.
3.1 Quantum algorithm development.The classification of quantum circuits will allow us to systematically study circuits of the same type or similar types.Numerous quantum algorithms with diverse mechanisms and functionalities have been proposed in the past 30 years, yet these discoveries are mostly made on a case-by-case basis.A systematic study of these algorithms based on the functional configuration types will potentially help us understand why they work, and such knowledge may lead to improvements on existing algorithms and discovery of new algorithms.As demonstrated by the application examples in Section 2.3, The ansatzes used in variational quantum algorithms [27][28][29][30] are natural candidates for classification studies using the qubit functional configuration theory.The hybrid classical-quantum platform of the variational quantum algorithms has led to successful applications such as the variational quantum eigensolver (VQE) [17] and the quantum approximate optimization algorithm (QAOA) [19].The properties and capabilities of variational quantum algorithms have been studied by descriptors such as expressibility and entangling capability [34] that describe how much of the solution space can be explored by varying the parameters.Now with the new qubit functional configuration picture we could classify various ansatzes into qubit functional configuration types such that their behaviors and properties are characterized by these types.In other words, the qubit functional configuration picture may allow us to systematically understand why certain ansatzes have better (or worse) performances when treating different kinds of problems.

3.2
The minimal gate decomposition of a quantum circuit.The qubit functional configuration picture may allow us to systematically find a minimal gate decomposition sequence of any given quantum circuit.Without the picture, the gate decomposition of a given quantum circuit is not unique (see Section 2.3 and the SI Section S3), and there is no systematic approach to find the minimal gate sequence or verify that a known gate sequence is minimal.With the picture, for any given quantum circuit, if one gate decomposition sequence (non-minimal) is known, we will then find the functional configuration sequence that defines the type for the circuit.Now for each layer of functional configuration, the minimal CNOT gate sequence to create this configuration is a welldefined sequence.Joining the minimal CNOT sequence for each configuration layer together and inserting the appropriate 1-qubit unitaries, we will have the minimal overall gate sequence for the quantum circuit.A worked-out example of how this may work is found in the SI SectionS2.Even further, as in Equation ( 7) there are only finite number of possible functional configurations for a single layer, thus for small numbers n of qubits, we could even construct a complete dictionary of all possible functional configurations with the corresponding minimal gate sequences, such that the minimal gate sequence for any arbitrary quantum circuit can be retrieved by searching the functional configuration index.

Conclusion
In this work we have developed a theory of characterizing all quantum circuits with qubit functional configurations.In particular, an arbitrary quantum circuit can be decomposed into alternating sequences of 1-qubit unitary k U gates and CNOT gates.Each CNOT sequence prepares the current quantum state into a layer of qubit functional configuration to specify the rule for the next k U sequence on how to collectively modify the state vector entries.All the layers together form a sequence of functional configurations that defines a unique type of quantum circuits with great variety.For uncountably infinite possible quantum circuits, there are only finite number of functional configuration types for a given length, and this number has been evaluated in detail.More importantly, these types uniquely characterize properties of the corresponding quantum circuits.We have demonstrated an application of the theory to the hardware-efficient ansatzes used in variational quantum algorithms by analyzing them in terms of the functional configurations.We have also proposed a systematic procedure of creating any arbitrary functional configuration by storing the initial configuration on ancilla qubits.For potential applications, the functional configuration picture captures the important property of circuit complexity of any given quantum circuit and may allow us to define a minimal sequence for it.The functional configuration picture may also allow systematic understanding and development of quantum algorithms.
In the main text we have applied the functional configuration theory to the hardware-efficient ansatzes of variational quantum algorithms.For the ansatzes all the layers have the same functional configuration and hence we have only studied one layer.In this section we study the quantum Fourier transform (QFT) circuit that has different functional configurations on different layers, such that the circuit is described by a sequence of layers.The QFT [35] is an essential subroutine in many important quantum algorithms such as the phase estimation algorithm [14] and Shor's factorization algorithm [15].Here we analyze the functional configuration sequence of a 3-qubit QFT circuit: In Figure S5 we first decompose the controlledh R gates, defined by , into CNOT gates and 1-qubit unitaries as enclosed in the blue boxes.The standard decomposition [35] has 2 2 . The decomposed circuit on the bottom of Figure S5 contains 7 functional configuration layers as indicated by the green boxes, and the functional configuration sequence is: q q q q q q q q q q q q q q q q q  , , , , q q q q q q q q     .In this particular circuit the 1 st configuration layer is the initial configuration of   , , q q q , while each configuration layer after the 1 st one is defined by a single CNOT gate, such that the number of CNOT gates is equal to the number of layers minus one.Considering the standard result of having O n and thus agrees with the well-known gate scaling of the QFT circuit [35] -as detailed in the main text Section 2.5, in general the functional configuration picture captures the important property of circuit complexity.

S2. Equivalence between qubit functional configurations due to permutation of functionals.
In the main text we mentioned that if there is only one layer of functional configuration, and two functional configurations contain two permutations of the same collection of functionals, then the two configurations can be considered as equivalent.Below we give a concrete example of a 3qubit system.Consider the two functional configurations of CNOT  , and To see this is correct, the configuration after the 1 st , , f q f q f q q     , and after the 2 nd where the 1 swapping the entry 1 a for 001 with 2 a for 010 , and swapping 5 a for 101 with 6 a for 110 --this is just swapping 2 q and 3 q .This means that applying a 1-qubit unitary on 2 q (or 3 q ) for 1  is equivalent to applying the same unitary on 3 q (or 2 q ) for 1 '  , and therefore   , , C f q f q f q     in the sense that they contain the quantum circuits that perform equivalent operations.Therefore swapping functionals in the configuration leads to equivalent configurations.Now by the theory of permutation groups, any arbitrary permutation can be realized by a series of swaps, then we conclude that any configuration generated by permuting the functionals in the original configuration is equivalent to the original as both configurations have equivalent rules for the 1-qubit unitaries up to a permutation.This equivalence leads to the !n term on the denominator in Equation ( 6) of the main text.
S3. Multiple different CNOT gate sequences producing the same functional configuration and the minimal gate sequence.
In the main text we have discussed the situation where multiple different CNOT gate sequences can produce the same functional configuration and thus the same total unitary operation.Here we present a concrete example and discuss how a minimal gate sequence can be defined with the functional configuration picture.Again consider a 3-qubit system, the configuration of   , , f q q q f q q f q       can be created from the initial configuration of CNOT , CNOT , CNOT ) , which is longer than the previous two but still produce the same functional configuration.A major benefit of the functional configuration picture is it allows us to see the equivalence of these different CNOT sequences with ease, because they all correspond to the same functional configuration.Unlike gate sequences, types defined by functional configuration sequences uniquely characterize the corresponding quantum circuits.
This fact also allows us to define and find a minimal gate sequence for any given quantum circuit, because among all the equivalent gate sequences for any functional configuration, there must be a sequence or multiple sequences with the minimal number of gate count, and this sequence(s) will be the minimal required to create a part of the quantum circuit involving such a functional configuration.In fact if a gate sequence decomposition (may not be the minimal) is known for an arbitrary quantum circuit, for example the one described above: , we can obtain the functional configuration for each layer based on this sequence (only one layer for this example):   , , f q q q f q q f q       , and then find the minimal sequence to generate the same functional configuration:   , and this will be a much shorter circuit that performs the same task.If there are multiple layers, joining the minimal sequence for each layer together and inserting the appropriate 1-qubit unitaries will then yield the overall minimal sequence for the quantum circuit.Therefore by the functional configuration picture we have a systematic way of defining and finding the minimal sequence of any quantum circuit.

Figure 2 .
Figure 2. The quantum circuit of one layer of the hardware-efficient ansatz in Ref. [29].

Figure 4 .
Figure 4.A 3-qubit example of systematically creating any functional configuration by first storing the initial configuration on 3 ancilla qubits and then creating the functionals one by one without changing the ancilla qubits.


gates, and the total over N layers is   2 n n N  CNOT gates.The least number

3 CNOT
a  , requiring 6 CNOT gates in total.However the ancilla method is more systematic thus to allow us to bound the maximum number of CNOT gates needed.Even with this inefficiency, the upper bound of nN and   2 n n N  are both polynomial in n and N such that if N is polynomial