Content uploaded by Stanislav Protasov

Author content

All content in this area was uploaded by Stanislav Protasov on Jul 14, 2022

Content may be subject to copyright.

Tucker Tensor Decomposition of a Quantum

State for Entanglement Analysis

Stanislav Protasov1[0000−0001−5404−2773] and

Marina Lisnichenko1[0000−0002−2701−6083]

Innopolis University, Innopolis, Russia

{s.protasov,m.lisnichenko}@innopolis.university

Abstract. Researchers have put a lot of eﬀort into reducing the gap

between current QPU capabilities and potential supremacy. One prac-

tical approach is to unload, at least partially, computations from quan-

tum computers to the CPU. Arbitrary quantum state initialization is

an example of such computations. The known algorithms are exponen-

tially complex if counting in qubits, and QPU does not show advan-

tages compared to classical machines. To address this, many studies pro-

pose approximate but robust state initialization in noisy systems with

Schmidt decomposition (or equivalently, singular value decomposition).

Being able to cut the state into a tensor product of independent parts,

we can dramatically reduce gate utilization and minimize loss of state

ﬁdelity. The basic decomposition approach is to ﬁnd the least entan-

gled qubit(s). To ﬁnd the least entangled qubit, SVD is computed for

each qubit separately. In this paper, we study how Tucker decomposi-

tion can replace SVD in low-entangled qubit detection. We propose two

algorithms to analyze the Tucker core tensor. Both methods outperform

SVD in time and memory for the systems of ten qubits and more.

Keywords: quantum state preparation ·tensor decomposition ·NISQ

1 Introduction

Today, researchers are making great eﬀorts to bring the advantage of quantum

computing closer in time. One popular approach is to partially unload compu-

tations from QPU to CPU [1, 4, 5]. In the context of machine learning and data

processing, data input (i.e., arbitrary quantum state initialization) is an indis-

pensable gate-hungry task [14]. Separation (even approximate) of a quantum

system into low-entangled subsystems is proﬁtable for the utilization of qubits

(model subsystems separately [5, 8]) and for the reduction of circuit depth [1].

In the noisy intermediate-scale quantum (NISQ) era, any algorithm, including

state initialization, is accompanied by quantum gate errors. The deeper the

initialization circuit, the lower the ﬁdelity of the state practically obtained. State

approximation reduces circuit depth. Using fewer quantum gates, approximate

methods show even higher practical ﬁdelity than exact initialization [1]. In this

work, our aim is to reduce CPU time for low-entangled qubit search with Tucker

tensor decomposition [15].

2 S. Protasov and M. Lisnichenko

2 Related concepts

2.1 Quantum state as a tensor

Quantum algorithms operate on complex-valued quantum state vectors. The

components of such vectors represent amplitudes of the corresponding basis

states. This is not the only perspective. We run quantum circuits on real hard-

ware and interact with qubits, not with states.

Tensors were introduced more than a century ago [13], and were heavily

utilized in diﬀerent areas of physics. Data science signiﬁcantly aﬀected on to-

day’s tensor algebra understanding, and its language. In this context, the tensor

is a multidimensional data array, representing a multivariate function of dis-

crete arguments. Modes (dimensions) of the tensor correspond to variables, and

the numbers in the tensor represent the function value. Mostly, data scientists

meet tensors as multidimensional numpy.ndarray in Python. The memory to

store a tensor grows exponentially with respect to the number of modes; thus,

researchers explore tensor compression techniques: Tucker decomposition [15],

tensor train [12], tensor rank decomposition [10] with PARAFAC [9], and oth-

ers. For more information about tensors we refer the reader to this paper [6].

If we reshape (literally, call tensor.reshape(...) in Python) the state vec-

tor into a C2Ntensor, it appears that each tensor mode corresponds to a qubit.

For example, addressing 2nd tensor’s mode with 0 – tensor[:,:,0,:] in Python

– corresponds to the amplitudes of the basis states |∗ ∗ 0∗⟩ where 2nd qubit is in

the state 0. This is extremely close to ket-notation. Bringing a quantum system

state into such a natural form opens the door to applications of contemporary

tensor analysis. The most prominent problem which can be addressed in this

form is search of disentangled or weakly entangled subsystems.

2.2 Singular value decomposition of two qubits state

Matrix is a non-trivial tensor with two modes. We can reshape a 2-qubit state

vector into a 2×2matrix. The state-vector interpretation tells us that the

entangled state |ψAB⟩cannot be written as a tensor product |ψA⟩⊗|ψB⟩. Ac-

cordingly, if we pose the question “is the 2-qubit system |ψAB ⟩disentangled?",

the same question in a matrix form will sound like “can we ﬁnd a rank-1 matrix

decomposition ΨAB =ΨA×ΨB, where ΨA∈C2×1,ΨB∈C1×2"?

The de facto standard to answer this question is singular value decomposition

(SVD) [7]: ΨAB =U×Σ×V†. This method gives the answer about the rank

(we test the second singular value Σ1,1to be 0), and also provides ΨA=U∗,0

and ΨB=V†

0,∗. Additionally, the method produces an optimal approximate de-

composition in terms of ﬁdelity loss.

2.3 Tucker decomposition

SVD is applied to examine the entanglement of bipartite systems, but we must

know in advance which, exactly two, qubit groups form weak-entangled parti-

Title Suppressed Due to Excessive Length 3

tions. In practice, the method is applicable even without satisfying this con-

straint [1,5, 8], which may lead to a signiﬁcant loss of ﬁdelity in decomposition.

Tucker decomposition [15] generalizes SVD for one-versus-all comparisons.

Tucker format assumes that we decompose original tensor into a core tensor G

with the same degree (same number of modes) and projection matrices. These

matrices correspond to the modes of the tensor, and represent their principal

components. The role of a core tensor is exactly the same as the role matrix Σ

in SVD: it captures the relations of the particular tensor mode with the rest of

the modes. The matrices for modes correspond to Umatrix in SVD, and the

naïve method to obtain the decomposition is based on the application of SVD

for each mode separately. Tucker decomposition is stable: matrices may diﬀer

up to a complex constant multiplier eiϕ, while singular values in the core tensor

are unique [3]. This property allows using faster iterative methods [11].

3 Tucker decomposition of a quantum state

The Nqubits quantum state is naturally modeled with C2Ntensors, as we

discussed in 2.1. Thus, a quantum state Tucker decomposition consists of a core

tensor and Nunitary matrices, each corresponding to a qubit.

G

A

B C

|G|

|1⟩

|G|

|1⟩

|+⟩ |+⟩

Fig. 1: Proposed tensor contraction method for qubit entanglement evaluation.

3.1 Entanglement estimation with tensor contraction

If we measure a quantum state Ton the basis of itself, we obtain the probability

of 1. To do this, in tensor network notation, the state tensor Tis contracted

along all its modes with the conjugate tensor ¯

T[2]. Contraction along any mode

in such a case is a sum Σi=0,1⟨G∗

i|G∗

i⟩, which is (only in case of measurement

to itself!) exactly equal to Σi=0,1|G∗

i|2. Accordingly, the tensor of the absolute

values |G| can be contracted to itself to obtain the same result. Thus, we use

the COPY tensors instead of tensor replication. COPY tensor represents the

function f(x, x, x)=1, and is depicted with a bold dot with three legs. We use

COPY tensors to contract the |G| modes with themselves, rather than creating

a conjugate copy of |G|. In Figure 1 we use the theorem [2], that a COPY tensor

with the loop is equal to √2|+⟩vector.

If we contract all except one modes, the remaining tensor legs will correspond

to the non-measured separate qubit state, and to its conjugate. The computation

of this state is at the core of the proposed method.

4 S. Protasov and M. Lisnichenko

We propose the following method to assess the mth qubit for being entangled

with the rest of the subsystem. First, all core tensor elements are replaced with

their absolute values. Second, all modes except the mth are contracted with the

|+⟩vector (i.e., measured to maximize probability). The remaining real valued

state ||ψm⟩| corresponds to the qubit evaluated. In the end, the probability that

