Package: qiskit-sliqsim-provider
SliQSim Qiskit Interface - Execute SliQSim on QiskitIntroductionThis is a Qiskit provider forSliQSimwhere you can executeSliQSimfrom Qiskit framework as a backend option.SliQSimis a BDD-based quantum circuit simulator implemented in C/C++ on top ofCUDDpackage. InSliQSim, a bit-slicing technique based on BDDs is used to represent quantum state vectors. For more details of the simulator, please refer to thepaper.InstallationTo use this provider, one should first install IBM'sQiskit(<=0.36.2), and then install the provider with pip.pip install qiskit==0.36.2
pip install qiskit-sliqsim-providerExecutionThe gate set supported in SliQSim now contains Pauli-X (x), Pauli-Y (y), Pauli-Z (z), Hadamard (h), Phase and its inverse (s and sdg), π/8 and its inverse (t and tdg), Rotation-X with phase π/2 (rx(pi/2)), Rotation-Y with phase π/2 (ry(pi/2)), Controlled-NOT (cx), Controlled-Z (cz), Toffoli (ccx and mcx), SWAP (swap), and Fredkin (cswap).For simulation types, we provide both sampling(default) and statevector simulation options, where the sampling simulation samples outcomes from the output distribution obtained after the circuit is applied, and the statevector simulation calculates the resulting state vector of the quantum circuit. Please turn off the optimization (optimization_level=0) to avoid using gates out of supported gate set. The following examples demostrate the usage of the provider.# Import toolsfromqiskitimportQuantumCircuit,QuantumRegister,ClassicalRegister,executefromqiskit_sliqsim_providerimportSliQSimProvider# Initiate SliQSim Providerprovider=SliQSimProvider()# Construct a 2-qubit bell-state circuitqr=QuantumRegister(2)cr=ClassicalRegister(2)qc=QuantumCircuit(qr,cr)qc.h(qr[0])qc.cx(qr[0],qr[1])qc.measure(qr,cr)# Get the backend of sampling simulationbackend=provider.get_backend('sampling')# Execute simulationjob=execute(qc,backend=backend,shots=1024,optimization_level=0)# Obtain and print the resultsresult=job.result()print(result.get_counts(qc))In the abovePython code, we construct a 2-qubit bell-state circuit with measurement gates at the end, and execute the simulator with sampling simulation backend optionsampling. The sampled result is then printed:{'00': 523, '11': 501}Circuits can also be read from files inOpenQASMformat, which is used by Qiskit. Here we read acircuit, which is also a 2-qubit bell-state circuit but with no measurements gates, to showcase the statevector simulation:qc=QuantumCircuit.from_qasm_file("../SliQSim/examples/bell_state.qasm")To execute the statevector simulation, the backend optionsamplingis replaced withall_amplitude:backend=provider.get_backend('all_amplitude')job=execute(qc,backend=backend,optimization_level=0)and after obtaining the results, we acquire the state vector instead of the counts of sampled outcomes:result=job.result()print(result.get_statevector(qc))The state vector is then printed:[0.707107+0.j 0.      +0.j 0.      +0.j 0.707107+0.j]One may also use our simulator by executing a compiled binary file. Check thisrepo.CitationPlease cite the following paper if you use our simulator for your research:Y. Tsai, J. R. Jiang, and C. Jhang, "Bit-Slicing the Hilbert Space: Scaling Up Accurate Quantum Circuit Simulation to a New Level," 2020, arXiv: 2007.09304@misc{tsai2020bitslicing,title={Bit-Slicing the Hilbert Space: Scaling Up Accurate Quantum Circuit Simulation to a New Level},author={Yuan{-}Hung Tsai and Jie{-}Hong R. Jiang and Chiao{-}Shan Jhang},year={2020},note={arXiv: 2007.09304}}ContactIf you have any questions or suggestions, feel free tocreate an issue, or contact us throughmatthewyhtsai@gmail.com.