* Skip 5 least frequently used on Binder katas in Docker image prebuild to speed up Binder image build
* Fix links to docs on controlled functor
* In notebooks, update qsharp version (in metadata) to 0.12
* [SingleQubitGates] Add some simple properties of Pauli gates
This commit is contained in:
Mariia Mykhailova 2020-08-18 08:50:54 -07:00 коммит произвёл GitHub
Родитель 83c1f0f09b
Коммит b29ccb6bfe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 48 добавлений и 32 удалений

2
.github/CONTRIBUTING.md поставляемый
Просмотреть файл

@ -118,7 +118,7 @@ and to [have PowerShell installed](https://github.com/PowerShell/PowerShell#get-
2. **Running on Binder**
The Katas can be run online on [Binder](https://mybinder.org); when you make a potentially breaking change (such as an update to the new QDK version or modifying any package dependencies), you need to make sure that this still works.
You can check this by pushing your changes to a branch on GitHub and navigating to the Binder link used for the Katas (https://mybinder.org/v2/gh/Microsoft/QuantumKatas/master?filepath=index.ipynb) and change account name (`microsoft`) and branch (`master`) in the url to your Github username and branch name, respectively. After that you can navigate to the kata you want to check using the links from index notebook.
You can check this by pushing your changes to a branch on GitHub and navigating to the Binder link used for the Katas (https://mybinder.org/v2/gh/Microsoft/QuantumKatas/master?filepath=index.ipynb) and change account name (`microsoft`) and branch (`master`) in the url to your GitHub username and branch name, respectively. After that you can navigate to the kata you want to check using the links from index notebook.
3. **Continuous integration**
When you open a pull request or add a commit to it, continuous integration pipeline is executed to validate your changes. You can see the details of jobs executed in the "Checks" section on the pull request page; make sure to monitor the results, and if the run fails, try to figure out the reason and fix it.

Просмотреть файл

@ -390,7 +390,7 @@
"\n",
"### Q# materials\n",
"\n",
"* Using controlled and adjoint versions of gates is covered in the Q# documentation on [operation types](https://docs.microsoft.com/quantum/language/type-model#operation-and-function-types)."
"* Using controlled and adjoint versions of gates is covered in the Q# documentation on [operations](https://docs.microsoft.com/quantum/user-guide/using-qsharp/operations-functions#controlled-and-adjoint-operations)."
]
},
{
@ -540,9 +540,9 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.10"
"version": "0.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}

Просмотреть файл

@ -15,6 +15,7 @@
"* Deutsch-Jozsa algorithm for recognizing a function as constant or balanced, and\n",
"* writing tests in Q#.\n",
"\n",
"You can read more about the quantum oracles, Deutsch and Deutsch-Jozsa algorithms in the [ExploringDeutschJozsaAlgorithm tutorial](../tutorials/ExploringDeutschJozsaAlgorithm/DeutschJozsaAlgorithmTutorial.ipynb).\n",
"\n",
"Each task is wrapped in one operation preceded by the description of the task.\n",
"Your goal is to fill in the blanks (marked with `// ...` comments)\n",
@ -128,7 +129,7 @@
"\n",
"<br/>\n",
"<details>\n",
" <summary>Need a hint? Click here</summary>\n",
" <summary><b>Need a hint? Click here</b></summary>\n",
" Since $f(x) = 1$ for all values of x, $|y \\oplus f(x)\\rangle = |y \\oplus 1\\rangle = |NOT y\\rangle$.\n",
" This means that the operation needs to flip qubit y (i.e. transform $|0\\rangle$ to $|1\\rangle$ and vice versa).\n",
"</details>"
@ -195,7 +196,7 @@
"\n",
"<br/>\n",
"<details>\n",
" <summary>Need a hint? Click here</summary>\n",
" <summary><b>Need a hint? Click here</b></summary>\n",
" $f(x)$ can be represented as $x_0 \\oplus x_1 \\oplus ... \\oplus x_{N-1}$.\n",
"</details>"
]
@ -263,7 +264,7 @@
"\n",
"<br/>\n",
"<details>\n",
" <summary>Need a hint? Click here</summary>\n",
" <summary><b>Need a hint? Click here</b></summary>\n",
" Since each addition is done modulo 2, you can evaluate the effect of each term independently$.\n",
"</details>"
]
@ -302,9 +303,8 @@
"\n",
"> A prefix of length K of a state $|x\\rangle = |x_0, ..., x_{N-1}\\rangle$ is the state of its first K qubits $|x_0, ..., x_{K-1}\\rangle$. For example, a prefix of length 2 of a state $|0110\\rangle$ is 01.\n",
"\n",
"<br/>\n",
"<details>\n",
" <summary>Need a hint? Click here</summary>\n",
" <summary><b>Need a hint? Click here</b></summary>\n",
" The first term is the same as in task 1.4. To implement the second term, you can use `Controlled` functor which allows to perform multicontrolled gates (gates with multiple control qubits).\n",
"</details>"
]
@ -344,8 +344,8 @@
"\n",
"<br/>\n",
"<details>\n",
" <summary>Need a hint? Click here</summary>\n",
" Represent f(x) in terms of AND and $\\oplus$ operations.\n",
" <summary><b>Need a hint? Click here</b></summary>\n",
" Represent $f(x)$ in terms of AND and $\\oplus$ operations.\n",
"</details>"
]
},
@ -378,6 +378,7 @@
"\n",
"This algorithm solves the following problem. You are given a quantum oracle which implements a classical function $f(x): \\{0, 1\\}^N \\to \\{0, 1\\}$. You are guaranteed that the function $f$ is either constant (has the same value for all inputs) or balanced (has value 0 for half of the inputs and 1 for the other half of the inputs). The goal of the algorithm is to figure out whether the function is constant or balanced in just one oracle call.\n",
" \n",
"* You can read more about the Deutsch-Jozsa algorithms and explore its finer points in the [ExploringDeutschJozsaAlgorithm tutorial](../tutorials/ExploringDeutschJozsaAlgorithm/DeutschJozsaAlgorithmTutorial.ipynb).\n",
"* You can read more about the Deutsch-Jozsa algorithm in [Wikipedia](https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm).\n",
"* [Lecture 5: A simple searching algorithm; the Deutsch-Jozsa algorithm](https://cs.uwaterloo.ca/~watrous/CPSC519/LectureNotes/05.pdf)."
]
@ -564,7 +565,7 @@
"> Note that this task relies on your implementations of the previous tasks. If you are getting the \"No variable with that name exists.\" error, you might have to execute previous code cells before retrying this task.\n",
"\n",
"<details>\n",
" <summary>Need a hint? Click here</summary>\n",
" <summary><b>Need a hint? Click here</b></summary>\n",
" Not all oracles from part I can be represented as scalar product functions. The most generic oracle you can use in this task is Oracle_ProductFunction from task 1.5; Oracle_Zero, Oracle_Kth_Qubit and Oracle_OddNumberOfOnes are special cases of this oracle.\n",
"</details>"
]
@ -629,7 +630,7 @@
"\n",
"<br/>\n",
"<details>\n",
" <summary>Need a hint? Click here</summary>\n",
" <summary><b>Need a hint? Click here</b></summary>\n",
" For each oracle there are multiple bit vectors that generate it; it is sufficient to find any one of them.\n",
"</details>"
]

