Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if QI_EMAIL is None or QI_PASSWORD is None:
print('Enter email:')
email = input()
print('Enter password')
password = getpass()
else:
email, password = QI_EMAIL, QI_PASSWORD
return get_basic_authentication(email, password)
if __name__ == '__main__':
name = 'TestProjectQ'
authentication = get_authentication()
qi_api = QuantumInspireAPI(QI_URL, authentication, project_name=name)
qi_backend = QIBackend(quantum_inspire_api=qi_api)
compiler_engines = restrictedgateset.get_engine_list(one_qubit_gates=qi_backend.one_qubit_gates,
two_qubit_gates=qi_backend.two_qubit_gates)
compiler_engines.extend([ResourceCounter()])
engine = MainEngine(backend=qi_backend, engine_list=compiler_engines)
qubits = engine.allocate_qureg(2)
q1 = qubits[0]
q2 = qubits[1]
H | q1
CNOT | (q1, q2)
All(Measure) | qubits
engine.flush()
if QI_EMAIL is None or QI_PASSWORD is None:
print('Enter email:')
email = input()
print('Enter password')
password = getpass()
else:
email, password = QI_EMAIL, QI_PASSWORD
return get_basic_authentication(email, password)
if __name__ == '__main__':
# Remote Quantum-Inspire backend #
authentication = get_authentication()
qi = QuantumInspireAPI(QI_URL, authentication)
qi_backend = QIBackend(quantum_inspire_api=qi)
compiler_engines = restrictedgateset.get_engine_list(one_qubit_gates=qi_backend.one_qubit_gates,
two_qubit_gates=qi_backend.two_qubit_gates,
other_gates=qi_backend.three_qubit_gates)
compiler_engines.extend([ResourceCounter()])
qi_engine = MainEngine(backend=qi_backend, engine_list=compiler_engines)
# Run remote Grover search to find a n-bit solution
result_qi = run_grover(qi_engine, 3, alternating_bits_oracle)
print("\nResult from the remote Quantum-Inspire backend: {}".format(result_qi))
# Local ProjectQ simulator backend #
compiler_engines = restrictedgateset.get_engine_list(one_qubit_gates="any", two_qubit_gates=(CNOT, CZ))
compiler_engines.append(ResourceCounter())
local_engine = MainEngine(Simulator(), compiler_engines)