{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [], "source": [ "from __future__ import division, print_function, absolute_import, unicode_literals\n", "import numpy as np\n", "\n", "import pygsti\n", "from pygsti.construction import std1Q_XYI as std\n", "from pygsti.construction import std2Q_XYICNOT as std2Q\n", "from pygsti.extras import circuit" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Test Labels" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Gi', 'Gx', 'Gy']\n", "odict_keys([Label('Gi',), Label('Gx',), Label('Gy',)])\n" ] } ], "source": [ "print(list(map(str,std.gs_target.gates.keys())))\n", "print(std.gs_target.gates.keys())" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Fully Parameterized gate with shape (4, 4)\n", " 1.00 0 0 0\n", " 0 1.00 0 0\n", " 0 0 0-1.00\n", " 0 0 1.00 0\n", "\n" ] } ], "source": [ "print(std.gs_target['Gx'])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [ "OutcomeLabelDict([(('0',), 0.5000000000000001), (('1',), 0.4999999999999999)])" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "std.gs_target.probs(('Gx','Gy'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Test Circuit" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [], "source": [ "c = pygsti.obj.Circuit(gatestring=('Gx','Gy'), num_lines=1)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[Label('Gx',), Label('Gy',)]]\n", "(Label('Gx',), Label('Gy',))\n", "GxGy\n", "Qubit 0 ---Gx|-|Gy|-|--\n", "\n" ] } ], "source": [ "print(c.line_items)\n", "print(c.tup)\n", "print(c.str)\n", "print(c)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [], "source": [ "from pygsti.objects import Label as L\n", "gs = pygsti.obj.GateString( (L('Gx',0),L('Gy',1),L('Gcnot',(1,2)) ))\n", "c2 = pygsti.obj.Circuit(gatestring=gs, num_lines=3)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[Label('Gx', 0), Label('I', 0)], [Label('Gy', 1), Label('Gcnot', 1, 2)], [Label('I', 2), Label('Gcnot', 1, 2)]]\n", "(Label('Gx', 0), Label('Gy', 1), Label('Gcnot', 1, 2))\n", "Gx:0Gy:1Gcnot:1:2\n", "Qubit 0 ---|Gx |-| |---\n", "Qubit 1 ---|Gy |-Gcnot:1:2|-|--\n", "Qubit 2 ---| |-Gcnot:1:2|-|--\n", "\n" ] } ], "source": [ "print(c2.line_items)\n", "print(c2.tup)\n", "print(c2.str)\n", "print(c2)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[Label('Gx', 'Q0'), Label('I', 'Q0')], [Label('Gy', 'Q1'), Label('Gcnot', 'Q1', 'Q2')], [Label('I', 'Q2'), Label('Gcnot', 'Q1', 'Q2')]]\n", "(Label('Gx', 'Q0'), Label('Gy', 'Q1'), Label('Gcnot', 'Q1', 'Q2'))\n", "Gx:Q0Gy:Q1Gcnot:Q1:Q2\n", "Qubit 0 ---|Gx |-| |---\n", "Qubit 1 ---|Gy |-Gcnot:Q1:Q2|-|--\n", "Qubit 2 ---| |-Gcnot:Q1:Q2|-|--\n", "\n" ] } ], "source": [ "c3 = pygsti.obj.Circuit(gatestring=[ ('Gx','Q0'), ('Gy','Q1'), ('Gcnot','Q1','Q2') ], line_labels=('Q0','Q1','Q2'))\n", "print(c3.line_items)\n", "print(c3.tup)\n", "print(c3.str)\n", "print(c3)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "HERE1\n", "Gx:0\n", "HERE2\n", "Gy:1\n" ] } ], "source": [ "#Test initializing an empty circuit & debug circuit -> tuple lazy eval\n", "c0 = pygsti.obj.Circuit(num_lines=3)\n", "c1 = pygsti.obj.Circuit(gatestring=( ('Gx',0), ('Gcnot',0,1)), num_lines=3)\n", "print(\"HERE1\")\n", "print(c1[0])\n", "c1.insert_layer([pygsti.obj.Label('Gy',1)],0)\n", "print(\"HERE2\")\n", "print(c1[0])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Probabilities from circuit (simulation)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OutcomeLabelDict([(('0',), 0.5000000000000001), (('1',), 0.4999999999999999)])\n", "OutcomeLabelDict([(('0',), 0.5000000000000001), (('1',), 0.4999999999999999)])\n" ] } ], "source": [ "gs1 = std.gs_target.copy()\n", "print(gs1.probs(c))\n", "print(c.simulate(gs1))" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OutcomeLabelDict([(('000',), 0.2500000000000003), (('001',), 0.2500000000000003), (('010',), 0.0), (('011',), 0.0), (('100',), 0.2500000000000002), (('101',), 0.2500000000000002), (('110',), 0.0), (('111',), 0.0)])\n", "OutcomeLabelDict([(('000',), 0.2500000000000003), (('001',), 0.2500000000000003), (('010',), 0.0), (('011',), 0.0), (('100',), 0.2500000000000002), (('101',), 0.2500000000000002), (('110',), 0.0), (('111',), 0.0)])\n" ] } ], "source": [ "from pygsti.objects.gatemapcalc import GateMapCalc \n", "nQubits = 3\n", "basis1Q = pygsti.obj.Basis(\"pp\",2)\n", "v0 = pygsti.construction.basis_build_vector(\"0\", basis1Q)\n", "v1 = pygsti.construction.basis_build_vector(\"1\", basis1Q)\n", "\n", "gs3 = pygsti.obj.GateSet()\n", "gs3.stateSpaceLabels = ('Q0','Q1','Q2')\n", "gs3.preps['rho0'] = pygsti.obj.TensorProdSPAMVec('prep',\n", " [pygsti.obj.TPParameterizedSPAMVec(v0) for i in range(nQubits)] )\n", "gs3.povms['Mdefault'] = pygsti.obj.TensorProdPOVM( \n", " [ pygsti.obj.TPPOVM([('0',v0),('1',v1)] ) for i in range(nQubits) ] )\n", "Gx = std.gs_target['Gx'].copy()\n", "Gy = std.gs_target['Gy'].copy()\n", "for i in range(nQubits):\n", " gs3[('Gx','Q%d' % i)] = Gx\n", " gs3[('Gy','Q%d' % i)] = Gy\n", "\n", "Gcnot = std2Q.gs_target['Gcnot'].copy()\n", "gs3[('Gcnot','Q0','Q1')] = Gcnot\n", "gs3[('Gcnot','Q1','Q2')] = Gcnot\n", "\n", "gs3._calcClass = GateMapCalc\n", "print(gs3.probs(c3))\n", "print(c3.simulate(gs3))" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OutcomeLabelDict([(('000',), 0.2500000000000003), (('001',), 0.2500000000000003), (('010',), 0.0), (('011',), 0.0), (('100',), 0.2500000000000002), (('101',), 0.2500000000000002), (('110',), 0.0), (('111',), 0.0)])\n", "OutcomeLabelDict([(('000',), 0.2500000000000003), (('001',), 0.2500000000000003), (('010',), 0.0), (('011',), 0.0), (('100',), 0.2500000000000002), (('101',), 0.2500000000000002), (('110',), 0.0), (('111',), 0.0)])\n" ] } ], "source": [ "from pygsti.objects.gatemapcalc import GateMapCalc \n", "from pygsti.objects.labeldicts import StateSpaceLabels\n", "nQubits = 3\n", "basis1Q = pygsti.obj.Basis(\"pp\",2)\n", "v0 = pygsti.construction.basis_build_vector(\"0\", basis1Q)\n", "v1 = pygsti.construction.basis_build_vector(\"1\", basis1Q)\n", "\n", "gs2 = pygsti.obj.GateSet()\n", "gs2.stateSpaceLabels = (0,1,2)\n", "gs2.preps['rho0'] = pygsti.obj.TensorProdSPAMVec('prep',\n", " [pygsti.obj.TPParameterizedSPAMVec(v0) for i in range(nQubits)] )\n", "gs2.povms['Mdefault'] = pygsti.obj.TensorProdPOVM( \n", " [ pygsti.obj.TPPOVM([('0',v0),('1',v1)] ) for i in range(nQubits) ] )\n", "\n", "Gx = std.gs_target['Gx'].copy()\n", "Gy = std.gs_target['Gy'].copy()\n", "for i in range(nQubits):\n", " gs2[('Gx',i)] = Gx\n", " gs2[('Gy',i)] = Gy\n", "\n", "Gcnot = std2Q.gs_target['Gcnot'].copy()\n", "gs2[('Gcnot',0,1)] = Gcnot\n", "gs2[('Gcnot',1,2)] = Gcnot\n", "\n", "gs2._calcClass = GateMapCalc\n", "print(gs2.probs(c2))\n", "print(c2.simulate(gs2))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Unitary evolution in pyGSTi" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [], "source": [ "#Unitary gateset in pygsti\n", "import scipy.linalg as spl\n", "from pygsti.objects.gatematrixcalc import UnitaryGateMatrixCalc\n", "from pygsti.objects.gatemapcalc import UnitaryGateMapCalc\n", "X = np.array([[0.,1.],[1.,0.]])\n", "Ut = np.array([[1.,0.],[0.,np.exp(np.pi*1j/4)]])\n", "Ux = 1j*spl.expm( -1j* np.pi/4 * X) # pi/2\n", "#Ux = np.array([[0.,1.],[1.,0.]]) # pi\n", "v0 = np.array([[1],[0]],'d')\n", "v1 = np.array([[0],[1]],'d')\n", "\n", "gs = pygsti.obj.GateSet()\n", "#gs._calcClass = UnitaryGateMatrixCalc\n", "gs._calcClass = UnitaryGateMapCalc\n", "gs['Gt'] = pygsti.obj.StaticGate(Ut)\n", "gs['Gx'] = pygsti.obj.StaticGate(Ux)\n", "gs['rho0'] = pygsti.obj.StaticSPAMVec( v0 )\n", "gs['M0'] = pygsti.obj.UnconstrainedPOVM({'0': pygsti.obj.StaticSPAMVec( v0 ), '1': pygsti.obj.StaticSPAMVec( v1 )})\n", " " ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([[0. +0.70710678j, 0.70710678+0. j],\n", " [0.70710678+0. j, 0. +0.70710678j]])" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Ux" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OutcomeLabelDict([(('1',), 0.0), (('0',), 1.0)])\n" ] } ], "source": [ "#print(gs.product(()))\n", "#print()\n", "print(gs.probs(()))" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OutcomeLabelDict([(('1',), 0.4999999999999998), (('0',), 0.5000000000000002)])\n" ] } ], "source": [ "#print(gs.product(('Gx',)))\n", "#print()\n", "print(gs.probs(('Gx',)))" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OutcomeLabelDict([(('1',), 0.0), (('0',), 1.0)])\n" ] } ], "source": [ "#print(gs.product(('Gt',)))\n", "#print()\n", "print(gs.probs(('Gt',)))" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OutcomeLabelDict([(('1',), 0.4999999999999998), (('0',), 0.5000000000000002)])\n" ] } ], "source": [ "#print(gs.product(('Gt','Gx')))\n", "#print()\n", "print(gs.probs(('Gt','Gx')))" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OutcomeLabelDict([(('1',), 0.9999999999999998), (('0',), 1.1093356479670479e-31)])\n" ] } ], "source": [ "#print(gs.product(('Gx','Gx')))\n", "#print()\n", "print(gs.probs(('Gx','Gx')))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Simulation of a \"standard\" n-qubit gate set\n", "Based off of some of the initial cells in other test notebook." ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [], "source": [ "import pygsti\n", "import numpy as np\n", "# A list of standard hard-coded gate labels\n", "#gllist = ['I', 'H','P','CNOT']\n", "gllist = ['Gi','Gh','Gp','Gcnot','Gt'] # note: must include Gt here in addition to in 'unitaries' below\n", "\n", "# A dictionary of unitaries that do not need to be already known to the code\n", "#unitaries={'T' : np.array([[1.,0.],[0.,np.exp(np.pi*1j/4)]])}\n", "unitaries={'Gt' : np.array([[1.,0.],[0.,np.exp(np.pi*1j/4)]])}\n", "\n", "# The number of qubits\n", "n = 10\n", "\n", "# The availiability of gates that are not available to all qubit / qubit pairs\n", "availability = {}\n", "\n", "# Let's make a the CNOT gate be connected in a directed ring.\n", "# a = np.zeros((n,n),int)\n", "# for i in range(0,n-1):\n", "# a[i,i+1] = 1\n", "# a[n-1,0] = 1\n", "a = [(i,i+1) for i in range(0,n-1)] + [(n-1,0)]\n", "\n", "#availability={'CNOT':a}\n", "availability={'Gcnot':a}\n", "\n", "BGS = pygsti.construction.build_nqubit_standard_gateset(\n", " nQubits=n, gate_names=gllist, nonstd_gate_unitaries=unitaries,\n", " availability=availability, parameterization='static', sim_type=\"dmmap\")" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#print(BGS.preps['rho0'])\n", "#print(list(map(str,BGS.gates.keys())))\n", "#print(BGS)" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OutcomeLabelDict([(('0000000000',), 0.5000000000000001), (('0000000001',), 0.5000000000000001), (('0000000010',), 0.5000000000000001), (('0000000011',), 0.5000000000000001), (('0000000100',), 0.5000000000000001), (('0000000101',), 0.5000000000000001), (('0000000110',), 0.5000000000000001), (('0000000111',), 0.5000000000000001), (('0000001000',), 0.5000000000000001), (('0000001001',), 0.5000000000000001), (('0000001010',), 0.5000000000000001), (('0000001011',), 0.5000000000000001), (('0000001100',), 0.5000000000000001), (('0000001101',), 0.5000000000000001), (('0000001110',), 0.5000000000000001), (('0000001111',), 0.5000000000000001), (('0000010000',), 0.5000000000000001), (('0000010001',), 0.5000000000000001), (('0000010010',), 0.5000000000000001), (('0000010011',), 0.5000000000000001), (('0000010100',), 0.5000000000000001), (('0000010101',), 0.5000000000000001), (('0000010110',), 0.5000000000000001), (('0000010111',), 0.5000000000000001), (('0000011000',), 0.5000000000000001), (('0000011001',), 0.5000000000000001), (('0000011010',), 0.5000000000000001), (('0000011011',), 0.5000000000000001), (('0000011100',), 0.5000000000000001), (('0000011101',), 0.5000000000000001), (('0000011110',), 0.5000000000000001), (('0000011111',), 0.5000000000000001), (('0000100000',), 0.5000000000000001), (('0000100001',), 0.5000000000000001), (('0000100010',), 0.5000000000000001), (('0000100011',), 0.5000000000000001), (('0000100100',), 0.5000000000000001), (('0000100101',), 0.5000000000000001), (('0000100110',), 0.5000000000000001), (('0000100111',), 0.5000000000000001), (('0000101000',), 0.5000000000000001), (('0000101001',), 0.5000000000000001), (('0000101010',), 0.5000000000000001), (('0000101011',), 0.5000000000000001), (('0000101100',), 0.5000000000000001), (('0000101101',), 0.5000000000000001), (('0000101110',), 0.5000000000000001), (('0000101111',), 0.5000000000000001), (('0000110000',), 0.5000000000000001), (('0000110001',), 0.5000000000000001), (('0000110010',), 0.5000000000000001), (('0000110011',), 0.5000000000000001), (('0000110100',), 0.5000000000000001), (('0000110101',), 0.5000000000000001), (('0000110110',), 0.5000000000000001), (('0000110111',), 0.5000000000000001), (('0000111000',), 0.5000000000000001), (('0000111001',), 0.5000000000000001), (('0000111010',), 0.5000000000000001), (('0000111011',), 0.5000000000000001), (('0000111100',), 0.5000000000000001), (('0000111101',), 0.5000000000000001), (('0000111110',), 0.5000000000000001), (('0000111111',), 0.5000000000000001), (('0001000000',), 0.5000000000000001), (('0001000001',), 0.5000000000000001), (('0001000010',), 0.5000000000000001), (('0001000011',), 0.5000000000000001), (('0001000100',), 0.5000000000000001), (('0001000101',), 0.5000000000000001), (('0001000110',), 0.5000000000000001), (('0001000111',), 0.5000000000000001), (('0001001000',), 0.5000000000000001), (('0001001001',), 0.5000000000000001), (('0001001010',), 0.5000000000000001), (('0001001011',), 0.5000000000000001), (('0001001100',), 0.5000000000000001), (('0001001101',), 0.5000000000000001), (('0001001110',), 0.5000000000000001), (('0001001111',), 0.5000000000000001), (('0001010000',), 0.5000000000000001), (('0001010001',), 0.5000000000000001), (('0001010010',), 0.5000000000000001), (('0001010011',), 0.5000000000000001), (('0001010100',), 0.5000000000000001), (('0001010101',), 0.5000000000000001), (('0001010110',), 0.5000000000000001), (('0001010111',), 0.5000000000000001), (('0001011000',), 0.5000000000000001), (('0001011001',), 0.5000000000000001), (('0001011010',), 0.5000000000000001), (('0001011011',), 0.5000000000000001), (('0001011100',), 0.5000000000000001), (('0001011101',), 0.5000000000000001), (('0001011110',), 0.5000000000000001), (('0001011111',), 0.5000000000000001), (('0001100000',), 0.5000000000000001), (('0001100001',), 0.5000000000000001), (('0001100010',), 0.5000000000000001), (('0001100011',), 0.5000000000000001), (('0001100100',), 0.5000000000000001), (('0001100101',), 0.5000000000000001), (('0001100110',), 0.5000000000000001), (('0001100111',), 0.5000000000000001), (('0001101000',), 0.5000000000000001), (('0001101001',), 0.5000000000000001), (('0001101010',), 0.5000000000000001), (('0001101011',), 0.5000000000000001), (('0001101100',), 0.5000000000000001), (('0001101101',), 0.5000000000000001), (('0001101110',), 0.5000000000000001), (('0001101111',), 0.5000000000000001), (('0001110000',), 0.5000000000000001), (('0001110001',), 0.5000000000000001), (('0001110010',), 0.5000000000000001), (('0001110011',), 0.5000000000000001), (('0001110100',), 0.5000000000000001), (('0001110101',), 0.5000000000000001), (('0001110110',), 0.5000000000000001), (('0001110111',), 0.5000000000000001), (('0001111000',), 0.5000000000000001), (('0001111001',), 0.5000000000000001), (('0001111010',), 0.5000000000000001), (('0001111011',), 0.5000000000000001), (('0001111100',), 0.5000000000000001), (('0001111101',), 0.5000000000000001), (('0001111110',), 0.5000000000000001), (('0001111111',), 0.5000000000000001), (('0010000000',), 0.5000000000000001), (('0010000001',), 0.5000000000000001), (('0010000010',), 0.5000000000000001), (('0010000011',), 0.5000000000000001), (('0010000100',), 0.5000000000000001), (('0010000101',), 0.5000000000000001), (('0010000110',), 0.5000000000000001), (('0010000111',), 0.5000000000000001), (('0010001000',), 0.5000000000000001), (('0010001001',), 0.5000000000000001), (('0010001010',), 0.5000000000000001), (('0010001011',), 0.5000000000000001), (('0010001100',), 0.5000000000000001), (('0010001101',), 0.5000000000000001), (('0010001110',), 0.5000000000000001), (('0010001111',), 0.5000000000000001), (('0010010000',), 0.5000000000000001), (('0010010001',), 0.5000000000000001), (('0010010010',), 0.5000000000000001), (('0010010011',), 0.5000000000000001), (('0010010100',), 0.5000000000000001), (('0010010101',), 0.5000000000000001), (('0010010110',), 0.5000000000000001), (('0010010111',), 0.5000000000000001), (('0010011000',), 0.5000000000000001), (('0010011001',), 0.5000000000000001), (('0010011010',), 0.5000000000000001), (('0010011011',), 0.5000000000000001), (('0010011100',), 0.5000000000000001), (('0010011101',), 0.5000000000000001), (('0010011110',), 0.5000000000000001), (('0010011111',), 0.5000000000000001), (('0010100000',), 0.5000000000000001), (('0010100001',), 0.5000000000000001), (('0010100010',), 0.5000000000000001), (('0010100011',), 0.5000000000000001), (('0010100100',), 0.5000000000000001), (('0010100101',), 0.5000000000000001), (('0010100110',), 0.5000000000000001), (('0010100111',), 0.5000000000000001), (('0010101000',), 0.5000000000000001), (('0010101001',), 0.5000000000000001), (('0010101010',), 0.5000000000000001), (('0010101011',), 0.5000000000000001), (('0010101100',), 0.5000000000000001), (('0010101101',), 0.5000000000000001), (('0010101110',), 0.5000000000000001), (('0010101111',), 0.5000000000000001), (('0010110000',), 0.5000000000000001), (('0010110001',), 0.5000000000000001), (('0010110010',), 0.5000000000000001), (('0010110011',), 0.5000000000000001), (('0010110100',), 0.5000000000000001), (('0010110101',), 0.5000000000000001), (('0010110110',), 0.5000000000000001), (('0010110111',), 0.5000000000000001), (('0010111000',), 0.5000000000000001), (('0010111001',), 0.5000000000000001), (('0010111010',), 0.5000000000000001), (('0010111011',), 0.5000000000000001), (('0010111100',), 0.5000000000000001), (('0010111101',), 0.5000000000000001), (('0010111110',), 0.5000000000000001), (('0010111111',), 0.5000000000000001), (('0011000000',), 0.5000000000000001), (('0011000001',), 0.5000000000000001), (('0011000010',), 0.5000000000000001), (('0011000011',), 0.5000000000000001), (('0011000100',), 0.5000000000000001), (('0011000101',), 0.5000000000000001), (('0011000110',), 0.5000000000000001), (('0011000111',), 0.5000000000000001), (('0011001000',), 0.5000000000000001), (('0011001001',), 0.5000000000000001), (('0011001010',), 0.5000000000000001), (('0011001011',), 0.5000000000000001), (('0011001100',), 0.5000000000000001), (('0011001101',), 0.5000000000000001), (('0011001110',), 0.5000000000000001), (('0011001111',), 0.5000000000000001), (('0011010000',), 0.5000000000000001), (('0011010001',), 0.5000000000000001), (('0011010010',), 0.5000000000000001), (('0011010011',), 0.5000000000000001), (('0011010100',), 0.5000000000000001), (('0011010101',), 0.5000000000000001), (('0011010110',), 0.5000000000000001), (('0011010111',), 0.5000000000000001), (('0011011000',), 0.5000000000000001), (('0011011001',), 0.5000000000000001), (('0011011010',), 0.5000000000000001), (('0011011011',), 0.5000000000000001), (('0011011100',), 0.5000000000000001), (('0011011101',), 0.5000000000000001), (('0011011110',), 0.5000000000000001), (('0011011111',), 0.5000000000000001), (('0011100000',), 0.5000000000000001), (('0011100001',), 0.5000000000000001), (('0011100010',), 0.5000000000000001), (('0011100011',), 0.5000000000000001), (('0011100100',), 0.5000000000000001), (('0011100101',), 0.5000000000000001), (('0011100110',), 0.5000000000000001), (('0011100111',), 0.5000000000000001), (('0011101000',), 0.5000000000000001), (('0011101001',), 0.5000000000000001), (('0011101010',), 0.5000000000000001), (('0011101011',), 0.5000000000000001), (('0011101100',), 0.5000000000000001), (('0011101101',), 0.5000000000000001), (('0011101110',), 0.5000000000000001), (('0011101111',), 0.5000000000000001), (('0011110000',), 0.5000000000000001), (('0011110001',), 0.5000000000000001), (('0011110010',), 0.5000000000000001), (('0011110011',), 0.5000000000000001), (('0011110100',), 0.5000000000000001), (('0011110101',), 0.5000000000000001), (('0011110110',), 0.5000000000000001), (('0011110111',), 0.5000000000000001), (('0011111000',), 0.5000000000000001), (('0011111001',), 0.5000000000000001), (('0011111010',), 0.5000000000000001), (('0011111011',), 0.5000000000000001), (('0011111100',), 0.5000000000000001), (('0011111101',), 0.5000000000000001), (('0011111110',), 0.5000000000000001), (('0011111111',), 0.5000000000000001), (('0100000000',), -2.42861286636753e-17), (('0100000001',), -2.42861286636753e-17), (('0100000010',), -2.42861286636753e-17), (('0100000011',), -2.42861286636753e-17), (('0100000100',), -2.42861286636753e-17), (('0100000101',), -2.42861286636753e-17), (('0100000110',), -2.42861286636753e-17), (('0100000111',), -2.42861286636753e-17), (('0100001000',), -2.42861286636753e-17), (('0100001001',), -2.42861286636753e-17), (('0100001010',), -2.42861286636753e-17), (('0100001011',), -2.42861286636753e-17), (('0100001100',), -2.42861286636753e-17), (('0100001101',), -2.42861286636753e-17), (('0100001110',), -2.42861286636753e-17), (('0100001111',), -2.42861286636753e-17), (('0100010000',), -2.42861286636753e-17), (('0100010001',), -2.42861286636753e-17), (('0100010010',), -2.42861286636753e-17), (('0100010011',), -2.42861286636753e-17), (('0100010100',), -2.42861286636753e-17), (('0100010101',), -2.42861286636753e-17), (('0100010110',), -2.42861286636753e-17), (('0100010111',), -2.42861286636753e-17), (('0100011000',), -2.42861286636753e-17), (('0100011001',), -2.42861286636753e-17), (('0100011010',), -2.42861286636753e-17), (('0100011011',), -2.42861286636753e-17), (('0100011100',), -2.42861286636753e-17), (('0100011101',), -2.42861286636753e-17), (('0100011110',), -2.42861286636753e-17), (('0100011111',), -2.42861286636753e-17), (('0100100000',), -2.42861286636753e-17), (('0100100001',), -2.42861286636753e-17), (('0100100010',), -2.42861286636753e-17), (('0100100011',), -2.42861286636753e-17), (('0100100100',), -2.42861286636753e-17), (('0100100101',), -2.42861286636753e-17), (('0100100110',), -2.42861286636753e-17), (('0100100111',), -2.42861286636753e-17), (('0100101000',), -2.42861286636753e-17), (('0100101001',), -2.42861286636753e-17), (('0100101010',), -2.42861286636753e-17), (('0100101011',), -2.42861286636753e-17), (('0100101100',), -2.42861286636753e-17), (('0100101101',), -2.42861286636753e-17), (('0100101110',), -2.42861286636753e-17), (('0100101111',), -2.42861286636753e-17), (('0100110000',), -2.42861286636753e-17), (('0100110001',), -2.42861286636753e-17), (('0100110010',), -2.42861286636753e-17), (('0100110011',), -2.42861286636753e-17), (('0100110100',), -2.42861286636753e-17), (('0100110101',), -2.42861286636753e-17), (('0100110110',), -2.42861286636753e-17), (('0100110111',), -2.42861286636753e-17), (('0100111000',), -2.42861286636753e-17), (('0100111001',), -2.42861286636753e-17), (('0100111010',), -2.42861286636753e-17), (('0100111011',), -2.42861286636753e-17), (('0100111100',), -2.42861286636753e-17), (('0100111101',), -2.42861286636753e-17), (('0100111110',), -2.42861286636753e-17), (('0100111111',), -2.42861286636753e-17), (('0101000000',), -2.42861286636753e-17), (('0101000001',), -2.42861286636753e-17), (('0101000010',), -2.42861286636753e-17), (('0101000011',), -2.42861286636753e-17), (('0101000100',), -2.42861286636753e-17), (('0101000101',), -2.42861286636753e-17), (('0101000110',), -2.42861286636753e-17), (('0101000111',), -2.42861286636753e-17), (('0101001000',), -2.42861286636753e-17), (('0101001001',), -2.42861286636753e-17), (('0101001010',), -2.42861286636753e-17), (('0101001011',), -2.42861286636753e-17), (('0101001100',), -2.42861286636753e-17), (('0101001101',), -2.42861286636753e-17), (('0101001110',), -2.42861286636753e-17), (('0101001111',), -2.42861286636753e-17), (('0101010000',), -2.42861286636753e-17), (('0101010001',), -2.42861286636753e-17), (('0101010010',), -2.42861286636753e-17), (('0101010011',), -2.42861286636753e-17), (('0101010100',), -2.42861286636753e-17), (('0101010101',), -2.42861286636753e-17), (('0101010110',), -2.42861286636753e-17), (('0101010111',), -2.42861286636753e-17), (('0101011000',), -2.42861286636753e-17), (('0101011001',), -2.42861286636753e-17), (('0101011010',), -2.42861286636753e-17), (('0101011011',), -2.42861286636753e-17), (('0101011100',), -2.42861286636753e-17), (('0101011101',), -2.42861286636753e-17), (('0101011110',), -2.42861286636753e-17), (('0101011111',), -2.42861286636753e-17), (('0101100000',), -2.42861286636753e-17), (('0101100001',), -2.42861286636753e-17), (('0101100010',), -2.42861286636753e-17), (('0101100011',), -2.42861286636753e-17), (('0101100100',), -2.42861286636753e-17), (('0101100101',), -2.42861286636753e-17), (('0101100110',), -2.42861286636753e-17), (('0101100111',), -2.42861286636753e-17), (('0101101000',), -2.42861286636753e-17), (('0101101001',), -2.42861286636753e-17), (('0101101010',), -2.42861286636753e-17), (('0101101011',), -2.42861286636753e-17), (('0101101100',), -2.42861286636753e-17), (('0101101101',), -2.42861286636753e-17), (('0101101110',), -2.42861286636753e-17), (('0101101111',), -2.42861286636753e-17), (('0101110000',), -2.42861286636753e-17), (('0101110001',), -2.42861286636753e-17), (('0101110010',), -2.42861286636753e-17), (('0101110011',), -2.42861286636753e-17), (('0101110100',), -2.42861286636753e-17), (('0101110101',), -2.42861286636753e-17), (('0101110110',), -2.42861286636753e-17), (('0101110111',), -2.42861286636753e-17), (('0101111000',), -2.42861286636753e-17), (('0101111001',), -2.42861286636753e-17), (('0101111010',), -2.42861286636753e-17), (('0101111011',), -2.42861286636753e-17), (('0101111100',), -2.42861286636753e-17), (('0101111101',), -2.42861286636753e-17), (('0101111110',), -2.42861286636753e-17), (('0101111111',), -2.42861286636753e-17), (('0110000000',), -2.42861286636753e-17), (('0110000001',), -2.42861286636753e-17), (('0110000010',), -2.42861286636753e-17), (('0110000011',), -2.42861286636753e-17), (('0110000100',), -2.42861286636753e-17), (('0110000101',), -2.42861286636753e-17), (('0110000110',), -2.42861286636753e-17), (('0110000111',), -2.42861286636753e-17), (('0110001000',), -2.42861286636753e-17), (('0110001001',), -2.42861286636753e-17), (('0110001010',), -2.42861286636753e-17), (('0110001011',), -2.42861286636753e-17), (('0110001100',), -2.42861286636753e-17), (('0110001101',), -2.42861286636753e-17), (('0110001110',), -2.42861286636753e-17), (('0110001111',), -2.42861286636753e-17), (('0110010000',), -2.42861286636753e-17), (('0110010001',), -2.42861286636753e-17), (('0110010010',), -2.42861286636753e-17), (('0110010011',), -2.42861286636753e-17), (('0110010100',), -2.42861286636753e-17), (('0110010101',), -2.42861286636753e-17), (('0110010110',), -2.42861286636753e-17), (('0110010111',), -2.42861286636753e-17), (('0110011000',), -2.42861286636753e-17), (('0110011001',), -2.42861286636753e-17), (('0110011010',), -2.42861286636753e-17), (('0110011011',), -2.42861286636753e-17), (('0110011100',), -2.42861286636753e-17), (('0110011101',), -2.42861286636753e-17), (('0110011110',), -2.42861286636753e-17), (('0110011111',), -2.42861286636753e-17), (('0110100000',), -2.42861286636753e-17), (('0110100001',), -2.42861286636753e-17), (('0110100010',), -2.42861286636753e-17), (('0110100011',), -2.42861286636753e-17), (('0110100100',), -2.42861286636753e-17), (('0110100101',), -2.42861286636753e-17), (('0110100110',), -2.42861286636753e-17), (('0110100111',), -2.42861286636753e-17), (('0110101000',), -2.42861286636753e-17), (('0110101001',), -2.42861286636753e-17), (('0110101010',), -2.42861286636753e-17), (('0110101011',), -2.42861286636753e-17), (('0110101100',), -2.42861286636753e-17), (('0110101101',), -2.42861286636753e-17), (('0110101110',), -2.42861286636753e-17), (('0110101111',), -2.42861286636753e-17), (('0110110000',), -2.42861286636753e-17), (('0110110001',), -2.42861286636753e-17), (('0110110010',), -2.42861286636753e-17), (('0110110011',), -2.42861286636753e-17), (('0110110100',), -2.42861286636753e-17), (('0110110101',), -2.42861286636753e-17), (('0110110110',), -2.42861286636753e-17), (('0110110111',), -2.42861286636753e-17), (('0110111000',), -2.42861286636753e-17), (('0110111001',), -2.42861286636753e-17), (('0110111010',), -2.42861286636753e-17), (('0110111011',), -2.42861286636753e-17), (('0110111100',), -2.42861286636753e-17), (('0110111101',), -2.42861286636753e-17), (('0110111110',), -2.42861286636753e-17), (('0110111111',), -2.42861286636753e-17), (('0111000000',), -2.42861286636753e-17), (('0111000001',), -2.42861286636753e-17), (('0111000010',), -2.42861286636753e-17), (('0111000011',), -2.42861286636753e-17), (('0111000100',), -2.42861286636753e-17), (('0111000101',), -2.42861286636753e-17), (('0111000110',), -2.42861286636753e-17), (('0111000111',), -2.42861286636753e-17), (('0111001000',), -2.42861286636753e-17), (('0111001001',), -2.42861286636753e-17), (('0111001010',), -2.42861286636753e-17), (('0111001011',), -2.42861286636753e-17), (('0111001100',), -2.42861286636753e-17), (('0111001101',), -2.42861286636753e-17), (('0111001110',), -2.42861286636753e-17), (('0111001111',), -2.42861286636753e-17), (('0111010000',), -2.42861286636753e-17), (('0111010001',), -2.42861286636753e-17), (('0111010010',), -2.42861286636753e-17), (('0111010011',), -2.42861286636753e-17), (('0111010100',), -2.42861286636753e-17), (('0111010101',), -2.42861286636753e-17), (('0111010110',), -2.42861286636753e-17), (('0111010111',), -2.42861286636753e-17), (('0111011000',), -2.42861286636753e-17), (('0111011001',), -2.42861286636753e-17), (('0111011010',), -2.42861286636753e-17), (('0111011011',), -2.42861286636753e-17), (('0111011100',), -2.42861286636753e-17), (('0111011101',), -2.42861286636753e-17), (('0111011110',), -2.42861286636753e-17), (('0111011111',), -2.42861286636753e-17), (('0111100000',), -2.42861286636753e-17), (('0111100001',), -2.42861286636753e-17), (('0111100010',), -2.42861286636753e-17), (('0111100011',), -2.42861286636753e-17), (('0111100100',), -2.42861286636753e-17), (('0111100101',), -2.42861286636753e-17), (('0111100110',), -2.42861286636753e-17), (('0111100111',), -2.42861286636753e-17), (('0111101000',), -2.42861286636753e-17), (('0111101001',), -2.42861286636753e-17), (('0111101010',), -2.42861286636753e-17), (('0111101011',), -2.42861286636753e-17), (('0111101100',), -2.42861286636753e-17), (('0111101101',), -2.42861286636753e-17), (('0111101110',), -2.42861286636753e-17), (('0111101111',), -2.42861286636753e-17), (('0111110000',), -2.42861286636753e-17), (('0111110001',), -2.42861286636753e-17), (('0111110010',), -2.42861286636753e-17), (('0111110011',), -2.42861286636753e-17), (('0111110100',), -2.42861286636753e-17), (('0111110101',), -2.42861286636753e-17), (('0111110110',), -2.42861286636753e-17), (('0111110111',), -2.42861286636753e-17), (('0111111000',), -2.42861286636753e-17), (('0111111001',), -2.42861286636753e-17), (('0111111010',), -2.42861286636753e-17), (('0111111011',), -2.42861286636753e-17), (('0111111100',), -2.42861286636753e-17), (('0111111101',), -2.42861286636753e-17), (('0111111110',), -2.42861286636753e-17), (('0111111111',), -2.42861286636753e-17), (('1000000000',), 0.5000000000000001), (('1000000001',), 0.5000000000000001), (('1000000010',), 0.5000000000000001), (('1000000011',), 0.5000000000000001), (('1000000100',), 0.5000000000000001), (('1000000101',), 0.5000000000000001), (('1000000110',), 0.5000000000000001), (('1000000111',), 0.5000000000000001), (('1000001000',), 0.5000000000000001), (('1000001001',), 0.5000000000000001), (('1000001010',), 0.5000000000000001), (('1000001011',), 0.5000000000000001), (('1000001100',), 0.5000000000000001), (('1000001101',), 0.5000000000000001), (('1000001110',), 0.5000000000000001), (('1000001111',), 0.5000000000000001), (('1000010000',), 0.5000000000000001), (('1000010001',), 0.5000000000000001), (('1000010010',), 0.5000000000000001), (('1000010011',), 0.5000000000000001), (('1000010100',), 0.5000000000000001), (('1000010101',), 0.5000000000000001), (('1000010110',), 0.5000000000000001), (('1000010111',), 0.5000000000000001), (('1000011000',), 0.5000000000000001), (('1000011001',), 0.5000000000000001), (('1000011010',), 0.5000000000000001), (('1000011011',), 0.5000000000000001), (('1000011100',), 0.5000000000000001), (('1000011101',), 0.5000000000000001), (('1000011110',), 0.5000000000000001), (('1000011111',), 0.5000000000000001), (('1000100000',), 0.5000000000000001), (('1000100001',), 0.5000000000000001), (('1000100010',), 0.5000000000000001), (('1000100011',), 0.5000000000000001), (('1000100100',), 0.5000000000000001), (('1000100101',), 0.5000000000000001), (('1000100110',), 0.5000000000000001), (('1000100111',), 0.5000000000000001), (('1000101000',), 0.5000000000000001), (('1000101001',), 0.5000000000000001), (('1000101010',), 0.5000000000000001), (('1000101011',), 0.5000000000000001), (('1000101100',), 0.5000000000000001), (('1000101101',), 0.5000000000000001), (('1000101110',), 0.5000000000000001), (('1000101111',), 0.5000000000000001), (('1000110000',), 0.5000000000000001), (('1000110001',), 0.5000000000000001), (('1000110010',), 0.5000000000000001), (('1000110011',), 0.5000000000000001), (('1000110100',), 0.5000000000000001), (('1000110101',), 0.5000000000000001), (('1000110110',), 0.5000000000000001), (('1000110111',), 0.5000000000000001), (('1000111000',), 0.5000000000000001), (('1000111001',), 0.5000000000000001), (('1000111010',), 0.5000000000000001), (('1000111011',), 0.5000000000000001), (('1000111100',), 0.5000000000000001), (('1000111101',), 0.5000000000000001), (('1000111110',), 0.5000000000000001), (('1000111111',), 0.5000000000000001), (('1001000000',), 0.5000000000000001), (('1001000001',), 0.5000000000000001), (('1001000010',), 0.5000000000000001), (('1001000011',), 0.5000000000000001), (('1001000100',), 0.5000000000000001), (('1001000101',), 0.5000000000000001), (('1001000110',), 0.5000000000000001), (('1001000111',), 0.5000000000000001), (('1001001000',), 0.5000000000000001), (('1001001001',), 0.5000000000000001), (('1001001010',), 0.5000000000000001), (('1001001011',), 0.5000000000000001), (('1001001100',), 0.5000000000000001), (('1001001101',), 0.5000000000000001), (('1001001110',), 0.5000000000000001), (('1001001111',), 0.5000000000000001), (('1001010000',), 0.5000000000000001), (('1001010001',), 0.5000000000000001), (('1001010010',), 0.5000000000000001), (('1001010011',), 0.5000000000000001), (('1001010100',), 0.5000000000000001), (('1001010101',), 0.5000000000000001), (('1001010110',), 0.5000000000000001), (('1001010111',), 0.5000000000000001), (('1001011000',), 0.5000000000000001), (('1001011001',), 0.5000000000000001), (('1001011010',), 0.5000000000000001), (('1001011011',), 0.5000000000000001), (('1001011100',), 0.5000000000000001), (('1001011101',), 0.5000000000000001), (('1001011110',), 0.5000000000000001), (('1001011111',), 0.5000000000000001), (('1001100000',), 0.5000000000000001), (('1001100001',), 0.5000000000000001), (('1001100010',), 0.5000000000000001), (('1001100011',), 0.5000000000000001), (('1001100100',), 0.5000000000000001), (('1001100101',), 0.5000000000000001), (('1001100110',), 0.5000000000000001), (('1001100111',), 0.5000000000000001), (('1001101000',), 0.5000000000000001), (('1001101001',), 0.5000000000000001), (('1001101010',), 0.5000000000000001), (('1001101011',), 0.5000000000000001), (('1001101100',), 0.5000000000000001), (('1001101101',), 0.5000000000000001), (('1001101110',), 0.5000000000000001), (('1001101111',), 0.5000000000000001), (('1001110000',), 0.5000000000000001), (('1001110001',), 0.5000000000000001), (('1001110010',), 0.5000000000000001), (('1001110011',), 0.5000000000000001), (('1001110100',), 0.5000000000000001), (('1001110101',), 0.5000000000000001), (('1001110110',), 0.5000000000000001), (('1001110111',), 0.5000000000000001), (('1001111000',), 0.5000000000000001), (('1001111001',), 0.5000000000000001), (('1001111010',), 0.5000000000000001), (('1001111011',), 0.5000000000000001), (('1001111100',), 0.5000000000000001), (('1001111101',), 0.5000000000000001), (('1001111110',), 0.5000000000000001), (('1001111111',), 0.5000000000000001), (('1010000000',), 0.5000000000000001), (('1010000001',), 0.5000000000000001), (('1010000010',), 0.5000000000000001), (('1010000011',), 0.5000000000000001), (('1010000100',), 0.5000000000000001), (('1010000101',), 0.5000000000000001), (('1010000110',), 0.5000000000000001), (('1010000111',), 0.5000000000000001), (('1010001000',), 0.5000000000000001), (('1010001001',), 0.5000000000000001), (('1010001010',), 0.5000000000000001), (('1010001011',), 0.5000000000000001), (('1010001100',), 0.5000000000000001), (('1010001101',), 0.5000000000000001), (('1010001110',), 0.5000000000000001), (('1010001111',), 0.5000000000000001), (('1010010000',), 0.5000000000000001), (('1010010001',), 0.5000000000000001), (('1010010010',), 0.5000000000000001), (('1010010011',), 0.5000000000000001), (('1010010100',), 0.5000000000000001), (('1010010101',), 0.5000000000000001), (('1010010110',), 0.5000000000000001), (('1010010111',), 0.5000000000000001), (('1010011000',), 0.5000000000000001), (('1010011001',), 0.5000000000000001), (('1010011010',), 0.5000000000000001), (('1010011011',), 0.5000000000000001), (('1010011100',), 0.5000000000000001), (('1010011101',), 0.5000000000000001), (('1010011110',), 0.5000000000000001), (('1010011111',), 0.5000000000000001), (('1010100000',), 0.5000000000000001), (('1010100001',), 0.5000000000000001), (('1010100010',), 0.5000000000000001), (('1010100011',), 0.5000000000000001), (('1010100100',), 0.5000000000000001), (('1010100101',), 0.5000000000000001), (('1010100110',), 0.5000000000000001), (('1010100111',), 0.5000000000000001), (('1010101000',), 0.5000000000000001), (('1010101001',), 0.5000000000000001), (('1010101010',), 0.5000000000000001), (('1010101011',), 0.5000000000000001), (('1010101100',), 0.5000000000000001), (('1010101101',), 0.5000000000000001), (('1010101110',), 0.5000000000000001), (('1010101111',), 0.5000000000000001), (('1010110000',), 0.5000000000000001), (('1010110001',), 0.5000000000000001), (('1010110010',), 0.5000000000000001), (('1010110011',), 0.5000000000000001), (('1010110100',), 0.5000000000000001), (('1010110101',), 0.5000000000000001), (('1010110110',), 0.5000000000000001), (('1010110111',), 0.5000000000000001), (('1010111000',), 0.5000000000000001), (('1010111001',), 0.5000000000000001), (('1010111010',), 0.5000000000000001), (('1010111011',), 0.5000000000000001), (('1010111100',), 0.5000000000000001), (('1010111101',), 0.5000000000000001), (('1010111110',), 0.5000000000000001), (('1010111111',), 0.5000000000000001), (('1011000000',), 0.5000000000000001), (('1011000001',), 0.5000000000000001), (('1011000010',), 0.5000000000000001), (('1011000011',), 0.5000000000000001), (('1011000100',), 0.5000000000000001), (('1011000101',), 0.5000000000000001), (('1011000110',), 0.5000000000000001), (('1011000111',), 0.5000000000000001), (('1011001000',), 0.5000000000000001), (('1011001001',), 0.5000000000000001), (('1011001010',), 0.5000000000000001), (('1011001011',), 0.5000000000000001), (('1011001100',), 0.5000000000000001), (('1011001101',), 0.5000000000000001), (('1011001110',), 0.5000000000000001), (('1011001111',), 0.5000000000000001), (('1011010000',), 0.5000000000000001), (('1011010001',), 0.5000000000000001), (('1011010010',), 0.5000000000000001), (('1011010011',), 0.5000000000000001), (('1011010100',), 0.5000000000000001), (('1011010101',), 0.5000000000000001), (('1011010110',), 0.5000000000000001), (('1011010111',), 0.5000000000000001), (('1011011000',), 0.5000000000000001), (('1011011001',), 0.5000000000000001), (('1011011010',), 0.5000000000000001), (('1011011011',), 0.5000000000000001), (('1011011100',), 0.5000000000000001), (('1011011101',), 0.5000000000000001), (('1011011110',), 0.5000000000000001), (('1011011111',), 0.5000000000000001), (('1011100000',), 0.5000000000000001), (('1011100001',), 0.5000000000000001), (('1011100010',), 0.5000000000000001), (('1011100011',), 0.5000000000000001), (('1011100100',), 0.5000000000000001), (('1011100101',), 0.5000000000000001), (('1011100110',), 0.5000000000000001), (('1011100111',), 0.5000000000000001), (('1011101000',), 0.5000000000000001), (('1011101001',), 0.5000000000000001), (('1011101010',), 0.5000000000000001), (('1011101011',), 0.5000000000000001), (('1011101100',), 0.5000000000000001), (('1011101101',), 0.5000000000000001), (('1011101110',), 0.5000000000000001), (('1011101111',), 0.5000000000000001), (('1011110000',), 0.5000000000000001), (('1011110001',), 0.5000000000000001), (('1011110010',), 0.5000000000000001), (('1011110011',), 0.5000000000000001), (('1011110100',), 0.5000000000000001), (('1011110101',), 0.5000000000000001), (('1011110110',), 0.5000000000000001), (('1011110111',), 0.5000000000000001), (('1011111000',), 0.5000000000000001), (('1011111001',), 0.5000000000000001), (('1011111010',), 0.5000000000000001), (('1011111011',), 0.5000000000000001), (('1011111100',), 0.5000000000000001), (('1011111101',), 0.5000000000000001), (('1011111110',), 0.5000000000000001), (('1011111111',), 0.5000000000000001), (('1100000000',), -2.42861286636753e-17), (('1100000001',), -2.42861286636753e-17), (('1100000010',), -2.42861286636753e-17), (('1100000011',), -2.42861286636753e-17), (('1100000100',), -2.42861286636753e-17), (('1100000101',), -2.42861286636753e-17), (('1100000110',), -2.42861286636753e-17), (('1100000111',), -2.42861286636753e-17), (('1100001000',), -2.42861286636753e-17), (('1100001001',), -2.42861286636753e-17), (('1100001010',), -2.42861286636753e-17), (('1100001011',), -2.42861286636753e-17), (('1100001100',), -2.42861286636753e-17), (('1100001101',), -2.42861286636753e-17), (('1100001110',), -2.42861286636753e-17), (('1100001111',), -2.42861286636753e-17), (('1100010000',), -2.42861286636753e-17), (('1100010001',), -2.42861286636753e-17), (('1100010010',), -2.42861286636753e-17), (('1100010011',), -2.42861286636753e-17), (('1100010100',), -2.42861286636753e-17), (('1100010101',), -2.42861286636753e-17), (('1100010110',), -2.42861286636753e-17), (('1100010111',), -2.42861286636753e-17), (('1100011000',), -2.42861286636753e-17), (('1100011001',), -2.42861286636753e-17), (('1100011010',), -2.42861286636753e-17), (('1100011011',), -2.42861286636753e-17), (('1100011100',), -2.42861286636753e-17), (('1100011101',), -2.42861286636753e-17), (('1100011110',), -2.42861286636753e-17), (('1100011111',), -2.42861286636753e-17), (('1100100000',), -2.42861286636753e-17), (('1100100001',), -2.42861286636753e-17), (('1100100010',), -2.42861286636753e-17), (('1100100011',), -2.42861286636753e-17), (('1100100100',), -2.42861286636753e-17), (('1100100101',), -2.42861286636753e-17), (('1100100110',), -2.42861286636753e-17), (('1100100111',), -2.42861286636753e-17), (('1100101000',), -2.42861286636753e-17), (('1100101001',), -2.42861286636753e-17), (('1100101010',), -2.42861286636753e-17), (('1100101011',), -2.42861286636753e-17), (('1100101100',), -2.42861286636753e-17), (('1100101101',), -2.42861286636753e-17), (('1100101110',), -2.42861286636753e-17), (('1100101111',), -2.42861286636753e-17), (('1100110000',), -2.42861286636753e-17), (('1100110001',), -2.42861286636753e-17), (('1100110010',), -2.42861286636753e-17), (('1100110011',), -2.42861286636753e-17), (('1100110100',), -2.42861286636753e-17), (('1100110101',), -2.42861286636753e-17), (('1100110110',), -2.42861286636753e-17), (('1100110111',), -2.42861286636753e-17), (('1100111000',), -2.42861286636753e-17), (('1100111001',), -2.42861286636753e-17), (('1100111010',), -2.42861286636753e-17), (('1100111011',), -2.42861286636753e-17), (('1100111100',), -2.42861286636753e-17), (('1100111101',), -2.42861286636753e-17), (('1100111110',), -2.42861286636753e-17), (('1100111111',), -2.42861286636753e-17), (('1101000000',), -2.42861286636753e-17), (('1101000001',), -2.42861286636753e-17), (('1101000010',), -2.42861286636753e-17), (('1101000011',), -2.42861286636753e-17), (('1101000100',), -2.42861286636753e-17), (('1101000101',), -2.42861286636753e-17), (('1101000110',), -2.42861286636753e-17), (('1101000111',), -2.42861286636753e-17), (('1101001000',), -2.42861286636753e-17), (('1101001001',), -2.42861286636753e-17), (('1101001010',), -2.42861286636753e-17), (('1101001011',), -2.42861286636753e-17), (('1101001100',), -2.42861286636753e-17), (('1101001101',), -2.42861286636753e-17), (('1101001110',), -2.42861286636753e-17), (('1101001111',), -2.42861286636753e-17), (('1101010000',), -2.42861286636753e-17), (('1101010001',), -2.42861286636753e-17), (('1101010010',), -2.42861286636753e-17), (('1101010011',), -2.42861286636753e-17), (('1101010100',), -2.42861286636753e-17), (('1101010101',), -2.42861286636753e-17), (('1101010110',), -2.42861286636753e-17), (('1101010111',), -2.42861286636753e-17), (('1101011000',), -2.42861286636753e-17), (('1101011001',), -2.42861286636753e-17), (('1101011010',), -2.42861286636753e-17), (('1101011011',), -2.42861286636753e-17), (('1101011100',), -2.42861286636753e-17), (('1101011101',), -2.42861286636753e-17), (('1101011110',), -2.42861286636753e-17), (('1101011111',), -2.42861286636753e-17), (('1101100000',), -2.42861286636753e-17), (('1101100001',), -2.42861286636753e-17), (('1101100010',), -2.42861286636753e-17), (('1101100011',), -2.42861286636753e-17), (('1101100100',), -2.42861286636753e-17), (('1101100101',), -2.42861286636753e-17), (('1101100110',), -2.42861286636753e-17), (('1101100111',), -2.42861286636753e-17), (('1101101000',), -2.42861286636753e-17), (('1101101001',), -2.42861286636753e-17), (('1101101010',), -2.42861286636753e-17), (('1101101011',), -2.42861286636753e-17), (('1101101100',), -2.42861286636753e-17), (('1101101101',), -2.42861286636753e-17), (('1101101110',), -2.42861286636753e-17), (('1101101111',), -2.42861286636753e-17), (('1101110000',), -2.42861286636753e-17), (('1101110001',), -2.42861286636753e-17), (('1101110010',), -2.42861286636753e-17), (('1101110011',), -2.42861286636753e-17), (('1101110100',), -2.42861286636753e-17), (('1101110101',), -2.42861286636753e-17), (('1101110110',), -2.42861286636753e-17), (('1101110111',), -2.42861286636753e-17), (('1101111000',), -2.42861286636753e-17), (('1101111001',), -2.42861286636753e-17), (('1101111010',), -2.42861286636753e-17), (('1101111011',), -2.42861286636753e-17), (('1101111100',), -2.42861286636753e-17), (('1101111101',), -2.42861286636753e-17), (('1101111110',), -2.42861286636753e-17), (('1101111111',), -2.42861286636753e-17), (('1110000000',), -2.42861286636753e-17), (('1110000001',), -2.42861286636753e-17), (('1110000010',), -2.42861286636753e-17), (('1110000011',), -2.42861286636753e-17), (('1110000100',), -2.42861286636753e-17), (('1110000101',), -2.42861286636753e-17), (('1110000110',), -2.42861286636753e-17), (('1110000111',), -2.42861286636753e-17), (('1110001000',), -2.42861286636753e-17), (('1110001001',), -2.42861286636753e-17), (('1110001010',), -2.42861286636753e-17), (('1110001011',), -2.42861286636753e-17), (('1110001100',), -2.42861286636753e-17), (('1110001101',), -2.42861286636753e-17), (('1110001110',), -2.42861286636753e-17), (('1110001111',), -2.42861286636753e-17), (('1110010000',), -2.42861286636753e-17), (('1110010001',), -2.42861286636753e-17), (('1110010010',), -2.42861286636753e-17), (('1110010011',), -2.42861286636753e-17), (('1110010100',), -2.42861286636753e-17), (('1110010101',), -2.42861286636753e-17), (('1110010110',), -2.42861286636753e-17), (('1110010111',), -2.42861286636753e-17), (('1110011000',), -2.42861286636753e-17), (('1110011001',), -2.42861286636753e-17), (('1110011010',), -2.42861286636753e-17), (('1110011011',), -2.42861286636753e-17), (('1110011100',), -2.42861286636753e-17), (('1110011101',), -2.42861286636753e-17), (('1110011110',), -2.42861286636753e-17), (('1110011111',), -2.42861286636753e-17), (('1110100000',), -2.42861286636753e-17), (('1110100001',), -2.42861286636753e-17), (('1110100010',), -2.42861286636753e-17), (('1110100011',), -2.42861286636753e-17), (('1110100100',), -2.42861286636753e-17), (('1110100101',), -2.42861286636753e-17), (('1110100110',), -2.42861286636753e-17), (('1110100111',), -2.42861286636753e-17), (('1110101000',), -2.42861286636753e-17), (('1110101001',), -2.42861286636753e-17), (('1110101010',), -2.42861286636753e-17), (('1110101011',), -2.42861286636753e-17), (('1110101100',), -2.42861286636753e-17), (('1110101101',), -2.42861286636753e-17), (('1110101110',), -2.42861286636753e-17), (('1110101111',), -2.42861286636753e-17), (('1110110000',), -2.42861286636753e-17), (('1110110001',), -2.42861286636753e-17), (('1110110010',), -2.42861286636753e-17), (('1110110011',), -2.42861286636753e-17), (('1110110100',), -2.42861286636753e-17), (('1110110101',), -2.42861286636753e-17), (('1110110110',), -2.42861286636753e-17), (('1110110111',), -2.42861286636753e-17), (('1110111000',), -2.42861286636753e-17), (('1110111001',), -2.42861286636753e-17), (('1110111010',), -2.42861286636753e-17), (('1110111011',), -2.42861286636753e-17), (('1110111100',), -2.42861286636753e-17), (('1110111101',), -2.42861286636753e-17), (('1110111110',), -2.42861286636753e-17), (('1110111111',), -2.42861286636753e-17), (('1111000000',), -2.42861286636753e-17), (('1111000001',), -2.42861286636753e-17), (('1111000010',), -2.42861286636753e-17), (('1111000011',), -2.42861286636753e-17), (('1111000100',), -2.42861286636753e-17), (('1111000101',), -2.42861286636753e-17), (('1111000110',), -2.42861286636753e-17), (('1111000111',), -2.42861286636753e-17), (('1111001000',), -2.42861286636753e-17), (('1111001001',), -2.42861286636753e-17), (('1111001010',), -2.42861286636753e-17), (('1111001011',), -2.42861286636753e-17), (('1111001100',), -2.42861286636753e-17), (('1111001101',), -2.42861286636753e-17), (('1111001110',), -2.42861286636753e-17), (('1111001111',), -2.42861286636753e-17), (('1111010000',), -2.42861286636753e-17), (('1111010001',), -2.42861286636753e-17), (('1111010010',), -2.42861286636753e-17), (('1111010011',), -2.42861286636753e-17), (('1111010100',), -2.42861286636753e-17), (('1111010101',), -2.42861286636753e-17), (('1111010110',), -2.42861286636753e-17), (('1111010111',), -2.42861286636753e-17), (('1111011000',), -2.42861286636753e-17), (('1111011001',), -2.42861286636753e-17), (('1111011010',), -2.42861286636753e-17), (('1111011011',), -2.42861286636753e-17), (('1111011100',), -2.42861286636753e-17), (('1111011101',), -2.42861286636753e-17), (('1111011110',), -2.42861286636753e-17), (('1111011111',), -2.42861286636753e-17), (('1111100000',), -2.42861286636753e-17), (('1111100001',), -2.42861286636753e-17), (('1111100010',), -2.42861286636753e-17), (('1111100011',), -2.42861286636753e-17), (('1111100100',), -2.42861286636753e-17), (('1111100101',), -2.42861286636753e-17), (('1111100110',), -2.42861286636753e-17), (('1111100111',), -2.42861286636753e-17), (('1111101000',), -2.42861286636753e-17), (('1111101001',), -2.42861286636753e-17), (('1111101010',), -2.42861286636753e-17), (('1111101011',), -2.42861286636753e-17), (('1111101100',), -2.42861286636753e-17), (('1111101101',), -2.42861286636753e-17), (('1111101110',), -2.42861286636753e-17), (('1111101111',), -2.42861286636753e-17), (('1111110000',), -2.42861286636753e-17), (('1111110001',), -2.42861286636753e-17), (('1111110010',), -2.42861286636753e-17), (('1111110011',), -2.42861286636753e-17), (('1111110100',), -2.42861286636753e-17), (('1111110101',), -2.42861286636753e-17), (('1111110110',), -2.42861286636753e-17), (('1111110111',), -2.42861286636753e-17), (('1111111000',), -2.42861286636753e-17), (('1111111001',), -2.42861286636753e-17), (('1111111010',), -2.42861286636753e-17), (('1111111011',), -2.42861286636753e-17), (('1111111100',), -2.42861286636753e-17), (('1111111101',), -2.42861286636753e-17), (('1111111110',), -2.42861286636753e-17), (('1111111111',), -2.42861286636753e-17)])\n", "CPU times: user 1min 4s, sys: 3.74 s, total: 1min 8s\n", "Wall time: 1min 8s\n" ] } ], "source": [ "# test circuit simulation\n", "circuit = pygsti.obj.Circuit(gatestring=( ('Gh',1),('Gp',2),('Gcnot',1,2),('Gt',3) ), num_lines=n)\n", "%time print(BGS.probs(circuit))\n", "# ~1 min for 10Q" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Processor Specs" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/enielse/research/pyGSTi/packages/pygsti/construction/gatesetconstruction.py:1142: UserWarning:\n", "\n", "Failed to create clifford gate Gt. Dropping it.\n", "\n" ] } ], "source": [ "gllist = ['Gi', 'Gh','Gp','Gcnot','Gt']\n", "ps = pygsti.obj.ProcessorSpec(nQubits=n, gate_names=gllist,\n", " nonstd_gate_unitaries=unitaries,\n", " availability=availability, verbosity=0)\n", " # automatically creates 'clifford' and 'target' models and std compilations\n", " \n", "# To manually add another model, for example one w/density matrix simulation:\n", "ps.models['dmsim'] = pygsti.construction.build_nqubit_standard_gateset(\n", " n, gllist, unitaries, availability, parameterization=\"static\", sim_type=\"dmmap\")\n", "# OR, more conveniently\n", "ps.add_std_model('dmsim', parameterization=\"static\", sim_type=\"dmmap\")" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#Check out clifford gate on subsets of qubits (used in RB calcs)\n", "#ps.clifford_gates_on_qubits" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Embedded gate map with full dimension 1048576 and state space (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)\n", " that embeds the following 4-dimensional gate into acting on the (1, 2) space\n", "Static gate with shape (4, 4)\n", " 1.00 0 0 0\n", " 0 1.00 0 0\n", " 0 0 0 1.00\n", " 0 0 1.00 0\n", "\n", "Embedded gate map with full dimension 1024 and state space (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)\n", " that embeds the following 4-dimensional gate into acting on the (1, 2) space\n", "Static gate with shape (4, 4)\n", " 1.00 0 0 0\n", " 0 1.00 0 0\n", " 0 0 1.00 0\n", " 0 0 0 1.00\n", "\n" ] } ], "source": [ "#ps.add_std_model('test', parameterization=\"static\", sim_type=\"svmap\")\n", "gs = ps.models['target'].copy()\n", "#print(list(gs.gates.keys()))\n", "print(gs[('Gcnot',1,2)])\n", "gs[('Gcnot',1,2)] = np.identity(4,'complex')\n", "#NOTE: pygsti.tools.unitary_to_process_mx # unitary to paulimx\n", "print(gs[('Gcnot',1,2)])" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[1 0 0 0]\n", " [1 1 0 0]\n", " [0 0 1 1]\n", " [0 0 0 1]]\n" ] } ], "source": [ "#See where symplectic reps are stored (could also extract via gs.get_clifford_symplectic_reps() )\n", "gs = ps.models['clifford']\n", "print(gs[('Gcnot',0,1)].embedded_gate.smatrix) # each gate has it's own symplectic rep\n", "assert(gs[('Gcnot',1,2)].embedded_gate is gs[('Gcnot',0,1)].embedded_gate) # different CNOT's share same \"root\"" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 3.55 s, sys: 13.3 ms, total: 3.57 s\n", "Wall time: 3.58 s\n", "CPU times: user 3.77 s, sys: 11.1 ms, total: 3.78 s\n", "Wall time: 3.79 s\n", "3016\n", "1536\n" ] } ], "source": [ "# Let's pick a random Clifford, and the inverse of that Clifford, and create an identity circuit\n", "s, p = pygsti.tools.random_clifford(n)\n", "sin, pin = pygsti.tools.inverse_clifford(s,p)\n", "\n", "%time c = pygsti.alg.compile_clifford(s, p, pspec=ps)\n", "%time c.append_circuit(pygsti.alg.compile_clifford(sin, pin, pspec=ps))\n", "# ~3.5min each for 8Q, ~14min each for 10Q\n", "\n", "print(len(c)) # 1389 for 8Q, 3057 for 10Q\n", "print(c.depth()) # 1529 for 10Q" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 48.6 s, sys: 221 ms, total: 48.8 s\n", "Wall time: 49 s\n", "0.999999999999694\n", "1022.9999999996734\n" ] } ], "source": [ "# As we can see, the output is (0,0,0,0) with probability 1. (when no input is given to the simulators, the input\n", "# is taken to be (0,0,0,0)).\n", "#%load_ext line_profiler\n", "\n", "%time simout = c.simulate(ps.models['target'])\n", "# ~ 3.5s for 8Q, 47s fo 10Q\n", "\n", "print(simout['0'*n])\n", "x = 0\n", "for key in list(simout.keys()):\n", " x += simout[key]\n", "x = x - simout['0'*n]\n", "print(x)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "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.5.2" } }, "nbformat": 4, "nbformat_minor": 2 }