the state is |1⟩is measured as ⟨1| × ||ψm⟩|. This corresponds to testing the

second singular value in SVD. If the observed value for mode mis near 0, then

the corresponding qubit is weakly entangled with the rest of the system. Figure 1

shows the proposed algorithm in the form of tensor network computing.

3.2 Entanglement estimation with iterations

Above we discuss that SVD allows one to compute the Tucker decomposition

Ummatrices for each tensor mode m. Then the remaining part – the core ten-

sor – represents the ΣV †. If there is a disentangled (or weakly entangled) qubit

in a system, the second singular value Σ1,1is equal to 0 or close to it. This

indicates that the core tensor will have small values in the row 1: Σ1,1×V†

1,∗.

In the tensor form, these near-zero elements will be stored in the half of a core

tensor with mth index ﬁxed at 1. In Python, accordingly, they are accessed using

core[:,:,1,:]. This observation is mathematically equivalent to the properties

of the core tensor we showed in section 3.1. Based on this, we can propose a sim-

pliﬁed method which solves exactly the same problem, but examines the core

tensor without additional computations (contractions) after decomposition. The

method is asymptotically equivalent to the single_split strategy, presented

in [1], but we signiﬁcantly reduce space and time using a single Tucker decompo-

sition instead of multiple SVD runs. We provide a time and memory comparison

in section 4. The algorithm1is given in Listing 1.

Listing 1.1: Entanglement estimation for distinct qubits

T = . . . # tensor

c o re , m a t r i c e s = t u c k e r ( T, T . s h a pe )

e n ta n g le m e n ts = np . z e r o s ( ( T. ndi m , ) )

for id x i n i t e r t o o l s . p r o d uc t ( [ 0 , 1 ] , r e p e a t=T . n dim ) :

for i , v in enumerate ( i d x ) :

i f v == 1: en t a ng l e me n t s [ i ] += abs ( c o r e [ i d x ] ) ∗ ∗ 2

4 Practical comparison

We compare our methods to the solution implemented in [1]. Mathematically,

these methods answer the same question, but Tucker decomposition shows sys-

tematically better times.

In Figure 2a we show the time that each method takes to ﬁnd the minimally

entangled qubit, and then prepare the state vector decomposition. Each system

1Code and tests for both methods are here: github.com/IUCVLab/approx- q-state

Title Suppressed Due to Excessive Length 5

size was tested 25 times, the values are given together with ±σinterval (trans-

parent). Note that the time is shown on a logarithmic scale. For 15 qubits, both

proposed methods take two orders less time than multiple SVD runs.

(a) Total time to ﬁnd the least entan-

gled qubit and prepare the decomposi-

tion. Values are given in log scale.

(b) Memory consumption by the meth-

ods. Values are gived in the log scale.

Fig. 2: Time and memory consumption for entanglement analysis methods.

To assess memory consumption, we measured the resident set size (RSS)

diﬀerence between the method launch and the peak value. RSS is the amount of

process virtual memory allocated in the physical RAM. We plotted maxima of

25 experiments in Figure 2b. For a small tensor size, this method may return 0,

as memory can be reused from the previous allocations. Still, the graph shows a

trend of growing memory consumption for all three methods. Also we see that

the counting methods takes signiﬁcantly less memory compared to both iterative

SVD and proposed contraction-based method.

5 Conclusion

Entanglement analysis is a crucial step if we want to distribute the computational

load between the QPU and the CPU. Optimally, QPU should be utilized for the

computational tasks, in which it shows supremacy. Here, we address the task of

quantum state initialization, which (with current quantum algorithms) does not

provide any improvement.

In this work, we proposed to use the Tucker decomposition for qubit entan-

glement analysis instead of the widely used SVD. With two algorithms which

analyze the core tensor of Tucker decomposition (Figure 1, Listing 1), we showed

as least two orders improvement in time. We also detected signiﬁcantly smaller

memory consumption.

Current study addressed only the case with a single qubit analysis. In future

work, the method must be carefully generalized to arbitrary subsystem sizes.

Preliminary experiments showed that for 2-entangled subsystems, this can be

done similarly, but 3-entangled systems should be addressed diﬀerently.

