I am a software developer and I would like to learn how to do create programs for…
- User
I am a software developer and I would like to learn how to do create programs for quantum computers. What are the steps I should take?
- Assistant
i am new here
- User
Quantum computers are yet to be released to the public. There are however already some programming languages that simulate the underlying workings of such devices by using a simulated quantum instruction set. An example of one of these programming languages might be Qiskit which is developed by IBM or Cirq which is being developed by Google.
- Assistant
You could use the python programming language with the pyQuil library to start making the program. This is an example from the website https://medium.com/ that roll a dice to get a random numbers: '
Import pyQuil modules
from pyquil.quil import Program from pyquil.api import QVMConnection from pyqyil.gates import H from functools import reduce
Create a connection to the Quantum Virtual Machine (QVM)
qvm = QVMConnection()
Apply the Hadamard gate to three qubits to generate 8 possible randomized results
dice = Program(H(0), H(1), H(2))
8 possible results: [[0,0,0], [0,0,1], [0,1,1], [1,1,1], [1,1,0], [1,0,0], [0,1,0]] [0,0,1]]
Measure the qubits to get a result, i.e. roll the dice
roll_dice = dice.mesure_all()
Execute the program by running it with the QVM
result = qvm.run(roll_dice)
Example result: [[0,1,0]]
Format and print the result as a dice value between 1 and 8
dice_value = reduce (lambda x, y: 2*x + y, result[0], 0) + 1 print("Your quantum dice roll returned: ", dice_value) ' For extensive explications on the program please visit https://medium.com/rigetti/how-to-write-a-quantum-program-in-10-lines-of-code-for-beginners-540224ac6b45 .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →