bachelor_thesis/computations/compute_lc_elements.ipynb

407 lines
53 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Computing the elements of the local clifford group"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from itertools import product\n",
"import sympy\n",
"i = sympy.I\n",
"exp = sympy.exp\n",
"M = sympy.Matrix\n",
"simplify = sympy.simplify\n",
"from sympy.physics.quantum.dagger import Dagger\n",
"\n",
"sympy.init_printing()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"I = M([[1, 0], [0, 1]])\n",
"X = M([[0, 1], [1, 0]])\n",
"Y = M([[0, -i], [i, 0]])\n",
"Z = M([[1, 0], [0, -1]])\n",
"O = M([[0, 0], [0, 0]])"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"H = M([[1, 1], [1, -1]]) / sympy.sqrt(2)\n",
"S = M([[1, 0], [0, i]])\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"C = [H, S]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"def is_math_the_same(v):\n",
" return simplify(v[0] - v[1]) == O\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from multiprocessing import Pool, cpu_count\n",
"\n",
"pool = Pool(cpu_count())"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"found Matrix([[1, 0], [0, 1]])\n",
"found Matrix([[sqrt(2)/2, sqrt(2)/2], [sqrt(2)*I/2, -sqrt(2)*I/2]])\n",
"found Matrix([[sqrt(2)/2, sqrt(2)*I/2], [sqrt(2)/2, -sqrt(2)*I/2]])\n",
"found Matrix([[1, 0], [0, -1]])\n",
"found Matrix([[1/2 + I/2, 1/2 - I/2], [1/2 - I/2, 1/2 + I/2]])\n",
"found Matrix([[sqrt(2)/2, sqrt(2)/2], [-sqrt(2)/2, sqrt(2)/2]])\n",
"found Matrix([[sqrt(2)/2, sqrt(2)*I/2], [sqrt(2)*I/2, sqrt(2)/2]])\n",
"found Matrix([[sqrt(2)/2, -sqrt(2)/2], [sqrt(2)/2, sqrt(2)/2]])\n",
"found Matrix([[1, 0], [0, -I]])\n",
"found Matrix([[1/2 + I/2, 1/2 - I/2], [1/2 + I/2, -1/2 + I/2]])\n",
"found Matrix([[0, 1], [1, 0]])\n",
"found Matrix([[sqrt(2)/2, sqrt(2)/2], [-sqrt(2)*I/2, sqrt(2)*I/2]])\n",
"found Matrix([[1/2 + I/2, 1/2 + I/2], [1/2 - I/2, -1/2 + I/2]])\n",
"found Matrix([[sqrt(2)/2, sqrt(2)*I/2], [-sqrt(2)/2, sqrt(2)*I/2]])\n",
"found Matrix([[sqrt(2)/2, -sqrt(2)/2], [sqrt(2)*I/2, sqrt(2)*I/2]])\n",
"found Matrix([[sqrt(2)/2, -sqrt(2)*I/2], [sqrt(2)/2, sqrt(2)*I/2]])\n",
"found Matrix([[sqrt(2)*(1 + I)/2, 0], [0, sqrt(2)*(1 - I)/2]])\n",
"found Matrix([[1/2 + I/2, 1/2 - I/2], [-1/2 + I/2, -1/2 - I/2]])\n",
"found Matrix([[0, 1], [I, 0]])\n",
"found Matrix([[1/2 - I/2, 1/2 + I/2], [1/2 + I/2, 1/2 - I/2]])\n",
"found Matrix([[1/2 + I/2, 1/2 + I/2], [1/2 + I/2, I*(-1 + I)/2]])\n",
"found Matrix([[0, I], [1, 0]])\n",
"found Matrix([[sqrt(2)/2, sqrt(2)*I/2], [-sqrt(2)*I/2, -sqrt(2)/2]])\n",
"found Matrix([[1/2 + I/2, -1/2 + I/2], [1/2 - I/2, I*(-1 + I)/2]])\n",
"found Matrix([[sqrt(2)/2, -sqrt(2)/2], [-sqrt(2)/2, -sqrt(2)/2]])\n",
"found Matrix([[sqrt(2)/2, -sqrt(2)*I/2], [sqrt(2)*I/2, -sqrt(2)/2]])\n"
]
}
],
"source": [
"\n",
"#def list_contains_matrix(l, m):\n",
"# for elem in l:\n",
"# test = simplify(elem - m)\n",
"# if(test == 0):\n",
"# return True\n",
"# return False\n",
"\n",
"def list_contains_matrix(l, m):\n",
" #print(l, m)\n",
" for test in pool.map(is_math_the_same, [(e,m) for e in l]):\n",
" if(test):\n",
" return True\n",
"\n",
"\n",
"#for i in range(10):\n",
"while(len(C) < 24):\n",
" new_ops = ([c * H for c in C]\n",
" + [c * S for c in C])\n",
" for new_op in new_ops:\n",
" new_op.simplify()\n",
" #if(new_op not in C): # and Dagger(new_op) not in C):\n",
" if(not list_contains_matrix(C, new_op)):\n",
" print(\"found\", new_op)\n",
" C.append(new_op)\n",
" #else:\n",
" #print(new_op, \"is already known\")\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"for c in C:\n",
" c.simplify()\n",
"#C = [c for c in C if Dagger(c) not in C]"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAADzsAAAA/CAYAAADNTERjAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4Ae2dj9HcNu737UwK8OU6cDqwcxWc3YGdq+DsDuJJBR6nA/squHM6iH8VJHYHcQfJ6w7yAvtIu1wtJZEiSILAVzPalSiKBD4AQer//Xv37j2h+Real9Pnv/7669tl4v3797PyL/fHugwBssNHKulRpLTnZLefI+lIAgGXBBCzxjO7xvgGP9LtRxp9RjcxSAcCINCTAPqUnvQvdWvsO+AbF/u0WoIftCI9Xj0afWM8ipAYBEAABPwQwDhuPFujrx/PZpB4TAKIj7rtpi0Wwl/gL7kE4DO5xNrl1xZfWHP4Szv7o6Z1Ahrbxrq02AICIAACIAACIAACIAAC9gngWNGujXH8Zde20EwXAcRRXfY4Ko3GmAnf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Ek8N98ddyUQyapBp19VGZGndv3eNlpBhdEYj+mWCWbpmSRjrdZVPc+VH2cGP5ayqlKWcgokl8fEaZb16ERat4zyE7edrZu8Ycpw5C380js7743+fQApjz7HUe/zc86AIHzd9yx6beXuEEW9yyUk7i69no/X4JzjzRYDw67mpFwF6iJxc54puvL8J/ZJBICMIGCTgtX2v6I2YluHjKwy5BBMcj+pH+/HFdH7j8z/oIOw5A8EEAiBwIYA2cmERWwKfGJW7tKNxeb1EXVtW9DPRp0qRXmHExQ/H6agutJ/bccYKs+Fsf6Q9rOg+pO8f0R/7gECMgOd4GOORmwZ+ucSQvzYBr33dit4uxje1fUqifMTKcopgeJyh5fiwohvD2ox/8Kc7fzrK77g
"text/latex": [
"$\\displaystyle \\left[ \\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}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{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}\\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{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{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} i}{2}\\\\- \\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\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} \\left(1 + i\\right)}{2} & 0\\\\0 & \\frac{\\sqrt{2} \\left(1 - i\\right)}{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\\\\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}\\frac{1}{2} + \\frac{i}{2} & \\frac{1}{2} + \\frac{i}{2}\\\\\\frac{1}{2} + \\frac{i}{2} & \\frac{i \\left(-1 + i\\right)}{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{i \\left(-1 + i\\right)}{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}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2}}{2}\\end{matrix}\\right]\\right]$"
],
"text/plain": [
"⎡⎡√2 √2 ⎤ ⎡ √2 √2 ⎤ ⎡√2 √2⋅ ⎤ ⎡1 1 \n",
"⎢⎢── ── ⎥ ⎢ ── ── ⎥ ⎢── ──── ⎥ ⎢─ + ─ ─ \n",
"⎢⎢2 2 ⎥ ⎡1 0⎤ ⎡1 0⎤ ⎢ 2 2 ⎥ ⎢2 2 ⎥ ⎡1 0 ⎤ ⎢2 2 2 \n",
"⎢⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ \n",
"⎢⎢√2 -√2 ⎥ ⎣0 ⅈ⎦ ⎣0 1⎦ ⎢√2⋅ -√2⋅ ⎥ ⎢√2 -√2⋅ ⎥ ⎣0 -1⎦ ⎢1 1 \n",
"⎢⎢── ────⎥ ⎢──── ──────⎥ ⎢── ──────⎥ ⎢─ - ─ ─ \n",
"⎣⎣2 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 ⎦ ⎣2 2 2 \n",
"\n",
" ⅈ⎤ ⎡ √2 √2⎤ ⎡ √2 √2⋅⎤ ⎡√2 -√2 ⎤ ⎡1 1 ⎤ \n",
"- ─⎥ ⎢ ── ──⎥ ⎢ ── ────⎥ ⎢── ────⎥ ⎢─ + ─ ─ - ─ ⎥ \n",
" 2⎥ ⎢ 2 2 ⎥ ⎢ 2 2 ⎥ ⎢2 2 ⎥ ⎡1 0 ⎤ ⎢2 2 2 2 ⎥ ⎡0 1⎤ \n",
" ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥,\n",
" ⅈ⎥ ⎢-√2 √2⎥ ⎢√2⋅ √2 ⎥ ⎢√2 √2 ⎥ ⎣0 -ⅈ⎦ ⎢1 1 ⅈ⎥ ⎣1 0⎦ \n",
"+ ─⎥ ⎢──── ──⎥ ⎢──── ── ⎥ ⎢── ── ⎥ ⎢─ + ─ - ─ + ─⎥ \n",
" 2⎦ ⎣ 2 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 ⎦ ⎣2 2 2 2⎦ \n",
"\n",
" ⎡ √2 √2 ⎤ ⎡1 1 ⎤ ⎡ √2 √2⋅⎤ ⎡ √2 -√2 ⎤ ⎡√2 -√2⋅ ⎤ ⎡\n",
" ⎢ ── ── ⎥ ⎢─ + ─ ─ + ─ ⎥ ⎢ ── ────⎥ ⎢ ── ────⎥ ⎢── ──────⎥ ⎢\n",
" ⎢ 2 2 ⎥ ⎢2 2 2 2 ⎥ ⎢ 2 2 ⎥ ⎢ 2 2 ⎥ ⎢2 2 ⎥ ⎢\n",
" ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢\n",
" ⎢-√2⋅ √2⋅⎥ ⎢1 1 ⅈ⎥ ⎢-√2 √2⋅⎥ ⎢√2⋅ √2⋅⎥ ⎢√2 √2⋅ ⎥ ⎢\n",
" ⎢────── ────⎥ ⎢─ - ─ - ─ + ─⎥ ⎢──── ────⎥ ⎢──── ────⎥ ⎢── ──── ⎥ ⎢\n",
" ⎣ 2 2 ⎦ ⎣2 2 2 2⎦ ⎣ 2 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 ⎦ ⎣\n",
"\n",
"√2⋅(1 + ) ⎤ ⎡ 1 1 ⎤ ⎡1 1 ⅈ⎤ ⎡1 \n",
"────────── 0 ⎥ ⎢ ─ + ─ ─ - ─ ⎥ ⎢─ - ─ ─ + ─⎥ ⎢─ + ─ \n",
" 2 ⎥ ⎢ 2 2 2 2 ⎥ ⎡0 1⎤ ⎢2 2 2 2⎥ ⎢2 2 \n",
" ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ \n",
" √2⋅(1 - )⎥ ⎢ 1 1 ⅈ⎥ ⎣ⅈ 0⎦ ⎢1 1 ⅈ⎥ ⎢1 \n",
" 0 ──────────⎥ ⎢- ─ + ─ - ─ - ─⎥ ⎢─ + ─ ─ - ─⎥ ⎢─ + ─ ─\n",
" 2 ⎦ ⎣ 2 2 2 2⎦ ⎣2 2 2 2⎦ ⎣2 2 \n",
"\n",
" 1 ⎤ ⎡ √2 √2⋅⎤ ⎡1 1 ⎤ ⎡ √2 -√2 ⎤ ⎡ √2 \n",
" ─ + ─ ⎥ ⎢ ── ────⎥ ⎢─ + ─ - ─ + ─ ⎥ ⎢ ── ────⎥ ⎢ ── \n",
" 2 2 ⎥ ⎡0 ⅈ⎤ ⎢ 2 2 ⎥ ⎢2 2 2 2 ⎥ ⎢ 2 2 ⎥ ⎢ 2 \n",
" ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ \n",
"⋅(-1 + )⎥ ⎣1 0⎦ ⎢-√2⋅ -√2 ⎥ ⎢1 ⅈ⋅(-1 + )⎥ ⎢-√2 -√2 ⎥ ⎢√2⋅ \n",
"─────────⎥ ⎢────── ────⎥ ⎢─ - ─ ──────────⎥ ⎢──── ────⎥ ⎢──── \n",
" 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 2 ⎦ ⎣ 2 2 ⎦ ⎣ 2 \n",
"\n",
"-√2⋅ ⎤⎤\n",
"──────⎥⎥\n",
" 2 ⎥⎥\n",
" ⎥⎥\n",
" -√2 ⎥⎥\n",
" ──── ⎥⎥\n",
" 2 ⎦⎦"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"C"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAOCAYAAADNGCeJAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABZklEQVQ4EXWTgVHDMAxFHY4BcmWDdoMCE5ARwgqwAT1GgA06Q9mgXaHdgG5A0w3Ce8HKNSTV3Y+tL/lbke2ibdtUFMU8pbQC2gM4gRWxg0QYeSXzd/AD7oD+hrwdY2cKSaQA/gdoQRWcI7a+9DO3ga/zPOmUE0kNfBM88xcRfoyuBXv9GyYVaPIvMO3N0svcAskFeHZyzRRz0RHl85Ukd9a2oEJ8+29jW7I2oe9TlB0joe+/8KCXtsTmiTegSNcv102KkbAE3YIQjxE+Dsf4Hsz7WEwuRxKsaurkanjFvAH+toKiO/VRZQQsfUrI0xzw+Ior5smXAzGI0YKoOBaEHyO8VSpY3/LpjBNylwVJr5mKl6Hri/Aujk4c7sjaL+Izr4aLbPgjgXhS0pobnLLImTyrmDKvz67gE83s31fOnjEuEfKyuqGX2+Y/ZXFpeVtj1Z+KebxWNmUHku4jkP/Ah+5vh/UP/Rd43VK9lG9blAAAAABJRU5ErkJggg==\n",
"text/latex": [
"$\\displaystyle 28$"
],
"text/plain": [
"28"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(C)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This is bad. Does one have to ignore global phases? Note that the matrices 10 and 18 are the same, disregarding a phase of $pi/4$:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAEIAAAAzCAYAAAAjKt6MAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADb0lEQVRoBe1bi3ETMRC1GQrwQAdOBwlUgNMBoQOgAxhXwIQOAhUwuIOECjJJB6EDPO7AvHfsZnQXaXUyOtu60c7IZ31ute9pV6eT7OlkMpkhPZHtdrt5UjiCgul06sVLaA9I2066AhGTMSbgvO5gJfbrZ/ignAP01Ekf/xWP7xMYW1iBsMGqRIwPcSKi533bI7ZO0fYn0hlYPYr5AzZdiv1/cD1BuoRtv6Us6WISIRPLd2hcI71CmidpH7AxbLuD+i8AvmI3YusdrnT9ZDLM0ODII10gMY5+sMNjEID9ADtmsKshgTbRVlyYv2I+VUwiUpXtsf0F+rr39HeLsoV4h6c6XFQqEQtAYrh2Recu1idJcUT0HO0XSSygcXFEwGYFqaPvYlYvmbmFfb6XSEQfXC/7NHLblEiEjrqLQ7+rt3BdkSTFESGPSYL0ub+W5V1HJFG638Y36G7u6VI9gvVJUpxHCDou9bnS7coZCu4dr+nWB/NFEgGg34BojUfpW0Umj9V3yL/XspSr+a5BReiA7DP2dAS4nueq7hYGfcX1UMLRX8IWDZHXyL+BTbQtWaJEQDGXs0cnsGsDoz7nMqzI0MgF3tVTiRA2KhGVCDcwynzpaiPIlKuhUUOj7UrVI6pHVI9oMyC56BKb7bCez3aQ4rVi4ELY/wldnGBZHjzKjBIBJVkPUgbGHFJPAh7PQHyNTCJAgvcgBeV6kHLuU3psZfAEHgeaEntqZD9IMa05YGWMiAVs822W8hWYwvpRSDA04P66EWoB1T1Cq81B6sR+hjbD4gHhYW4iWR6hIHX0XUDqJX3Icu/b5/elgOcO2zLWsUVE7F7WJx+k9FH6v23gDXPo4IEwhfNcdHs/GBq4WUedyrqi3pJ8kNJVFMqLa/9CfYrX8ScM3LNc46qPS4ZHdEsvSAQUbWAM7fQZomVRpqlgF2H/uI8btMki93IhqLvc3PU2JRYa2Q9STGvyV3JuWCkxlvoYEdkPUixjctZJaJ1CZ/NLH+T1NcHbjUkEmMx+kOK1YpjC5hwGGFYggZMnf08alOAc4dyR9SDF0TvoVxBwAwKY+MLF34KZ80SUCCjgpBWddQdFtaNy2N77XcgMjR37L/K2SoQMWyWiEtGO4OoRwoc+NeZ4zOiyuamSp0WbthHkujgB6RF3/eMK/rjyFzozUuFUA8PIAAAAAElFTkSuQmCC\n",
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0\\\\0 & - i\\end{matrix}\\right]$"
],
"text/plain": [
"⎡1 0 ⎤\n",
"⎢ ⎥\n",
"⎣0 -ⅈ⎦"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"C[10]"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAKkAAAA/CAYAAACb6uhxAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAI80lEQVR4Ae2di3UVNxCGbR8KIKQ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x3OVzXavGnCqb3s1myjzGpStwNJ7sYYm6bBmtQB3vdBX/P4N0iAsvnKVOWagdZRYPRgAfmqY5oNpjnLix92p8Emkd4RtDnThHO22dOi3fLYOCgyq0k5ObRlMEKmdzRqY5/LvXfax1I69RWZ1fQ8dj1Fh35qeNdzsllN0ZjFFpTozOs0EldpmnAuKQgAbIzQSv5rWbRZ7kinqdJp0M4bY6LHd0uAeAmHwvNfnD7OVAgfo8xqmtKkasRqTBN2aZSp8ZIB2g0tgkYMGjJH1+VDeyU+zqu0WcxqxjRz76oHTTqbWU3RajSpnuNNP+YYnRonfhD2LUvLnk89wzJgal2Wy6ud5sxqTpGX2gOAO5cdOdrKb2+619RFQ3a5e7sybCSdKd6aWc0pomX5Msqs5smUWvdQ1gPwOkPb7wxLgJwpvq4oaRZzZjXHStDtM0ab1TR7BNUjEHOmCXt4NZUk4K/SrKY1kHptmetcr2U5N92Uk6ZhHb6YU32L1eUrytWpQVPEiCmQiulVmib0HTH2WdpZY+mvvZy1NSnyXJ1pwrWDwDr/pjSpE9bqTBNa7+Q2f5p62Xz6Hwv8Qb9Z05rmNKmmvtWZJmyDYAXhVZnWNAdS18GrMk24AlC2WSy5KN0uc7Cwxeme2y6ck3b+Xn0waW2n4pKL0mZaaxKkZqSzUUbckipuHaA1a1rT6nQfC7C+71EC2kRxicW0ac0K0j0CwDppAfRUPOYuSptivU73prpjOWY8QDX1mzetWTXpcrgwU5MDaOdFaTOMOkaCJhXj7d+PWUgHAwPWGK/8TJIAn+dwoM8zOPU3G6iDOOEPXlgf33L8wA+zD26l6AtDMc2nB9VVCexdAgIpAPWXiOL6Pv4PEXDm6Pb7a5AAAAAASUVORK5CYII=\n",
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}\\frac{\\sqrt{2} \\left(1 + i\\right)}{2} & 0\\\\0 & \\frac{\\sqrt{2} \\left(1 - i\\right)}{2}\\end{matrix}\\right]$"
],
"text/plain": [
"⎡√2⋅(1 + ) ⎤\n",
"⎢────────── 0 ⎥\n",
"⎢ 2 ⎥\n",
"⎢ ⎥\n",
"⎢ √2⋅(1 - )⎥\n",
"⎢ 0 ──────────⎥\n",
"⎣ 2 ⎦"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"C[18]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"XXX: continue here with computations"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"lookup_table = [ca * cb for ca, cb in product(C, C)]\n",
"for l in lookup_table:\n",
" l.simplify()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(lookup_table) == 24*24"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"ltb = []\n",
"row = []\n",
"for i, result in enumerate(lookup_table):\n",
" if(i % 24):\n",
" ltb.append(row)\n",
" row = []\n",
" row.append(result)\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"#lookup_table = [[C.index(i) for i in row] for row in ltb]\n"
]
}
],
"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
}