396 lines
52 KiB
Plaintext
396 lines
52 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 1,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAADFcAAAA/CAYAAACfdcacAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4Ae2djdXURrKGgeMAvL4Z4AzAG8FCBrAbgXEG5jgCDs4AHMFeyMBsBDZkYDJYXzLwrZpPGvVILan/u7rq1Tn6PqnVP1VPvd0tzUij+/fu3XtC66+0rpfPf/3117frxPv370flX5fHfhkCFIePVNMjT23PKW7vPelIAgGTBDBmjRd2ieMbdCRbRxI1I5uYHevQd/vEWmKfhBb6aMFtVaIuXPuw3Z4A+mV75jEtSuuz0EtM9NrnlaYXJgDNtNdBbosSdZTrE8qDQA0CGN9qUI2vE2NWPLNRSqCPjRKpWzvRJ295YA8EQAAELBHA3K072pjjdccX3oEACJQngHmxPNMRapQ2X0KHI6hGr42x/eEo/1cOpqfONm/+udpf78bmX5fHfh6B76n4N6sqfA/JrLJgFwTMEsCYNU7oJY9v0JFMHUnWjExi9qxC320bc8l9ElpoqwW3Ncm6cO3EdnsC6JftmYe0KLXPQi8h0WufR6pemAQ0014PqS1K1lGqTygHAjUJYHyrSfe8boxZ54xGz4E+NlYE0SfHihesBQEQAIEaBDB316Dav07M8f1jAAtAAATGJIB5ccy4pVotdb6EDlMjinI5BGL7w27+68MV9LaDDzEWxeYPqZueAvnrLB+1e/8sj8Tj5Ns7suvZmW2h/lG+T+u6qI0v6zTsgwAI3BGoMWbNbEv377le6f9rjdmSx7fSOtKunVb+SdaM9H5sxb7SfXfNrZXW1+3W2C8xtkvuk6W1oCn2KXqK8V+yLlJ8R5lyBEr3S9eyGI265TRux7KQ2mdr6CWWjTZ9kP/Zn8VJ1QvHqoZmZg1Y187Mgf+XYCFZR66v2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\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}1 & 0\\\\0 & i\\end{matrix}\\right], \\ \\left[\\begin{matrix}1 & 0\\\\0 & 1\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\\\\\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}1 & 0\\\\0 & -1\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2} i}{2} & \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2}}{2}\\\\\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}1 & 0\\\\0 & - i\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2}}{2}\\\\\\frac{\\sqrt{2} i}{2} & \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{1}{2} + \\frac{i}{2} & \\frac{1}{2} - \\frac{i}{2}\\\\\\frac{1}{2} - \\frac{i}{2} & \\frac{1}{2} + \\frac{i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\\\- \\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}0 & 1\\\\1 & 0\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\\\- \\frac{\\sqrt{2} i}{2} & \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}0 & 1\\\\i & 0\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{1}{2} - \\frac{i}{2} & \\frac{1}{2} + \\frac{i}{2}\\\\- \\frac{1}{2} + \\frac{i}{2} & \\frac{1}{2} + \\frac{i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}0 & i\\\\1 & 0\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\\\- \\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{1}{2} - \\frac{i}{2} & - \\frac{1}{2} + \\frac{i}{2}\\\\- \\frac{1}{2} + \\frac{i}{2} & - \\frac{1}{2} + \\frac{i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}0 & -1\\\\1 & 0\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2}}{2}\\\\- \\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{1}{2} - \\frac{i}{2} & \\frac{i \\left(-1 + i\\right)}{2}\\\\- \\frac{1}{2} + \\frac{i}{2} & \\frac{i \\left(-1 + i\\right)}{2}\\end{matrix}\\right]\\right]$"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
"⎡⎡√2 √2 ⎤ ⎡ √2 √2 ⎤ ⎡√2 √2⋅ⅈ ⎤ ⎡ √2 √2⋅\n",
|
|||
|
"⎢⎢── ── ⎥ ⎢ ── ── ⎥ ⎢── ──── ⎥ ⎢ ── ───\n",
|
|||
|
"⎢⎢2 2 ⎥ ⎡1 0⎤ ⎡1 0⎤ ⎢ 2 2 ⎥ ⎢2 2 ⎥ ⎡1 0 ⎤ ⎢ 2 2 \n",
|
|||
|
"⎢⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ \n",
|
|||
|
"⎢⎢√2 -√2 ⎥ ⎣0 ⅈ⎦ ⎣0 1⎦ ⎢√2⋅ⅈ -√2⋅ⅈ ⎥ ⎢√2 -√2⋅ⅈ ⎥ ⎣0 -1⎦ ⎢√2⋅ⅈ √2\n",
|
|||
|
"⎢⎢── ────⎥ ⎢──── ──────⎥ ⎢── ──────⎥ ⎢──── ──\n",
|
|||
|
"⎣⎣2 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 ⎦ ⎣ 2 2 \n",
|
|||
|
"\n",
|
|||
|
"ⅈ⎤ ⎡√2 -√2 ⎤ ⎡ √2 -√2 ⎤ ⎡√2 -√2⋅ⅈ ⎤ ⎡ √2 -√2⋅ⅈ ⎤ ⎡1 ⅈ 1\n",
|
|||
|
"─⎥ ⎢── ────⎥ ⎢ ── ────⎥ ⎢── ──────⎥ ⎢ ── ──────⎥ ⎢─ + ─ ─\n",
|
|||
|
" ⎥ ⎢2 2 ⎥ ⎡1 0 ⎤ ⎢ 2 2 ⎥ ⎢2 2 ⎥ ⎢ 2 2 ⎥ ⎢2 2 2\n",
|
|||
|
" ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ \n",
|
|||
|
" ⎥ ⎢√2 √2 ⎥ ⎣0 -ⅈ⎦ ⎢√2⋅ⅈ √2⋅ⅈ⎥ ⎢√2 √2⋅ⅈ ⎥ ⎢√2⋅ⅈ -√2 ⎥ ⎢1 ⅈ 1\n",
|
|||
|
" ⎥ ⎢── ── ⎥ ⎢──── ────⎥ ⎢── ──── ⎥ ⎢──── ──── ⎥ ⎢─ - ─ ─\n",
|
|||
|
" ⎦ ⎣2 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 2\n",
|
|||
|
"\n",
|
|||
|
" ⅈ⎤ ⎡ √2 √2⎤ ⎡ √2 √2 ⎤ ⎡ 1 ⅈ 1 ⅈ⎤ ⎡\n",
|
|||
|
" - ─⎥ ⎢ ── ──⎥ ⎢ ── ── ⎥ ⎢ ─ - ─ ─ + ─⎥ ⎢\n",
|
|||
|
" 2⎥ ⎢ 2 2 ⎥ ⎡0 1⎤ ⎢ 2 2 ⎥ ⎡0 1⎤ ⎢ 2 2 2 2⎥ ⎡0 ⅈ⎤ ⎢\n",
|
|||
|
" ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢\n",
|
|||
|
" ⅈ⎥ ⎢-√2 √2⎥ ⎣1 0⎦ ⎢-√2⋅ⅈ √2⋅ⅈ⎥ ⎣ⅈ 0⎦ ⎢ 1 ⅈ 1 ⅈ⎥ ⎣1 0⎦ ⎢\n",
|
|||
|
" + ─⎥ ⎢──── ──⎥ ⎢────── ────⎥ ⎢- ─ + ─ ─ + ─⎥ ⎢\n",
|
|||
|
" 2⎦ ⎣ 2 2 ⎦ ⎣ 2 2 ⎦ ⎣ 2 2 2 2⎦ ⎣\n",
|
|||
|
"\n",
|
|||
|
" √2 √2⋅ⅈ⎤ ⎡ 1 ⅈ 1 ⅈ⎤ ⎡ √2 -√2 ⎤ ⎡ 1 ⅈ ⅈ⋅(-1 \n",
|
|||
|
" ── ────⎥ ⎢ ─ - ─ - ─ + ─⎥ ⎢ ── ──── ⎥ ⎢ ─ - ─ ──────\n",
|
|||
|
" 2 2 ⎥ ⎢ 2 2 2 2⎥ ⎡0 -1⎤ ⎢ 2 2 ⎥ ⎢ 2 2 2 \n",
|
|||
|
" ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ \n",
|
|||
|
"-√2⋅ⅈ -√2 ⎥ ⎢ 1 ⅈ 1 ⅈ⎥ ⎣1 0 ⎦ ⎢-√2⋅ⅈ -√2⋅ⅈ ⎥ ⎢ 1 ⅈ ⅈ⋅(-1 \n",
|
|||
|
"────── ────⎥ ⎢- ─ + ─ - ─ + ─⎥ ⎢────── ──────⎥ ⎢- ─ + ─ ──────\n",
|
|||
|
" 2 2 ⎦ ⎣ 2 2 2 2⎦ ⎣ 2 2 ⎦ ⎣ 2 2 2 \n",
|
|||
|
"\n",
|
|||
|
"+ ⅈ)⎤⎤\n",
|
|||
|
"────⎥⎥\n",
|
|||
|
" ⎥⎥\n",
|
|||
|
" ⎥⎥\n",
|
|||
|
"+ ⅈ)⎥⎥\n",
|
|||
|
"────⎥⎥\n",
|
|||
|
" ⎦⎦"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 1,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"import sympy\n",
|
|||
|
"\n",
|
|||
|
"M = sympy.Matrix\n",
|
|||
|
"simplify = sympy.simplify\n",
|
|||
|
"sqrt = sympy.sqrt\n",
|
|||
|
"i = sympy.I\n",
|
|||
|
"_i = i\n",
|
|||
|
"\n",
|
|||
|
"from sympy.physics.quantum import Dagger\n",
|
|||
|
"from sympy.physics.quantum import tensorproduct\n",
|
|||
|
"\n",
|
|||
|
"sympy.init_printing()\n",
|
|||
|
"H = simplify(M([[1, 1], [1, -1]]) / sqrt(2))\n",
|
|||
|
"S = M([[1, 0], [0, i]])\n",
|
|||
|
"C_L = [H, S]\n",
|
|||
|
"basis_vectors = [M([1, 0]), M([0, 1])]\n",
|
|||
|
"\n",
|
|||
|
"def getitem(m, i, j):\n",
|
|||
|
" # Note that sympy uses an extremely weird way to store the matrices,\n",
|
|||
|
" # in particular the internal representation is vastly different from what\n",
|
|||
|
" # is printed. For instance the H matrix is stored as a Mul object\n",
|
|||
|
" # (even after using simplify) instead of a matrix. \n",
|
|||
|
" # Therefore m[i][j] will NOT work. This is a workaround.\n",
|
|||
|
" return (Dagger(basis_vectors[i]) * m * basis_vectors[j])[0]\n",
|
|||
|
"\n",
|
|||
|
"def is_known(C_L, a):\n",
|
|||
|
" for c in C_L:\n",
|
|||
|
" test = c * Dagger(a)\n",
|
|||
|
" if(simplify(getitem(test, 0, 1)) != 0):\n",
|
|||
|
" continue\n",
|
|||
|
" if(simplify(getitem(test, 0, 0) / getitem(test, 1, 1)) == 1):\n",
|
|||
|
" return True\n",
|
|||
|
" return False\n",
|
|||
|
"for i in range(5):\n",
|
|||
|
" for m in (H, S):\n",
|
|||
|
" for c in C_L:\n",
|
|||
|
" c = simplify(c*m)\n",
|
|||
|
" if(is_known(C_L, c)):\n",
|
|||
|
" continue\n",
|
|||
|
" C_L.append(c)\n",
|
|||
|
"C_L"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 3,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAALQAAABlCAYAAADkr8m4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAIeklEQVR4Ae1d7Y3cNhTcDVyA08K6geDcQIBsOojdQeIaAuR/kHRgF5A/SQdOOohdgIG7AvIjOaSAXGZuJULeD5JvSZHv0U+AfFpRFGeGI+otpX3ePjw8bCTLdrt9iuNfYn2Fus8ldVseawVnjiajcGnB4wkauYGo7y4I+xtM+2Ium47dT59pbJWLFZw54o3CpRYPnOcWuu3OaQevbp8sCn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Comm76WkOX/PjHK7aRDMphUbhQZ5WuLTC6YlmUu73cvUK4GLxRDPqe8kBXqWAx9BXyeaVtCqQHUNjWO+eaAYYihO0jMKDhtLAJcfYLXFmGxrP4rtnRQKG4gQto/CgkTRwyTF0S5wecuT0iB9jRoHsEZqMplu++kQzKfVH4WGpT1pqLnnBf4gELjDCEDxwK6enTXBZEyfOHV7wpyASQw+RwAWch+AxGdoElzU1x7mDoaUxdJVkIADQexmFB3W0wqUJTlEMjRHBRKKZ1NUyCg/ytMKlFU7pCB28giCfoYr6RDMB8IWNUXiQnhUua+K8ytAAtIN+6hPNXPBw2D0KDxKywmVtnKKQYykcbiGqE80E117YmIW1zsNSn7TSfJ7l4Lfl4/VXdHjIs4FyjsxvsbLOvDLxzNPlcdq3gXcIHtTZCpdaOHGeW6zHPn38TD34OJvvR7zEem65w0G/zwW4wpjA5SSPBY7p/lh8xpjzdxQe5GqFSy2cOA+n6M4u8OGb/wFmtDR28OD1wgAAAABJRU5ErkJggg==\n",
|
|||
|
"text/latex": [
|
|||
|
"$\\displaystyle \\left[\\begin{matrix}\\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}\\end{matrix}\\right]$"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
"⎡1/2 1/2 1/2 1/2 ⎤\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎢1/2 -1/2 1/2 -1/2⎥\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎢1/2 1/2 -1/2 -1/2⎥\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎣1/2 -1/2 -1/2 1/2 ⎦"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 3,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"H2 = tensorproduct.matrix_tensor_product(H, H)\n",
|
|||
|
"H2"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 4,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"zero_state = M([1, 0, 0, 0])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 6,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAB0AAABlCAYAAACx4uijAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAC/klEQVRoBe1ay03DQBB1EGeUEwWYDkgJhA4QHRBKQFSAQgdJAVxSApRAKAApKYADIArAvOfsrhxn7czYgIOYkSb78ey89dvfZJMky7JEo0mS9KEj6FzTrmi71+v1jqFZhc7gPAhtUSAggalRgd2iwl/GBvuFVrfILwplZpfFMnr7hPITHJ4V6yP5caTuFHV5uyLoBE7XQCINRVXwMy0boqOsykH3yg9/o2ygP8pyJ/QWZ+/Wt8MMTGF0CR1CU5QnSBeYrVxuYlGBuiV1JfZeYdgJvZ2AiunF+OX7ZgVjeTXoz7edOhs+E4NKHW4D5PPdppc9BMU8zq6Zh3D5UC7AwvsqK/sU0+vcjQHAdZqLW6dzFI5clSjR0jsC0LDgmecmNwke7mLRgvItH8XeKwxV9ILa8uHMTixRz4hCLNo3DY4dpYwEBqFSmGkECsAU/jmeA+3MZb9U9LKBBwQYAy2WOYneURbHV6o3dYA8zm4I5gA5rq9QsWjflGuSGwTTIHjLsHZDZU1GC3oCX0Pn7xJgqk3B90MFChBpsO39R1PVmEY9NKg00AakyZv8H3pVS8btSNwIuFYt2N46ozqZSBxTnhB30M+6LmI82wbbzw4nh+F5SIcp9lbV9Y7GHv55K4MmmQXbICIuFmzHeamoVW2DmHkWbFcQGa9W0UsX7qThLP57wfaBI8GncU5WtW2C7UPvmPR+uIJP/bNY2ibYfvEOVWOKcbRg2zMnSjuJHAxUNDZNjVRLxoJtLc2dzF7xmH5DsB0IEYNi3xVdlQfPNZndppcdB8V2s80vYWLRjim/+tvN9o/Rmzv2sS8KdrNdS7V4G3Re2gTboSNa0DbBdjNQC7YDb8KMdhsUuq03M9B6flo+Va1TC7a1bHcye8VjasG2djxpL6aXxhZsgwELtjkVNqTx5uAotb+RbFBaruDM429tMZ0hAgy/v8Emhd5D2cYr/1bSL9nxz8kxfzDLEt4j8Nv1OTQm/K/Rg3+AcXxDnvZrApu1+wjY8ce8qMB2+gXddflBWpRqZgAAAABJRU5ErkJggg==\n",
|
|||
|
"text/latex": [
|
|||
|
"$\\displaystyle \\left[\\begin{matrix}\\frac{1}{2}\\\\\\frac{1}{2}\\\\\\frac{1}{2}\\\\\\frac{1}{2}\\end{matrix}\\right]$"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
"⎡1/2⎤\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎢1/2⎥\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎢1/2⎥\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎣1/2⎦"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 6,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"plus_state = H2 * zero_state\n",
|
|||
|
"plus_state"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 7,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"I = M([[1, 0], [0, 1]])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 8,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"C_L_0 = [tensorproduct.matrix_tensor_product(I, c) for c in C_L]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 9,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"C_L_1 = [tensorproduct.matrix_tensor_product(c, I) for c in C_L]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 13,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAIgAAABkCAYAAABdPHirAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAHJElEQVR4Ae1d7Y0cNwy9Dfw7MGIgBaw7OCcVxOnAlw6S1JASnA6cDoJcCUkFhq+DSwEBYizSwOXxMDQGa2oo3S5JrUQBws5QGpF8fKP50PBud3V1dY36AVUqtw8PDzdSQ8rGQGC3293Dk73kDWK/e7Zq+BXb1Hld/l7v5PaQCLwVvPoesjckXxPkHRiThBDQGlmEmP927B9mFRJ9RpDjfuI+DqZL0h+orzD4QexkIIReZvq/GP4l6lsvQkfq1qD0sI0C/oC6B+BXUkXbc1QixTtUul+h/s+lvhayRecbHpt0oz5eO1lm9RupW/PJyjaM+xMq1D9cfYENtaDjAfUG9Wd0/l094IwdcIaQsUTGWx6W7ME27RNhzUqkbs0pL9uqCKIZa9xOT1F3go73kL0GUDSbWJVI3ZpPLrZdAkFeA6mPAlo0i1ChdqsSqVvzycW2rglSOTt8pSH5lPZI3Zq9nrZ1TRAAxcHn2WKNHc8qVpeYSN1rP6VtN9t6J4gEzrHsxbHAcT9St+bmWWzrnSA8S0hg8FlE70UsSqRuzR8327omyPI4S2BJlxGWmbz9jdStscPTtq4JsgD1J373Amg8g1C7VYnUrfnkYtslEITe4H4joPUKsrvV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"⎣0 0 0 -1⎦"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 13,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"CZ = M([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, -1]])\n",
|
|||
|
"CZ"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 11,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAC0AAABlCAYAAADZEWqbAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAD30lEQVR4Ae1cXW7UMBjcVDyj0gcOsEgcgB6B7Q2AB95pj4A4ASo3aA/Qlx4BuAHtAZC2B+ABVhyAZSZ8jtxgb7Lx2CjIllz/xPt5Mpn97HxNttlutwtlaprmEPZeIZ/B9rHStrN1gEmeIW8j+doNHFPSFsadIhM486QEO+sInpbhB57VD6ivvTard732ziaYvcWAW0z4YufA4YPngSEn6Gvt+qAvMOleIAOGJV3Acdk3BCLY1YI+6B+cQ7uCLnWVKtOlmPa9R/Kc+IYvYeQMeYW8RPsC5RregO5UlqSgzWW+laGLGKqajhAj75bJA/od3HlBPu2ylnoWMtAqQGNOaJaaljFNhiARbkffGVt0f0xvcBU2f6qav1LQgHQOgPTTbTI/fYPGE+uSFGp5nALoykPGfTEXGd4cyJIaNFn+IkMXMSSVB6TR37zzJO7QzzsaWVIz3QEzSfBOQ35zmwU0AC8Blno+VnsOsiKVBw06wADLG1G2+SXcoC27/5QybYC5HX1PsAaYuv6OLEtqpumTucCw7BJY7nx315lQUYN+Diwrw8MIk3RRcecpBQ2QqmCNwxcspZoOzpChs4LOQGrQZGU6SEuGzlkyLXV5tiJyIaGvrsEaX2WzlMcsQVPT3IFdIf/yL8G+deg5d7Dmq+FckOkj5NfISaxj39EMZcyRkp7iw8SZBjQFQcpn1S6vBmtiVyNJxwGjNVgTIKXtkmoa3qMGa2JMqzXdzmMbpxqs8VmXMm0MFwnWPLSzcKV/UvvWcwZrHjsw9B4/reFKd2xKmTNY880BUru8GqxxzPZL6RexbzxXu4LOxWzfbmW6z0iuttTl1WDNjstUNb2DHOkhmaYLBGu6E5eBZqCms5q5MktNy5gmuZBIDdbEVKaWRw3WxJiWaroGa2I0o1+t6XYq2zjVYI1PvJRpYzh7sIYnwGeM+E+eJb5Ii5QMGz/MFu112beJfi5AfOvoxu8fqttnMGyrffAKBh/BeDThSpCglQ0g+ElJ6vKGEOCkJMEcqaaHQKuOV9AqJofsVKaHGFIdnyXTRV2erZjJT94UBQ0/zSd7k1+TmqU8Zgl6lDygRe4TPiPvs194act26zRgQ/bkzSjQmHyDmZOe7YcNWTDn/5VHe30Ff0xmya9JjZKHAK8zIXlNqrQ8JMGc0qC5Gia/JlVUHvAgkidvSjPttO1e2pn0mtQ/AW0bp8nBnKLyIM0OMKSS9JqUi3t0cQrYdvVrGE+Khfifh90l8kdkzukygzuHvXH8cRSH4V7JcVxauZ/gb8yEEt8l/BQ6MKUPLDOY89f+BXPcW+IxjsGcYMLYy9/xqBy2/jxphQAAAABJRU5ErkJggg==\n",
|
|||
|
"text/latex": [
|
|||
|
"$\\displaystyle \\left[\\begin{matrix}\\frac{1}{2}\\\\\\frac{1}{2}\\\\\\frac{1}{2}\\\\- \\frac{1}{2}\\end{matrix}\\right]$"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
"⎡1/2 ⎤\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎢1/2 ⎥\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎢1/2 ⎥\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎣-1/2⎦"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 11,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"CZ * plus_state"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 14,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAHgAAABkCAYAAABNcPQyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGmklEQVR4Ae1c/83bNhC1i/5dBCnQAZwNnGaCphskK7QbFOgI6QbpBkW/EbJBkG+DdIAAaT90Afc9R2foU2nxKJI+UjoCsqTTUffjiZJ1fNB+t9sdsXzAEmp3p9PpdeiAy9rIwH6//whPDiFvgN3+69GB37BN5XH7a7zj201m4E3Aqx8he0X5GOC3QNwBDWSrZREw+33qH0Y1Rf8DeKoX3Edn3tL/xPIcJ38IKlUQwq5cqZ9x+mdY3tzqguzdNgE7YTkgYbvQgmNPsBDUt1j4vKb+k5BuDdlg85Wcm7axnJ89Iqu17tE2fP4JC1Jy2n2FjWiD4gOW11h+hvIf0Q4FFTB66Cwvpjs5Lf3BNvd5wVVra7CtArhaBnUn5r/4+4Dqe8heAgSO5lqte9s9APwS6P0dQJCjmI3Ha7XubTcNsHJ0Pq2B7lpsNw0wgBPwZLSOsZRRXesWvQrbrQM8BvTa9rfXDtxA3rzt1gGWURrCSkYY34trtFXYbhrg4XWI4IVuwyKrUn1bi+2mAR6G5TusD8P2eCUjmMdrte5t9wAwK2jfBxB8Dtn9aKQFVLJFq7B9RBpmS5VI4qWECd1fBv1blipZlpyWKv+B7Dj2rcY2bHRnGz5fSpXj2STIrze8F/Jq5nNPRtMHyO6x/x6J5VRjzcbR+ivsya36BfZ/gF3ar926ts15JY5gTiA8Q8Kq/GGpjYCf/3EGMBA4gjn9u+/hGfzYe99LyoADnJSu/pQd4P4wS/LYAU5KV3/KDnB/mCV57AAnpas/ZQe4P8ySPHaAk9LVn7ID3B9mSR47wEnp6k9ZXYtmaCiB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olQLcBESdqJvor5V2xJ/1joKcEkSdqqnW7Wdmqc5/SjA6CzU2IfAiYTeKezKgEqWaKu2s5I27qwBeKx/bVtFwr7WOVO+VduqtGkAllEaOqGMsDUS3y3jDuV6kSwKcEkSdqqHW7Wdmqc5/SjAQ+ciJOw5R2aObdX2TEr0h7QAFyNh6127aG7V9iUBuRvaUqUZ+RwBbtI2HlGLvnSPfF1KlSmTDWbkczi8SduoA/DuxVfQxV+6d+I7sre2NtTQnfi+NmBD8Wj/ZIX6uqyDDDjAHYCU46IDnJO9Dvo6wB2AlOPi+DXpI/59Tc91R1bBVOj77WQAmLFGcLjmEQGWL76HdKp8XCVkyGWLMyCEwOAJ/gPMO+U3kXQlGwAAAABJRU5ErkJggg==\n",
|
|||
|
"text/latex": [
|
|||
|
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
"⎡1 0 0 0⎤\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎢0 1 0 0⎥\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎢0 0 1 0⎥\n",
|
|||
|
"⎢ ⎥\n",
|
|||
|
"⎣0 0 0 1⎦"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 14,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"I_4 = M([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])\n",
|
|||
|
"I_4"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 17,
|
|||
|
"metadata": {
|
|||
|
"scrolled": true
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"from itertools import product\n",
|
|||
|
"starting_states = [ c0 * c1 * ent * plus_state for ent, c0, c1 in product((I_4, CZ), C_L_0, C_L_1)]\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 18,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"True"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 18,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"len(starting_states) == 2 * 24**2"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 19,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"resulting_states = [CZ * s for s in starting_states]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 20,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"def get_starting_state_index(s):\n",
|
|||
|
" for i, test in enumerate(starting_states):\n",
|
|||
|
" if(simplify(test - s) == M([[0, 0], [0, 0]])):\n",
|
|||
|
" return i\n",
|
|||
|
" raise NotImplementedError()\n",
|
|||
|
" "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 21,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"ename": "NotImplementedError",
|
|||
|
"evalue": "",
|
|||
|
"output_type": "error",
|
|||
|
"traceback": [
|
|||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
|||
|
"\u001b[0;31mNotImplementedError\u001b[0m Traceback (most recent call last)",
|
|||
|
"\u001b[0;32m<ipython-input-21-d37d36fc7f78>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mresults\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mget_starting_state_index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0ms\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mresulting_states\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
|||
|
"\u001b[0;32m<ipython-input-21-d37d36fc7f78>\u001b[0m in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mresults\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mget_starting_state_index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0ms\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mresulting_states\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
|||
|
"\u001b[0;32m<ipython-input-20-139dd2bc5c26>\u001b[0m in \u001b[0;36mget_starting_state_index\u001b[0;34m(s)\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mif\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msimplify\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0ms\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mM\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mNotImplementedError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
|
|||
|
"\u001b[0;31mNotImplementedError\u001b[0m: "
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"results = [get_starting_state_index(s) for s in resulting_states]"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"metadata": {
|
|||
|
"kernelspec": {
|
|||
|
"display_name": "Python 3",
|
|||
|
"language": "python",
|
|||
|
"name": "python3"
|
|||
|
},
|
|||
|
"language_info": {
|
|||
|
"codemirror_mode": {
|
|||
|
"name": "ipython",
|
|||
|
"version": 3
|
|||
|
},
|
|||
|
"file_extension": ".py",
|
|||
|
"mimetype": "text/x-python",
|
|||
|
"name": "python",
|
|||
|
"nbconvert_exporter": "python",
|
|||
|
"pygments_lexer": "ipython3",
|
|||
|
"version": "3.7.3"
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 2
|
|||
|
}
|