{"id":27990915,"url":"https://github.com/qcsim/qcsim","last_synced_at":"2025-08-15T17:05:39.188Z","repository":{"id":283900421,"uuid":"952502319","full_name":"qcsim/qcsim","owner":"qcsim","description":"A quantum computer simulation research project","archived":false,"fork":false,"pushed_at":"2025-04-22T22:19:22.000Z","size":149,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-01T19:50:23.482Z","etag":null,"topics":["go","golang","physics","qcsim","quantum-computing","simulation"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qcsim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-21T11:38:31.000Z","updated_at":"2025-04-22T22:19:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"7fbf92a5-f9e9-4133-a6a1-4d9549893136","html_url":"https://github.com/qcsim/qcsim","commit_stats":null,"previous_names":["noclaps/qcsim","qcsim/qcsim"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qcsim%2Fqcsim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qcsim%2Fqcsim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qcsim%2Fqcsim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qcsim%2Fqcsim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qcsim","download_url":"https://codeload.github.com/qcsim/qcsim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253111737,"owners_count":21856065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","physics","qcsim","quantum-computing","simulation"],"created_at":"2025-05-08T16:52:14.746Z","updated_at":"2025-08-15T17:05:39.175Z","avatar_url":"https://github.com/qcsim.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quantum Computer Simulation\n\nThis is a quantum computer simulation research project. It's probably not accurate to a real quantum computer.\n\n## Build instructions\n\nYou'll need to have [Go](https://go.dev) installed.\n\n```sh\ngit clone https://github.com/qcsim/qcsim.git \u0026\u0026 cd qcsim\ngo run .\n```\n\n## Usage\n\nYou should start by creating new qubits:\n\n```go\nimport (\n\t\"math/cmplx\"\n\n\t\"github.com/qcsim/qcsim/qubit\"\n)\n\nfunc main() {\n\tq0 := qubit.New(1/cmplx.Sqrt(2), 1/cmplx.Sqrt(2))\n\tq1 := qubit.New(1, 0)\n\tq2 := qubit.New(0, 1)\n}\n```\n\nThen you can initialise a computer with those qubits:\n\n```go\nimport (\n\t// ...\n\n\t\"github.com/qcsim/qcsim/computer\"\n)\n\nfunc main() {\n\t// ...\n\n\tqc := computer.New([]qubit.Qubit{q0, q1, q2})\n}\n```\n\nThis will add your qubits to the computer in the order that you put them in the array. After this, you can use array indexing to apply operations to the qubits in the computer, using the gates you have available:\n\n- `PauliX`\n- `PauliY`\n- `PauliZ`\n- `Hadamard`\n- `Phase`\n- `PiBy8`\n- `ControlledNot`\n- `ControlledZ`\n- `Swap`\n- `Toffoli`\n\nFor example:\n\n```go\nfunc main() {\n\t// ...\n\n\tif err := qc.Hadamard(0); err != nil {\n\t\tslog.Error(\"Error performing Hadamard\", \"error\", err)\n\t}\n\tif err := qc.PauliX(0); err != nil {\n\t\tslog.Error(\"Error performing Pauli X\", \"error\", err)\n\t}\n\tif err := qc.PauliX(1); err != nil {\n\t\tslog.Error(\"Error performing Pauli X\", \"error\", err)\n\t}\n\tif err := qc.Toffoli(0, 1, 2); err != nil {\n\t\tslog.Error(\"Error performing Toffoli\", \"error\", err)\n\t}\n}\n```\n\nOnce you're done, you can output the state of the system using `Measure`:\n\n```go\nfunc main() {\n\t// ...\n\n\tvar measureCount uint = 100000\n\tfmt.Println(qc.Measure(measureCount))\n}\n```\n\nIf the measure count is 1, then simply the state of the system will be returned, but if it is greater than 1, then a table with the state and its corresponding count will be returned.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqcsim%2Fqcsim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqcsim%2Fqcsim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqcsim%2Fqcsim/lists"}