File:Qcircuit CNOTsqrtSWAP2.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 1,878 × 348 pixels, file size: 18 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Quantum circuit diagram constructing a controlled NOT (CNOT) gate from Sqrt(SWAP) gates and single-qubit operations.
    Date
    Source Own work
    Author Geek3
    Other versions Qcircuit CNOTfromSQRTSWAP.svg
    SVG development
    InfoField
     The SVG code is valid.
     This vector image was created with LaTeX.
    output: (1000010000010010)
    Source code
    InfoField
    Created in LaTeX using Q-circuit by the following code:
    \documentclass[border=10pt]{standalone}
    \input{Qcircuit} % available on https://physics.unm.edu/CQuIC/Qcircuit/
    \usepackage{graphicx}
    \newcommand{\qwxo}[2][-1]{\ar @{-} [#1,0]|*+<4pt,6pt>[Fo]{#2}}
    \begin{document}
    \scalebox{5}{%
    \Qcircuit @C=1.4em @R=1.8em {
    	& \ctrl{1} & \qw & \raisebox{-8ex}{=} & & \qw & \qswap & \gate{Z} & \qswap & \qw & \gate{R_Z(-\textstyle\frac\pi2)} & \qw \\
    	& \targ & \qw & & & \gate{R_Y(\textstyle\frac\pi2)} & \qswap\qwxo{\scalebox{0.7}{$1\hspace{-1pt}/\hspace{-1pt}2$}} & \qw & \qswap\qwxo{\scalebox{0.7}{$1\hspace{-1pt}/\hspace{-1pt}2$}} & \gate{R_Z(-\textstyle\frac\pi2)} & \gate{R_Y(-\textstyle\frac\pi2)} & \qw
    }}
    \end{document}
    
    Postprocessing with pdf2svg, Inkscape and Scour:
    x=Qcircuit_CNOTsqrtSWAP2;
    pdflatex $x.tex;
    pdf2svg $x.pdf $x_.svg;
    inkscape --verb=EditSelectAll --verb=SelectionUnGroup --verb=FileVacuum --verb=FileSave --verb=FileClose $x_.svg;
    scour -i $x_.svg -o $x.svg --renderer-workaround --remove-metadata --enable-id-stripping --create-groups --enable-viewboxing
    
    The following Mathematica code shows the equality:
    R[x_, y_, z_] := MatrixExp[-I/2 Sum[{x, y, z}[[i]] * PauliMatrix[i], {i, 3}]];
    I2 = IdentityMatrix[2];
    A_\[CircleTimes] B_ := KroneckerProduct[A, B];
    Z = R[0, 0, Pi];
    SqrtSwap = MatrixPower[{{1,0,0,0}, {0,0,1,0}, {0,1,0,0}, {0,0,0,1}}, 1/2];
    (* Note that the order of operators must be reversed *)
    (R[0, 0, -Pi/2]\[CircleTimes](R[0, -Pi/2, 0].R[0, 0, -Pi/2])).SqrtSwap.(Z\[CircleTimes]I2).SqrtSwap.(I2\[CircleTimes]R[0, Pi/2, 0]) // MatrixForm
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

    Captions

    Quantum circuit diagram constructing a controlled NOT (CNOT) gate from Sqrt(SWAP) gates and single-qubit operations

    Items portrayed in this file

    depicts

    17 May 2021

    image/svg+xml

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current09:13, 17 May 2021Thumbnail for version as of 09:13, 17 May 20211,878 × 348 (18 KB)wikimediacommons>Geek3Uploaded own work with UploadWizard

    There are no pages that use this file.