Просмотреть файл

@ -25,22 +25,23 @@ RUN pip install -I --no-cache-dir \
USER ${USER}
# Pre-exec notebooks to improve first-use start time
# (the katas that are less frequently used on Binder are excluded to improve overall Binder build time)
RUN cd ${HOME} && \
./scripts/prebuild-kata.sh BasicGates && \
./scripts/prebuild-kata.sh CHSHGame && \
./scripts/prebuild-kata.sh DeutschJozsaAlgorithm && \
./scripts/prebuild-kata.sh DistinguishUnitaries && \
./scripts/prebuild-kata.sh GHZGame && \
#./scripts/prebuild-kata.sh GHZGame && \
./scripts/prebuild-kata.sh GraphColoring && \
./scripts/prebuild-kata.sh GroversAlgorithm && \
./scripts/prebuild-kata.sh JointMeasurements && \
./scripts/prebuild-kata.sh KeyDistribution_BB84 && \
./scripts/prebuild-kata.sh MagicSquareGame && \
#./scripts/prebuild-kata.sh KeyDistribution_BB84 && \
#./scripts/prebuild-kata.sh MagicSquareGame && \
./scripts/prebuild-kata.sh Measurements && \
./scripts/prebuild-kata.sh PhaseEstimation && \
./scripts/prebuild-kata.sh QEC_BitFlipCode && \
#./scripts/prebuild-kata.sh QEC_BitFlipCode && \
./scripts/prebuild-kata.sh QFT && \
./scripts/prebuild-kata.sh RippleCarryAdder && \
#./scripts/prebuild-kata.sh RippleCarryAdder && \
./scripts/prebuild-kata.sh SolveSATWithGrover && \
./scripts/prebuild-kata.sh SuperdenseCoding && \
./scripts/prebuild-kata.sh Superposition && \