6 S. Protasov and M. Lisnichenko

References

1. Araujo, I.F., Blank, C., da Silva, A.J.: Approximated quantum-state preparation

with entanglement dependent complexity (2021). https://doi.org/10.48550/

ARXIV.2111.03132. URL https://arxiv.org/abs/2111.03132

2. Biamonte, J., Bergholm, V.: Tensor networks in a nutshell (2017). https://doi.

org/10.48550/ARXIV.1708.00006. URL https://arxiv.org/abs/1708.00006

3. De Lathauwer, L., De Moor, B., Vandewalle, J.: A multilinear singular value de-

composition. SIAM Journal on Matrix Analysis and Applications 21(4), 1253–1278

(2000). https://doi.org/10.1137/S0895479896305696. URL https://doi.org/

10.1137/S0895479896305696

4. Duncan, R., Kissinger, A., Perdrix, S., van de Wetering, J.: Graph-theoretic sim-

pliﬁcation of quantum circuits with the zx-calculus. Quantum 4, 279 (2020).

https://doi.org/10.22331/q-2020-06-04- 279. URL http://dx.doi.org/10.

22331/q-2020-06-04- 279

5. Eddins, A., Motta, M., Gujarati, T.P., Bravyi, S., Mezzacapo, A., Hadﬁeld, C.,

Sheldon, S.: Doubling the size of quantum simulators by entanglement forging.

PRX Quantum 3(1) (2022). https://doi.org/10.1103/prxquantum.3.010309.

URL https://doi.org/10.1103/prxquantum.3.010309

6. Evenbly, G.: A practical guide to the numerical implementation of tensor networks

i: Contractions, decompositions, and gauge freedom. Frontiers in Applied Math-

ematics and Statistics 8(2022). https://doi.org/10.3389/fams.2022.806549.

URL https://www.frontiersin.org/articles/10.3389/fams.2022.806549

7. Golub, G., Kahan, W.: Calculating the singular values and pseudo-inverse of a

matrix. Journal of the Society for Industrial and Applied Mathematics Series B

Numerical Analysis 2(2), 205–224 (1965). https://doi.org/10.1137/0702016.

URL https://doi.org/10.1137/0702016

8. Grasedyck, L.: Hierarchical singular value decomposition of tensors. SIAM Journal

on Matrix Analysis and Applications 31(4), 2029–2054 (2010). https://doi.org/

10.1137/090764189. URL https://doi.org/10.1137/090764189

9. Harshman, R.A.: Foundations of the parafac procedure: Models and conditions for

an "explanatory" multi-model factor analysis (1970)

10. Hitchcock, F.L.: The expression of a tensor or a polyadic as a sum of products.

Journal of Mathematics and Physics 6(1–4), 164–189 (1927). https://doi.org/

10.1002/sapm192761164. URL http://dx.doi.org/10.1002/sapm192761164

11. Lathauwer, L.D., Moor, B.D., Vandewalle, J.: On the best rank-1 and rank-(r1 ,

r2, ... , rn) approximation of higher-order tensors. SIAM J. Matrix Anal. Appl.

21, 1324–1342 (2000)

12. Oseledets, I.V.: Tensor-train decomposition. SIAM Journal on Scientiﬁc Com-

puting 33(5), 2295–2317 (2011). https://doi.org/10.1137/090752286. URL

http://dx.doi.org/10.1137/090752286

13. Ricci, M.M.G., Levi-Civita, T.: Methodes de calcul diﬀerentiel absolu et leurs ap-

plications. Mathematische Annalen 54(1–2), 125–201 (1900). https://doi.org/

10.1007/bf01454201. URL http://dx.doi.org/10.1007/BF01454201

14. Shende, V.V., Bullock, S.S., Markov, I.L.: Synthesis of quantum-logic circuits.

IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems

25(6), 1000–1010 (2006)

15. Tucker, L.R.: Some mathematical notes on three-mode factor analysis. Psy-

chometrika 31(3), 279–311 (1966). https://doi.org/10.1007/bf02289464. URL

http://dx.doi.org/10.1007/BF02289464