Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
量子计算机编程:从入门到实践
by
Eric R. Johnston
,
Nicholas Harrigan
,
Mercedes Gimeno-Segovia
July 2021
Beginner to intermediate
274 pages
7h 10m
Chinese
Posts & Telecom Press
Content preview from
量子计算机编程:从入门到实践
多个量子比特
|
53
3.11
实践
:
远程控制随机性
借助多量子比特运算,我们可以利用一个远程控制随机数生成的小型
QPU
程序,来探索
量子纠缠的一些有趣但不明显的特性。这个程序将生成两个量子比特,读取其中一个量子
比特会立即影响另一个量子比特读取结果的概率,而且这种影响不受空间或时间限制。借
助
QPU
,这个看似不可能完成的任务实现起来异常简单。
下面介绍这种远程控制的原理。我们以这种方式操作一对量子比特:读取其中任何一个量
子比特都将返回一个随机值(出现概率为
50%
),这个值会告诉我们另一个量子比特读取
结果的概率。如果返回的随机值为
0
,那么从另一个量子比特读出
1
的概率为
15%
。反之,
如果返回
1
,那么从另一个量子比特读出
1
的概率为
85%
。
示例
3-6
展示了如何实现上述远程控制的随机数生成器。如同在示例
3-1
中所做的那样,
我们使用
QCEngine
的
qint
对象轻松地跟踪量子比特组。
示例代码
请在
http://oreilly-qc.github.io?p=3-6
上运行本示例。
示例
3-6
远程控制随机性
qc
.
reset
(2);
var
a
=
qint
.
new
(
1
,
'a'
);
var
b
=
qint
.
new
(
1
,
'b'
);
qc
.
write
(
0
);
a
.
had
();
//
现在
a
的概率是
50%
b
.
had
();
b
.
phase
(
45
);
b
.
had
();
//
现在
b
的概率是
15%
b
.
cnot
(
a
);
//
读取任意一个量子比特,结果的概率是
50%
//
如果结果为
0
,那么另一个量子比特为
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
JAVASCRIPT之美|聽頂尖程式設計師闡述他們的思維
Anton Kovalyov
Go程序设计语言
艾伦A. A.多诺万, 布莱恩W. 柯尼汉
C++语言导学(原书第2版)
本贾尼 斯特劳斯特鲁普
监控运维实践:原则与策略
Mike Julian
Publisher Resources
ISBN: 9787115566355