Qotlin
IBM Q Experience Kotlin toolkit - Kotlin library to interact and write assembly code for IBM Quantum computers
Install / Use
/learn @ssuukk/QotlinREADME
Qotlin
This is a Kotlin library for developing, deploying and running quantum assembler (QASM) programs on quantum computers available in IBM Q Experience program.
See below to get a taste:
object Main {
@JvmStatic
fun main(args: Array<String>) {
val qex = Qotlin()
qex.login("YOUR_API_TOKEN_HERE")
qex.enumerateDevices()
println("Currently available:")
qex.devices.forEach {
println(it)
}
println("\nRunning Bell state experiment")
qex.simulator
.submitJob(256, 1, qasm {
qreg(2)
creg(5)
h(0)
cx(0, 1)
measure(0, 1)
measure(1, 1)
})
.onStatus(60,
{
finishedJob ->
finishedJob.qasms?.forEach {
qasm ->
println(qasm.result)
}
},
{
println("Job failed")
}
)
println("Running quantum Fourier transform")
//qex.devices.firstOrNull { !it.simulator }
qex.simulator
?.submitJob(256,100, qasm {
// quantum Fourier transform
qreg(4)
creg(4)
x(0)
x(2)
barrier()
h(0)
cu1(Math.PI/2,1,0)
h(1)
cu1(Math.PI/4,2,0)
cu1(Math.PI/2,2,1)
h(2)
cu1(Math.PI/8,3,0)
cu1(Math.PI/4,3,1)
cu1(Math.PI/2,3,2)
h(3)
measure()
})
?.onStatus(500,{
finishedJob ->
finishedJob.qasms?.forEach {
qasm ->
println(qasm.result)
}
},{
})
}
}
Prerequisites
Obtain an API key at (https://quantumexperience.ng.bluemix.net/qx/experience)
Built With
Authors
- ssuukk - Initial work
License
This project is licensed under the Apache License - see the LICENSE.md file for details
Related Skills
node-connect
349.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.7kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
