1 Star 0 Fork 0

百度开源/QComputeSDK-TS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

QComputeSDK-TypeScript

QComputeSDK-TypeScript 是量易伏的量子开发套件 QCompute 的 TypeScript 语言版本,用于设计量子实验,包括编写量子电路、操控量子模块组件、提交计算任务到量易伏运行(https://quantum-hub.baidu.com),包括量子计算机和云端模拟器在内的量子端,都对 QComputeSDK-TypeScript 开放。

QComputeSDK-TypeScript 适用于以下情况:

  • 目标平台不支持 Python。
  • 目标平台依赖 TypeScript、JavaScript 包或其他语言。
  • 用户有在 Web 或者 ReactNative 等前端使用 QComputeSDK 的需求。

除以上情况外,强烈建议开发者使用功能更为全面的 QComputeSDK-Python,参考功能对比https://github.com/baidu/QCompute

平台依赖

代码跨平台,可在支持 Node.js 的任意环境下运行。

  • Node.js >=19.4.0
  • TypeScript >=4.9.4

安装和执行

配置环境

  1. 安装 Node.js 执行环境: https://nodejs.org

  2. 安装 TypeScript 编译器:

npm install -g typescript
npm install -g ts-node

安装 QComputeSDK-TypeScript

方法一:NPM 安装

npm install qcomputesdk-ts

方法二:源代码安装

  1. 下载 QComputeSDK-TypeScript 源代码:
git clone https://github.com/baidu/QComputeSDK-TS.git
  1. 下载 NPM 依赖
cd QComputeSDK-TS
npm i

运行示例代码

运行示例代码 QComputeSDK-TS\Example\GHZ_Cloud.ts

  1. GHZ_Cloud.ts 中填入 Token。Token 是用户使用云端量子计算资源的授权凭据。登录量易伏官网(https://quantum-hub.baidu.com)获取。
// Your token:
Define.hubToken = '';
  1. 运行示例代码:
ts-node Example/Level_1/GHZ_Cloud.ts
  1. 结果如下显示:
    Circuit upload successful, circuitId => 165538 taskId => 162654
    Task 162654 is running, please wait...
    status changed waiting => success
    Download origin success /home/user/QComputeSDK-TS/Output/remote.162654.origin.json size = 779
    Download measure success /home/user/QComputeSDK-TS/Output/remote.162654.measure.json size = 24
    {"counts":{"000":518,"111":506},"moduleList":[{"arguments":null,"module":"UnrollProcedureModule"},{"arguments":null,"module":"CompositeGateModule"},{"arguments":null,"module":"UnrollCircuitModule"},{"arguments":null,"module":"CompressGateModule"}],"origin":"/home/user/QComputeSDK-TS/Output/remote.162654.origin.json","status":"success","taskId":162654}
    done

开发者提示

  • 开发者可将 GHZ_Cloud.ts 作为代码框架,修改和使用这个文件可以有效帮助开发者熟悉本量子开发套件的语法。
  • API 说明请参考 使用说明.md

贡献

代码要求:

  1. 熟悉量子电路模型。任何提交前都应经过测试后再提交。注意量子位顺序

  2. 请遵守相关编程语言的开发规范。

讨论

  1. 如有任何问题及建议,请通过电子邮件联系我们:quantum@baidu.com

  2. 您也可以用 Quantum-hub(https://quantum-hub.baidu.com)中的意见反馈来联系我们;

  3. 诚邀您加入 QQ 群参与讨论,QQ 扫码或搜索群号 1147781135。

维护者 & 作者

百度量子计算研究所

License

该项目在 Apache 2.0 下获得许可 - 有关详细信息,请参阅 LICENSE 文件。

作者

  • 刘树森
  • 贺旸
  • 江云帆
  • 张文学
  • 孙文赟
  • 付永凡
  • 陈建萧
  • 沈豪杰
  • 吕申进
  • 王友琪
Copyright (c) 2022 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

QComputeSDK-TypeScript is the TypeScript version of QCompute, the quantum development kit of Quantum Leaf ( https://quantum-hub.baidu.com ). 展开 收起
TypeScript 等 2 种语言
Apache-2.0
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/baidu/qcomputesdk-ts.git
git@gitee.com:baidu/qcomputesdk-ts.git
baidu
qcomputesdk-ts
QComputeSDK-TS
master

搜索帮助

Cb406eda 1850385 E526c682 1850385