澳洲CS代写 | COMP SCI 4413, 4813, 7413 Assignment 2

本次澳洲CS代写主要是使用C/C++/Java/Python中任意一门编程语言实现电路模拟

COMP SCI 4413, 4813, 7413

Introduction to Quantum Computing

Assignment 2

1 Quantum circuit simulator – 50 marks

In either C/C++, Java or Python, implement a simple quantum simulator. If C/C++, you must supply a makefile (named exactly as Makefile) with a rule called quantum to compile your program into a Linux executable binary named quantum.bin. Your program must be able to be compiled and run as follows:

$ make quantum
$ ./quantum.bin [circuit]

If Java, write your program in the file quantum.java. Your program must be able to be compiled and run as follows:

$ javac quantum.java
$ java quantum [circuit]

If Python, write you program in the file quantum.py. Your program must be able to be run as follows:

$ python quantum.py [circuit]

Make sure that your Python program is compatible with Python 3.
The input to your program is a text file specified by the path [circuit]. Take note that

• I do not have a Windows machine and it will be difficult for me to locate one; thus
• I will be running your program on a Unix-like environment (e.g., Linux, Mac OS X) and the

path [circuit] will follow the Unix convention.

1

If you do not have a Unix-like machine, consider dual booting your machine with Linux or use a simulation environment such as Cygwin for Windows.

In this assignment, we will only consider two-qubit systems. The input text file pointed to by [circuit] contains the design of a quantum circuit and desired input quantum states. The specific formatting of the file is as follows:

TM
L11 L12 … L1T L21 L22 … L2T Q11 Q12 Q13 Q14 Q21 Q22 Q23 Q24 …. …. …. QM1 QM2 QM3 QM4

More details:

• The first line contains the number T of quantum transformations performed by the circuit (T is the number of “columns” or steps in the circuit), and the number M of input quantum states to process.

• The subsequent two lines correspond to the two “wires” in the circuit. Each character Lnt (e.g., L25 is the character at the 2nd wire and 5th quantum transformation) can be one of the following symbols:

– Identity (single qubit).
X Not (single qubit).
Z Phase shift (single qubit).
Y Negation and phase shift (single qubit). H Hadamard (single qubit).
. Control bit.
+ Target bit.

• The subsequent M define the input quantum states in linear algebra (vector) form, where Qm1 Qm2 Qm3 Qm4
is the m-th (1 ≤ m ≤ M ) input quantum state.

2

Example: For the quantum circuit below, HXH

where we wish to evaluate the following input states,

• |v⟩ = |11⟩
• |v⟩ = √1 (|00⟩ + |10⟩

2

• |v⟩=0.7555|00⟩+0.3065|01⟩+0.4257|10⟩+0.3925|11⟩

the corresponding input text file contains

63
H.X+H.
-+-.YZ
0001
0.7071 0 0.7071 0
0.7555 0.3065 0.4257 0.3925

Given the path [circuit] to an input file in the correct format, your program should print to standard output (“the command line”) the output quantum states obtained by processing the input states using the given quantum circuit. Specifically, for the input file that contains

TM
L11 L12 … L1T L21 L22 … L2T Q11 Q12 Q13 Q14 Q21 Q22 Q23 Q24 …. …. …. QM1 QM2 QM3 QM4

your program should print to standard output


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


blank

本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: itcsdx@outlook.com  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论