Просмотреть файл

@ -357,7 +357,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.4"
"version": "0.12"
}
},
"nbformat": 4,

Просмотреть файл

@ -466,7 +466,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.4"
"version": "0.12"
}
},
"nbformat": 4,

Просмотреть файл

@ -294,7 +294,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.4"
"version": "0.12"
}
},
"nbformat": 4,

Просмотреть файл

@ -746,7 +746,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.4"
"version": "0.12"
}
},
"nbformat": 4,

Просмотреть файл

@ -203,7 +203,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.4"
"version": "0.12"
}
},
"nbformat": 4,

Просмотреть файл

@ -474,7 +474,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.10"
"version": "0.12"
}
},
"nbformat": 4,

Просмотреть файл

@ -584,7 +584,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.4"
"version": "0.12"
}
},
"nbformat": 4,

Просмотреть файл

@ -634,7 +634,7 @@
" 0 & 0 & \\alpha & \\beta \\\\\n",
" 0 & 0 & \\gamma & \\delta\n",
" \\end{bmatrix}$</td>\n",
" <td style=\"text-align:center; border:1px solid\"><a href=https://docs.microsoft.com/quantum/language/type-model#controlled>Controlled functor</a></td>\n",
" <td style=\"text-align:center; border:1px solid\"><a href=\"https://docs.microsoft.com/quantum/user-guide/using-qsharp/operations-functions#controlled-and-adjoint-operations\">Controlled functor</a></td>\n",
" </tr>\n",
"</table>\n",
"\n",

Просмотреть файл

@ -571,7 +571,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.10"
"version": "0.12"
}
},
"nbformat": 4,

Просмотреть файл

@ -295,7 +295,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.10"
"version": "0.12"
}
},
"nbformat": 4,

Просмотреть файл

@ -351,11 +351,25 @@
"Z|-i\\rangle = |i\\rangle$ </td>\n",
" <td style=\"text-align:center; border:1px solid\"><a href=https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.z>Z</a></td>\n",
" </tr>\n",
"</table>\n",
"\n",
"</table>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"> The $X$ gate is sometimes referred to as the **bit flip** gate, or the **NOT** gate, because it acts like the classical NOT gate on the computational basis.\n",
">\n",
"> The $Z$ gate is sometimes referred to as the **phase flip** gate."
"> The $Z$ gate is sometimes referred to as the **phase flip** gate.\n",
"\n",
"Here are several properties of the Pauli gates that are easy to verify and convenient to remember:\n",
"\n",
"* Different Pauli gates *anti-commute*:\n",
" $$XZ = -ZX, XY = -Y, YZ = -ZY$$\n",
"* A product of any two Pauli gates equals the third gate, with an extra $i$ (or $-i$) phase:\n",
" $$XY = iZ, YZ = iX, ZX = -Y$$\n",
"* A product of all three Pauli gates equals identity (with an extra $i$ phase):\n",
" $$XYZ = iI$$"
]
},
{
@ -921,7 +935,7 @@
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.10"
"version": "0.12"
}
},
"nbformat": 4,