Quantum Dice !

<Proof & Explain>

量子骰?

利用量子位元的疊加態特性,

將\(N\)個量子位元的測量結果作為選擇。

\((N\in\mathbb{N})\)

  • Quantum Random Walk

可以做什麼?

為什麼要製作量子骰?

  • 公正無偏差

  • 好奇心

  • 訓練自己的思考邏輯

(Equal - Probability version)

基本的量子骰

  • \(2^{n}\) 面骰

...

...

只有\(2^{n}\)?

  • N in \(2^{i}\)

\(i=\lceil \log_{2}N\rceil\)

\(P(re-measure)=1-\frac{N}{2^{i}}\)

\(\uparrow minium\ needed\ qubit\ count\)

不想重丟?

那就嚴格定義

 

\(|\varphi_{i}\rangle=\frac{1}{\sqrt{N}}(\sum_{n=0}^{N-1}|n_{2}\rangle)\)

\(\ni P(re-measure)=0\)

  • \(Ry(\theta),\ Rx(\theta)\)... 微調

\(|0\rangle \rightarrow \sqrt{1-\beta}|0\rangle + \sqrt{\beta}|1\rangle\)

 

\(Ry(2sin^{-1}(\sqrt{\beta}))|0\rangle\)

\(N=a_{0}2^{0} + a_{1}2^{1} + a_{2}2^{2} + a_{3}2^{3} + ...\)

想法

\(\rightarrow 7=4+2+1\)

\(7Face=4Face+2Face+1Face\)

0 1 0 1 0 1 0

0 0 1 1 0 0 1

0 0 0 0 1 1 1

(1)

(2)

優點

  • 有系統

缺點

  • 迴路width、depth太大

可以丟給電腦算

操作必有誤差(目前)

width(4)

depth(10)

11934 - Face Dice

  • Width:26

  • Depth:109

改善方法

  • 使用多個量子位元  \((Width\uparrow)\)

  • 善用reset()

  • 質因數分解

  • 迴路優化

  • 善用reset() + 質因數分解 + 迴路優化

(Most ideal way)

11934 - Face Dice

(After using reset())

  • Width:\(26\rightarrow 16\)

  • Depth:\(109\rightarrow 96\)

質因數分解優化

\(N=\prod_{i=1}^{\omega(N)}p_{i}^{a_{i}},\ p=prime\)

\(N=p_1 \otimes p_2 \otimes p_3 \otimes p_4 \otimes p_5 \otimes p_6\ ... \)

\(\downarrow k=k_{face}\)

\(max(p_1\otimes p_2)=(p_{1}-1)_2^{c}+(p_{2}-1)_2^{c}\)

\(Ex:1_{10}+1_{10}=11_{10}\)

 

\(Ex:10_2+10_2=1010_2=10_{10}\)

\(x_{k}^{c}+y_{k}^{c}=x_{k}\otimes y_{k}=x_{10}\cdot k^{\left \lfloor \log_{k}y_{10} \right \rfloor +1}+y_{10}\)

\(ideal:(p_{1}-1)_2^{c}+(p_{2}-1)_2^{c}=p_{1}p_{2}-1\)

\(\rightarrow (p_{1}-1)2^{\left \lfloor \log_2(p_{2}-1) \right \rfloor +1}+(p_{2}-1)=p_{1}p_{2}-1\)

\(...\)

\(\rightarrow p_{2}\in 2^{k},\ k \in \mathbb{N}\)

\(or\ p_1=1\rightarrow\) 不合

\(\because prime\ factorization\ of\ N\)

 

\(\therefore if\ p_{2}=2^{k},\ p_{2}=2\)

\(if\ p_{2} \neq 2,\ max(p_{1}\otimes p_{2})>p_{1}p_{2}-1\)

是第幾個?

\(|\varphi_{98}\rangle=7\otimes 7\otimes 2\)

\(if\ |\varphi_{98}\rangle (Observe)=1010001\)

\(1010001=101\otimes 000\otimes 1\)

\(101\mapsto 6,\ 000\mapsto 1,\ 1\mapsto 2\)

\(\rightarrow result=6\cdot 1\cdot 2=12\)

(0~...)

既然是組合體,那就拆開看。(?)

真的是這樣嗎?

如果...

\(N=15=5\cdot 3\)

\(\rightarrow result_1=00010\)

\(\rightarrow result_2=01000\)

\(result_1=000^c + 10^c=1\cdot 3=3\)

\(result_2=010^c+00^c=3\cdot 1=3\)

\(result_1 = result_2\)

?!?!?!??!?!?!

這顯然不太對。

注意,我們得出的字串為一複合進位數。

在這個例子中它是一個\((5^c+3^c)\)進位的數字。

所以將會需要經過適當的轉譯

才可得出我們要的正確答案

正確轉譯方式請看此hackmd中的

"基於複數個有序集合乘積的複合質數進位制轉譯"

章節

11934 - Face Dice

(After using reset() & factorization)

  • Width:\(16\rightarrow 17\)

  • Depth:\(96\rightarrow 13\)

優化方式 extra

(字串優化 + \(H\ Gate\) 干涉原理)

\(7\) 除了可以被寫成 \(4+2+1\),

也相當等於 \(8-1\)。

因此可以利用公比為2的等比數列和原理,

對於一個範圍內之字串進行長度優化。

(可能的)

複雜度為\(O(\log(N))\)

可優化判定:

\(2(\Lambda(N_{n\ \sim\ m})-1)>i\)

其中 \(\Lambda\) 為 \(Digit\ sum\)

雖然在理論上是可做的,

但是實作上尚未發現可以處理複雜干涉與糾纏的問題,

因此尚在研究中...

#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;

int main() {
	long long int N;
	cin >> N;
	stack<short> N_2;
	while(N >= 2) {
		N_2.push(N%2);
		N = (N-(N%2))/2;
	}
	N_2.push(N);
	vector<short> N2;
	N2.push_back(0);
	while(!N_2.empty()) {
		N2.push_back(N_2.top());
		N_2.pop();
	}
	vector<short> coor;
	vector<short> value;
	for(int i = N2.size()-2; i >= 1; i--) {
		if(N2[i] == 1 && N2[i-1] == 0) {
			coor.push_back(i);
			short sum_pN = 0;
			for(int j = N2.size()-1; j >= i; j--) if(N2[j] == 1) sum_pN++;
			value.push_back(2*(sum_pN-1)-(N2.size()-i));
		}
	}
	for(auto i : N2) cout << i << ", ";
	cout << "\n";
	for(auto i : coor) cout << i << ", ";
	cout << "\n";
	for(auto i : value) cout << i << ", ";
	cout << "\n";
	
	cout << "As for the best results: ";
	short best = *max_element(value.begin(), value.end());
	cout << best << " string shorter\n";
	cout << "In coor: ";
	for(int i = 0; i < value.size(); i++) if(value[i] == best) cout << coor[i] << ", ";
	return 0;
}

ご覧になりまして

 

ありがとうございました。

演算法

N為面數,I為檢驗值\(2^{i_{N}-1}\),A為狀態陣列,Ry為旋轉數據陣列

A.push_back(1)

Ry.push_back(\(\frac{N-I}{N}\))

N -= I

A.push_back(0)

Ry.push_back(0)

I /= 2

\(N-I>=0\)?

yes

no

INI

END

if(N == 0)

程式碼

Quantum Dice

By phantom0174

Quantum Dice

To people who are into quantum dice.

  • 532