Transpiler

import trueq as tq

# Define a device configuration.
config = tq.Config(
    """
    Name: Example
    Mode: ZXZXZ
    Gate Z:
        Hamiltonian:
            - ['Z', 'phi']
    Gate X:
        Hamiltonian:
            - ['X', 'phi']
    Gate CNOT:
        Matrix:
        - [1., 0., 0., 0.]
        - [0., 1., 0., 0.]
        - [0., 0., 0., 1.]
        - [0., 0., 1., 0.]
    """
)

# Make a transpiler based on the device configuration.
transpiler = tq.compilation.get_transpiler(config)

# Define a circuit.
circuit = tq.Circuit([{(0, 1): tq.Gate.swap}])
circuit
  • imm
    • (0, 1) Gate.swap
      • Name:

        • Gate.swap
      • Aliases:

        • Gate.swap
      • Likeness:

        • SWAP
      • Generators:

        • 'XX': 90.0
        • 'YY': 90.0
        • 'ZZ': 90.0
      • Matrix:



# Transpile the circuit based on the device.
transpiled_circuit = transpiler.compile(circuit)
transpiled_circuit
  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -127.249885
      • Generators:

        • 'Z': -127.25
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 60.635084
      • Generators:

        • 'Z': 60.635
      • Matrix:

  •  
    • (0) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

    • (1) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 162.225244
      • Generators:

        • 'Z': 162.225
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 145.20133
      • Generators:

        • 'Z': 145.201
      • Matrix:

  •  
    • (0) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

    • (1) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -71.340045
      • Generators:

        • 'Z': -71.34
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -257.802591
      • Generators:

        • 'Z': -257.803
      • Matrix:

  • imm
    • (0, 1) Example.cnot()
      • Name:

        • Example.cnot
      • Aliases:

        • Gate.cx
        • Gate.cnot
      • Generators:

        • 'IX': 90.0
        • 'ZI': 90.0
        • 'ZX': -90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -260.62688
      • Generators:

        • 'Z': -260.627
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 1.927162
      • Generators:

        • 'Z': 1.927
      • Matrix:

  •  
    • (0) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

    • (1) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Aliases:

        • Gate.s
        • Gate.cliff9
      • Parameters:

        • phi = 90.0
      • Generators:

        • 'Z': 90.0
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 90.072008
      • Generators:

        • 'Z': 90.072
      • Matrix:

  •  
    • (0) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

    • (1) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -114.785259
      • Generators:

        • 'Z': -114.785
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 2.13892
      • Generators:

        • 'Z': 2.139
      • Matrix:

  • imm
    • (0, 1) Example.cnot()
      • Name:

        • Example.cnot
      • Aliases:

        • Gate.cx
        • Gate.cnot
      • Generators:

        • 'IX': 90.0
        • 'ZI': 90.0
        • 'ZX': -90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -245.214741
      • Generators:

        • 'Z': -245.215
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -106.008581
      • Generators:

        • 'Z': -106.009
      • Matrix:

  •  
    • (0) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

    • (1) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 90.002635
      • Generators:

        • 'Z': 90.003
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 91.853773
      • Generators:

        • 'Z': 91.854
      • Matrix:

  •  
    • (0) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

    • (1) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -35.528934
      • Generators:

        • 'Z': -35.529
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -179.468247
      • Generators:

        • 'Z': -179.468
      • Matrix:

  • imm
    • (0, 1) Example.cnot()
      • Name:

        • Example.cnot
      • Aliases:

        • Gate.cx
        • Gate.cnot
      • Generators:

        • 'IX': 90.0
        • 'ZI': 90.0
        • 'ZX': -90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -247.364163
      • Generators:

        • 'Z': -247.364
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -252.898818
      • Generators:

        • 'Z': -252.899
      • Matrix:

  •  
    • (0) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

    • (1) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 147.290415
      • Generators:

        • 'Z': 147.29
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = 66.397117
      • Generators:

        • 'Z': 66.397
      • Matrix:

  •  
    • (0) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

    • (1) Example.x(phi)
      • Name:

        • Example.x
      • Aliases:

        • Gate.cliff5
      • Parameters:

        • phi = 90
      • Generators:

        • 'X': 90.0
      • Matrix:

  •  
    • (0) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -59.79849
      • Generators:

        • 'Z': -59.798
      • Matrix:

    • (1) Example.z(phi)
      • Name:

        • Example.z
      • Parameters:

        • phi = -164.938779
      • Generators:

        • 'Z': -164.939
      • Matrix:



Total running time of the script: ( 0 minutes 0.383 seconds)

Gallery generated by Sphinx-Gallery