Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 1.47 KB

File metadata and controls

24 lines (19 loc) · 1.47 KB

DeepQuantumNeuralNetworks-Mathematica

Language View notebooks

This Mathematica notebook can be used to classically simulate deep quantum neural networks as proposed in

K. Beer, D. Bondarenko, T. Farrelly, T. J. Osborne, R. Salzmann, and R. Wolf. Training deep quantum neural networks. Nat Commun 11, 808 (2020).

Compared to the original repo of the authors, this code has been rewritten in a more Mathematica-like fashion. In addition, its efficiency has also been dramatically improved, as we introduce a new function for the Partial Trace:

PartialTrace[densityMatrix_, traceList_, quditDim_ : 2] := 
    Module[{t = Flatten@{traceList}, qubitNum = Log[quditDim, Length@densityMatrix]}, 
        ArrayReshape[
            TensorContract[
                ArrayReshape[
                    densityMatrix, Table[quditDim, 2 qubitNum]
                ], Table[{i, i + qubitNum}, {i, t}]
            ], {quditDim^(qubitNum - Length@t), quditDim^(qubitNum - Length@t)}
        ]
    ]

This is the very initial version, detailed comments of the code will be updated in the near future.