Package: quantumcat
Introductionquantumcat is a platform-independent, open-source, high-level quantum computing library, which allows the quantum community to focus on developing platform-independent quantum applications without much effort.It is based on two principles:Write once and execute on any supported quantum provider using one syntaxquantumcat should enable researchers and developers to create quantum applications using high-level programming in the future so that they can focus on developing quantum applications instead of learning low-level concepts such as gates and circuitsWrite oncefromquantumcat.utilsimportprovidersnum_of_qubits=2qc=QCircuit(num_of_qubits)qc.h_gate(0)qc.cx_gate(0,1)# To execute on Google Cirqresult=qc.execute(provider=providers.GOOGLE_PROVIDER,repetitions=1024)# To execute on IBM Qiskitresult=qc.execute(provider=providers.IBM_PROVIDER,repetitions=1024)# To execute on Amazon Braketresult=qc.execute(provider=providers.AMAZON_PROVIDER,repetitions=1024)Compare the results of all the supported providers with a single line of code# Execute on All providers in one gocircuit.compare_results(plot=True)Execute on real IBM quantum hardware with quantumcatfromquantumcat.utilsimportprovidersresult=qc.execute(provider=providers.IBM_PROVIDER,api='API KEY from IBM Quantum dashboard',device='IBM DEVICE NAME such as ibmq_manila or ibmq_quito')# Copy API and Device name from https://quantum-computing.ibm.com/InstallationpipinstallquantumcatPlatforms SupportedGoogle CirqIBM QiskitAmazon BraketIonQ (Via Braket)Rigetti (Via Braket)Gates SupportedClick here to view gates supportedExamplesCircuit Creationfromquantumcat.circuitimportQCircuitnum_of_qubits=3qc=QCircuit(num_of_qubits)Single-Qubit Gateqc.x_gate(0)# applies X gate on qubit 0Two-Qubit Gateqc.cx_gate(0,1)# control qubit, target qubitMulti-Qubit Gateqc.mct_gate([0,1],2)# control qubits array, target qubitDraw Circuitfromquantumcat.utilsimportprovidersqc.draw_circuit(provider=providers.GOOGLE_PROVIDER)High-Level FunctionsSuperpositionqc.superposition(0)# puts qubit 0 in superpositionEntanglementqc.entangle(0,1)# entangles qubit 0 with qubit 1Phase Kickbackqc.phase_kickback(0)# applies |-> to qubit 0High-Level ApplicationsRandom Number Generatorfromquantumcat.utilsimportproviders,constantsfromquantumcat.applications.generatorimportRandomNumberrandom_number=RandomNumber(length=2,output_type=constants.DECIMAL).execute(provider=providers.GOOGLE_PROVIDER)print(random_number)# To generate random number on actual IBM devicerandom_number=RandomNumber(length=2,output_type=constants.DECIMAL).execute(provider=providers.IBM_PROVIDER,repetitions=1024,api='API KEY from IBM Quantum dashboard'device='IBM DEVICE NAME such as ibmq_manila or ibmq_quito')print(random_number)Password Generatorfromquantumcat.applications.generatorimportPasswordpassword=Password(8).generate()print(password)# Length should be between 5 - 20# Password is generated in hexadecimal format using QRNG@ANU JSON APIOTP Generatorfromquantumcat.applications.generatorimportOTPotp=OTP().generate()print(otp)# 5 digits OTP is generated using QRNG@ANU JSON APIVisualizationHistogramcircuit=QCircuit(1)circuit.superposition(0)counts=circuit.execute(provider=providers.GOOGLE_PROVIDER,repetitions=1024)circuit.histogram(counts)Bloch Multivectorcircuit=QCircuit(1)circuit.superposition(0)state=circuit.execute(provider=providers.GOOGLE_PROVIDER,simulator_name=constants.STATEVECTOR_SIMULATOR)circuit.bloch_multivector(state)QSpherecircuit=QCircuit(1)circuit.superposition(0)state=circuit.execute(provider=providers.GOOGLE_PROVIDER,simulator_name=constants.STATEVECTOR_SIMULATOR)circuit.state_qsphere(state)LicenseApache License 2.0