# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# <a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg"  align="left"></a>
# $ \newcommand{\bra}[1]{\langle #1|} $
# $ \newcommand{\ket}[1]{|#1\rangle} $
# $ \newcommand{\braket}[2]{\langle #1|#2\rangle} $
# $ \newcommand{\dot}[2]{ #1 \cdot #2} $
# $ \newcommand{\biginner}[2]{\left\langle #1,#2\right\rangle} $
# $ \newcommand{\mymatrix}[2]{\left( \begin{array}{#1} #2\end{array} \right)} $
# $ \newcommand{\myvector}[1]{\mymatrix{c}{#1}} $
# $ \newcommand{\myrvector}[1]{\mymatrix{r}{#1}} $
# $ \newcommand{\mypar}[1]{\left( #1 \right)} $
# $ \newcommand{\mybigpar}[1]{ \Big( #1 \Big)} $
# $ \newcommand{\sqrttwo}{\frac{1}{\sqrt{2}}} $
# $ \newcommand{\dsqrttwo}{\dfrac{1}{\sqrt{2}}} $
# $ \newcommand{\onehalf}{\frac{1}{2}} $
# $ \newcommand{\donehalf}{\dfrac{1}{2}} $
# $ \newcommand{\hadamard}{ \mymatrix{rr}{ \sqrttwo & \sqrttwo \\ \sqrttwo & -\sqrttwo }} $
# $ \newcommand{\vzero}{\myvector{1\\0}} $
# $ \newcommand{\vone}{\myvector{0\\1}} $
# $ \newcommand{\stateplus}{\myvector{ \sqrttwo \\  \sqrttwo } } $
# $ \newcommand{\stateminus}{ \myrvector{ \sqrttwo \\ -\sqrttwo } } $
# $ \newcommand{\myarray}[2]{ \begin{array}{#1}#2\end{array}} $
# $ \newcommand{\X}{ \mymatrix{cc}{0 & 1 \\ 1 & 0}  } $
# $ \newcommand{\I}{ \mymatrix{rr}{1 & 0 \\ 0 & 1}  } $
# $ \newcommand{\Z}{ \mymatrix{rr}{1 & 0 \\ 0 & -1}  } $
# $ \newcommand{\Htwo}{ \mymatrix{rrrr}{ \frac{1}{2} & \frac{1}{2} & \frac{1}{2} & \frac{1}{2} \\ \frac{1}{2} & -\frac{1}{2} & \frac{1}{2} & -\frac{1}{2} \\ \frac{1}{2} & \frac{1}{2} & -\frac{1}{2} & -\frac{1}{2} \\ \frac{1}{2} & -\frac{1}{2} & -\frac{1}{2} & \frac{1}{2} } } $
# $ \newcommand{\CNOT}{ \mymatrix{cccc}{1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0} } $
# $ \newcommand{\norm}[1]{ \left\lVert #1 \right\rVert } $
# $ \newcommand{\pstate}[1]{ \lceil \mspace{-1mu} #1 \mspace{-1.5mu} \rfloor } $
# $ \newcommand{\greenbit}[1] {\mathbf{{\color{green}#1}}} $
# $ \newcommand{\bluebit}[1] {\mathbf{{\color{blue}#1}}} $
# $ \newcommand{\redbit}[1] {\mathbf{{\color{red}#1}}} $
# $ \newcommand{\brownbit}[1] {\mathbf{{\color{brown}#1}}} $
# $ \newcommand{\blackbit}[1] {\mathbf{{\color{black}#1}}} $

# <font style="font-size:28px;" align="left"><b> Project | Quantum Tomography with Many Qubits </b></font>
# <br>
# _prepared by <NAME>_
# <br><br>

# We design a simple python object for experimenting quantum tomography on multiple qubits.
#
# This will be the extension of the class given in our notebook [Quantum Tomography](../bronze/B48_Quantum_Tomography.ipynb).
#
# _All angles must be in radian._

# ### Create a python class called `UnknownQuantumSystem(the_number_of_qubits=2)`
#
# Any instance refers to a quantum system with the specified number of qubits, which is a two qubits system if not specified.
#
# Each qubit of this system will be set to an quantum state specified with an angle in $ [0,\pi) $.
#
# The instance will have 1000 identical copies of this system. (You may ask the number of copies from the user.) 
#
# You can define the methods of this class similar to the ones defined for "unknown_qubit()"  so that any user can do experiments on the quantum system to learn the quantum state (the angle) of each qubit and then compare her results with the picked quantum states (angles).

# ### Experiment with your class
#
# Use your class as a user and develop a solution about how to guess the unknown quantum state of each qubit for the given quantum system. 

# ### Program the quantum part
#
# - _This part of the project aims to give some ideas about how to simulate a generic quantum system._
# - _The difficuly level of this part is medium._
# - _Please do not use any scientific python library such as `NumPy`._
#
# Re-design your class without using any quantum programming library. 
#
# You should write your own code to simulate the quantum system. Remark that:
# - The state of the system should be kept as a single vector, and you should not keep the state of each qubit separately. 
# - If the quantum system has $n$ qubits, then its state vector can be represented by $ 2^n $-dimensional list.
# - Then, each operator (rotation) should be defined as a $ (n \times n) $-dimensional matrix even though it is applied to single qubit.
# - Otherwise, there will be no difference between a single-qubit system and multi-qubit systems, and all calculations will be trivial.
#
#

StarcoderdataJupyterScriptsDedupFiltered