Skip to Content
量子计算机编程:从入门到实践
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 量子计算机编程:从入门到实践
146
9
9.1
 非整型数据
如何在
QPU
寄存器中编码非整型数据呢?以二进制表示这些值的两种常用方法是
定点
fixed point
)和
浮点
floating point
)。尽管浮点表示更为灵活(能够用一定数量的比特来
适应我们需要表示的值范围),但考虑到对量子比特的重视和对简单性的渴望,定点表示
在现阶段对我们更有吸引力。
定点表示将寄存器分成两部分,一部分对数值的整数部分进行编码,另一部分对小数部分
进行编码。整数部分使用标准二进制编码来表示,即高位的量子比特表示
2
的幂次增加。
与之相对,在寄存器的小数部分中,量子比特数位的
递减
表示
1/2
的幂次
递增
我们通常用
Q
表示法
来描述定点数(请注意,
Q
并不表示
quantum
)。这有助于区分寄存
器中的小数位结束位置和整数位开始位置。
Q
n
.
m
表示在
n
位寄存器中有
m
位为小数,也
就是说,剩余的
(
n
m
)
位为整数。当然,我们可以用这一表示法来指定如何使用
QPU
存器编码定点数。图
9-1
显示了以
Q8.6
定点编码方式对值
3.640625
进行编码的八量子比
特寄存器。
量子比特1
量子比特2
量子比特3
量子比特4
量子比特5
量子比特6
量子比特7
量子比特8
9-1:值 3.640625 Q8.6 定点编码方式,其二进制形式为 11101001
在这个例子中,我们成功地以定点数精确地编码了选定的数值,因为
3.640625 = 2
1
+ 2
0
+
1/2
1
+ 1/2
3
+ 1/2
6
。(太巧了!)当然,我们不可能总是这么幸运。增加定点寄存器整数部
分的位数会扩大它可以编码的整数范围,增加小数部分的位数则会提高小数部分的 ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JAVASCRIPT之美|聽頂尖程式設計師闡述他們的思維

JAVASCRIPT之美|聽頂尖程式設計師闡述他們的思維

Anton Kovalyov
C++语言导学(原书第2版)

C++语言导学(原书第2版)

本贾尼 斯特劳斯特鲁普

Publisher Resources

ISBN: 9787115566355