Skip to content

0.3.0

Compare
Choose a tag to compare
@thisac thisac released this 18 Jul 18:58
· 8 commits to master since this release
f3d7895

New Features

  • Adds support for compiling circuits into the Quantum Intermediate Representation (QIR) language using PyQIR API and qirlib LLVM wrapper.

      circuit = Circuit(2)
    
      with circuit.context as reg:
          ops.X(reg.q[0])
          ops.Y(reg.q[1])
    
      qir_string = circuit.to_qir()

    Circuits can also be compiled directly into bitcode.

      qir_string = circuit.to_qir(bitcode=True)
  • Adds a Quantum Intermediate Representation (QIR) loader which consumes a QIR script and returns a corresponding circuit containing the same instruction.

      ; ModuleID = 'Citrus'
      source_filename = "Citrus"
    
      %Qubit = type opaque
    
      define void @main() {
        entry:
        call void @__quantum__rt__initialize(i8* null)
        call void @__quantum__qis__x__body(%Qubit* null)
        call void @__quantum__qis__y__body(%Qubit* inttoptr (i64 1 to %Qubit*))
        ret void
      }
    
      declare void @__quantum__rt__initialize(i8*)
      declare void @__quantum__qis__x__body(%Qubit*)
      declare void @__quantum__qis__y__body(%Qubit*)
    

    The above QIR script can be loaded into a dwave-gate circuit using the dwave.gate.qir.loader.load_qir_string function.

      from dwave.gate.qir.loader import load_qir_string
    
      circuit = load_qir_string(qir_string, circuit=circuit)

Upgrade Notes

  • Upgrade circuit call to accept classical bits in which to store measurement values. If no bits are passed to the circuit call, measurements will not be stored when circuit is simulated.

      circuit = Circuit(2, 2)
    
      with circuit.context as (q, c):
          ops.Hadamard(q[0])
          ops.Hadamard(q[1])
          ops.Measurement(q) | c
    
      circuit_2 = Circuit(2, 2)
    
      with circuit_2.context as (q, c):
          circuit(q, c)  # pass bits to 'circuit'

Deprecation Notes

  • Support for Python 3.7 deprecated.

Bug Fixes

  • Fix return type from Operation.__call__ and subclasses.

  • Fixes loading QIR scripts with a return mid-function.

  • Fix circular import issue when importing the simulator prior operations.