{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Symmetrized N-up States\n", "$$\n", " \\newcommand{\\ul}[1]{\\underline{#1}}\n", " \\newcommand{\\rvalp}[0]{{\\ul{\\alpha}}}\n", "\\newcommand{\\alp}[0]{{\\alpha}}\n", " \\newcommand{\\rvx}[0]{{\\ul{x}}}\n", "\\newcommand{\\rvy}[0]{{\\ul{y}}}\n", "$$\n", "\n", "The purpose of this notebook is to construct a \"symmetrized-N-up-state\" state vector and its\n", " corresponding density matrix, and then to calculate the \"entanglement profile\"\n", " of that state. \n", " \n", " In Entaglish, density matrices are stored in the class DenMat.\n", " That class contains attributes: num_rows, row_shape and arr.\n", " arr is a numpy array of shape=(num_rows, num_rows).\n", " row_shape is a tuple such that the product of its components is num_rows.\n", " For example, a state with row_shape=(2,3,4) consists of 3 qudits with\n", " d=2,3,4 and num_rows=24.\n", " \n", " \n", " See Entanglish-Original-Ref for an explicit definition of \"symmetrized-N-up-states\". \n", " As their name implies, such states consist of NT qubits, with\n", " N qubits up (i.e, in state 1) and NT-N qubits down (i.e., in state 0).\n", " A full symmetrization operator is applied \n", " to the state so that it completely\n", " forgets which of the NT qubits are up and which are down.\n", " \n", " In\n", "Entanglish-Original-Ref, we derive an analytical formula \n", "for the entanglement of any symmetrized n-up state.\n", " \n", "Given a state with num_row_axes qudits, one can define\n", "a (bipartite) entanglement for each possible bi-partitions of range(\n", "num_row_axes). By a bi-partition we mean two nonempty disjoint subsets\n", "whose union is range(num_row_axes). An entanglement profile \n", "is a dictionary mapping bi-partition half-size to a dictionary that \n", "maps each bi-partition of that half-size to its entanglement.\n", "\n", "**Entanglish-Original-Ref**\n", "* \"A New Algorithm for Calculating\n", "Squashed Entanglement and a Python Implementation Thereof\", by R.R.Tucci\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First change your working directory to the entanglish directory in your computer, and add its path to the path environment variable." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "import sys\n", "print(os.getcwd())\n", "os.chdir('../../')\n", "print(os.getcwd())\n", "sys.path.insert(0,os.getcwd())" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from entanglish.DenMat import *\n", "from entanglish.SymNupState import *\n", "from entanglish.PureStEnt import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a SymNupState object st with 5 qubits, 3 of which are up.\n", "Its entanglement depends only on the number\n", "of axes in $\\rvx$, and the number of axes in $\\rvy$,\n", "not in their particular identities. st.get_known_entang()\n", "calculates entanglement using the known analytical formula." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "st_vec=\n", " [0. +0.j 0. +0.j 0. +0.j 0. +0.j\n", " 0. +0.j 0. +0.j 0. +0.j 0.31622777+0.j\n", " 0. +0.j 0. +0.j 0. +0.j 0.31622777+0.j\n", " 0. +0.j 0.31622777+0.j 0.31622777+0.j 0. +0.j\n", " 0. +0.j 0. +0.j 0. +0.j 0.31622777+0.j\n", " 0. +0.j 0.31622777+0.j 0.31622777+0.j 0. +0.j\n", " 0. +0.j 0.31622777+0.j 0.31622777+0.j 0. +0.j\n", " 0.31622777+0.j 0. +0.j 0. +0.j 0. +0.j]\n", "known entang for 0 x axes= 0.0\n", "known entang for 1 x axes= 0.6730116670092565\n", "known entang for 2 x axes= 0.8979457248567798\n", "known entang for 3 x axes= 0.8979457248567797\n", "known entang for 4 x axes= 0.6730116670092565\n", "known entang for 5 x axes= 0.0\n" ] } ], "source": [ "num_up = 3\n", "num_qbits = 5\n", "st = SymNupState(num_up, num_qbits)\n", "st_vec = st.get_st_vec()\n", "print('st_vec=\\n', st_vec)\n", "for num_x_axes in range(0, num_qbits+1):\n", " print('known entang for ' + str(num_x_axes) + ' x axes=',\n", " st.get_known_entang(num_x_axes))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a DenMat object called dm,\n", "and set dm.arr equal to st_vec times its Hermitian, \n", "where st_vec is the state vector for the symmetrized n-up state.\n", "\n", "Class PureStEnt is a child of class EntangCase. \n", "\n", "All objects with EntangCase as a parent\n", "calculate entanglement numerically, from\n", "an algorithm, not from a known analytical formula. \n", "For a pure state, that algo is the von Neumann entropy of a partial trace of dm.\n", "\n", "All objects with EntangCase as a parent\n", "inherit methods for calculating and printing entanglement profiles." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "bi-partition half-size=1\n", "(0 | 1, 2, 3, 4) :\t 0.67301, max-entang= 0.69315\n", "(1 | 0, 2, 3, 4) :\t 0.67301, max-entang= 0.69315\n", "(2 | 0, 1, 3, 4) :\t 0.67301, max-entang= 0.69315\n", "(3 | 0, 1, 2, 4) :\t 0.67301, max-entang= 0.69315\n", "(4 | 0, 1, 2, 3) :\t 0.67301, max-entang= 0.69315\n", "bi-partition half-size=2\n", "(0, 1 | 2, 3, 4) :\t 0.89795, max-entang= 1.38629\n", "(0, 2 | 1, 3, 4) :\t 0.89795, max-entang= 1.38629\n", "(0, 3 | 1, 2, 4) :\t 0.89795, max-entang= 1.38629\n", "(0, 4 | 1, 2, 3) :\t 0.89795, max-entang= 1.38629\n", "(1, 2 | 0, 3, 4) :\t 0.89795, max-entang= 1.38629\n", "(1, 3 | 0, 2, 4) :\t 0.89795, max-entang= 1.38629\n", "(1, 4 | 0, 2, 3) :\t 0.89795, max-entang= 1.38629\n", "(2, 3 | 0, 1, 4) :\t 0.89795, max-entang= 1.38629\n", "(2, 4 | 0, 1, 3) :\t 0.89795, max-entang= 1.38629\n", "(3, 4 | 0, 1, 2) :\t 0.89795, max-entang= 1.38629\n", "\n" ] } ], "source": [ "num_rows = 1 << num_qbits\n", "row_shape = tuple([2]*num_qbits)\n", "dm = DenMat(num_rows, row_shape)\n", "dm.set_arr_from_st_vec(st_vec)\n", "ecase = PureStEnt(dm, 'eigen')\n", "pf = ecase.get_entang_profile()\n", "ecase.print_entang_profiles([pf], dm.row_shape)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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 }