Skip to content

Commit

Permalink
update Official Converter notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
minwook-shin committed Nov 9, 2023
1 parent 0b6a2f0 commit 70aeb20
Showing 1 changed file with 54 additions and 52 deletions.
106 changes: 54 additions & 52 deletions qiskit_classroom_converter_public_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
"metadata": {
"id": "fdwkFKE4uA6-",
"ExecuteTime": {
"end_time": "2023-08-26T10:12:55.045704Z",
"start_time": "2023-08-26T10:12:54.993615Z"
"end_time": "2023-11-09T03:14:35.624594Z",
"start_time": "2023-11-09T03:14:35.571149Z"
}
},
"execution_count": 3,
"execution_count": 27,
"outputs": []
},
{
Expand All @@ -72,17 +72,17 @@
"id": "ZumlvyliaonW",
"outputId": "65a73f02-8c38-4458-f89d-60fb809f7e13",
"ExecuteTime": {
"end_time": "2023-08-26T10:12:55.046990Z",
"start_time": "2023-08-26T10:12:55.001830Z"
"end_time": "2023-11-09T03:14:35.683250Z",
"start_time": "2023-11-09T03:14:35.583889Z"
}
},
"execution_count": 4,
"execution_count": 28,
"outputs": [
{
"data": {
"text/plain": "{'Qiskit': '0.44.1', 'Lib': '0.2.0.dev0'}"
"text/plain": "{'Qiskit': '0.44.2', 'Lib': '0.4.1'}"
},
"execution_count": 4,
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -123,18 +123,18 @@
"id": "VYy7W6ykuTOa",
"outputId": "a5cc4ab4-1743-4589-e183-5de2f63718b5",
"ExecuteTime": {
"end_time": "2023-08-26T10:12:55.113990Z",
"start_time": "2023-08-26T10:12:55.014413Z"
"end_time": "2023-11-09T03:14:35.726529Z",
"start_time": "2023-11-09T03:14:35.595187Z"
}
},
"execution_count": 5,
"execution_count": 29,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001B[32m2023-08-26 19:12:55.011\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.matrix_to_quantum_circuit\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m34\u001B[0m - \u001B[34m\u001B[1mmatrix to quantum circuit\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.049\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m15\u001B[0m - \u001B[1m\n",
"\u001B[32m2023-11-09 12:14:35.592\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.matrix_to_quantum_circuit\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m34\u001B[0m - \u001B[34m\u001B[1mmatrix to quantum circuit\u001B[0m\n",
"\u001B[32m2023-11-09 12:14:35.603\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m15\u001B[0m - \u001B[1m\n",
" ┌───┐┌──────────┐┌─┐ \n",
"q_0: ┤ X ├┤0 ├┤M├───\n",
" └───┘│ CX gate │└╥┘┌─┐\n",
Expand Down Expand Up @@ -175,35 +175,35 @@
"id": "Kq20Y6hQu8v7",
"outputId": "8fdc3160-c8b6-4318-f995-8508b6e61ba5",
"ExecuteTime": {
"end_time": "2023-08-26T10:12:55.116443Z",
"start_time": "2023-08-26T10:12:55.060093Z"
"end_time": "2023-11-09T03:14:35.729793Z",
"start_time": "2023-11-09T03:14:35.616719Z"
}
},
"execution_count": 6,
"execution_count": 30,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001B[32m2023-08-26 19:12:55.056\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.quantum_circuit_to_matrix\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m35\u001B[0m - \u001B[34m\u001B[1mquantum circuit to matrix\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.062\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m7\u001B[0m - \u001B[1m\n",
"\u001B[32m2023-11-09 12:14:35.614\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.quantum_circuit_to_matrix\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m51\u001B[0m - \u001B[34m\u001B[1mquantum circuit to matrix\u001B[0m\n",
"\u001B[32m2023-11-09 12:14:35.619\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m7\u001B[0m - \u001B[1m\n",
"[[0 1 0 0]\n",
" [1 0 0 0]\n",
" [0 0 0 1]\n",
" [0 0 1 0]]\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.063\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m7\u001B[0m - \u001B[1m\n",
"\u001B[32m2023-11-09 12:14:35.620\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m7\u001B[0m - \u001B[1m\n",
"[[1 0 0 0]\n",
" [0 0 0 1]\n",
" [0 0 1 0]\n",
" [0 1 0 0]]\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.064\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m8\u001B[0m - \u001B[1mlist: ['x', 'cx']\u001B[0m\n"
"\u001B[32m2023-11-09 12:14:35.622\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m8\u001B[0m - \u001B[1mlist: [(0, ['I_{q1}', 'X_{q0}']), (1, ['CX_{q0, q1}'])]\u001B[0m\n"
]
},
{
"data": {
"text/plain": "array([[0, 1, 0, 0],\n [0, 0, 1, 0],\n [0, 0, 0, 1],\n [1, 0, 0, 0]])"
},
"execution_count": 6,
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -242,18 +242,18 @@
"id": "VassyxSGTkAf",
"outputId": "e083dd84-0cd9-4210-c732-d3c8957ce04d",
"ExecuteTime": {
"end_time": "2023-08-26T10:12:55.118501Z",
"start_time": "2023-08-26T10:12:55.075894Z"
"end_time": "2023-11-09T03:14:35.742945Z",
"start_time": "2023-11-09T03:14:35.636507Z"
}
},
"execution_count": 7,
"execution_count": 31,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001B[32m2023-08-26 19:12:55.072\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.quantum_circuit_to_matrix\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m35\u001B[0m - \u001B[34m\u001B[1mquantum circuit to matrix\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.097\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m8\u001B[0m - \u001B[1m\n",
"\u001B[32m2023-11-09 12:14:35.637\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.quantum_circuit_to_matrix\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m51\u001B[0m - \u001B[34m\u001B[1mquantum circuit to matrix\u001B[0m\n",
"\u001B[32m2023-11-09 12:14:35.671\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m8\u001B[0m - \u001B[1m\n",
"\n",
"\\begin{bmatrix}\n",
"0 & 1 & 0 & 0 \\\\\n",
Expand All @@ -262,7 +262,7 @@
" 0 & 0 & 1 & 0 \\\\\n",
" \\end{bmatrix}\n",
"\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.098\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m8\u001B[0m - \u001B[1m\n",
"\u001B[32m2023-11-09 12:14:35.672\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m8\u001B[0m - \u001B[1m\n",
"\n",
"\\begin{bmatrix}\n",
"1 & 0 & 0 & 0 \\\\\n",
Expand All @@ -271,7 +271,7 @@
" 0 & 1 & 0 & 0 \\\\\n",
" \\end{bmatrix}\n",
"\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.099\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m10\u001B[0m - \u001B[1m\n",
"\u001B[32m2023-11-09 12:14:35.672\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m10\u001B[0m - \u001B[1m\n",
"\n",
"\\begin{bmatrix}\n",
"0 & 1 & 0 & 0 \\\\\n",
Expand All @@ -287,7 +287,7 @@
"text/plain": "<IPython.core.display.Latex object>",
"text/latex": "\n\n\\begin{bmatrix}\n0 & 1 & 0 & 0 \\\\\n 0 & 0 & 1 & 0 \\\\\n 0 & 0 & 0 & 1 \\\\\n 1 & 0 & 0 & 0 \\\\\n \\end{bmatrix}\n"
},
"execution_count": 7,
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -321,24 +321,24 @@
"id": "w9sh7KQyvgEO",
"outputId": "de7a47db-8ea1-46fa-a1cf-bca178027fac",
"ExecuteTime": {
"end_time": "2023-08-26T10:12:55.393863Z",
"start_time": "2023-08-26T10:12:55.112477Z"
"end_time": "2023-11-09T03:14:35.860066Z",
"start_time": "2023-11-09T03:14:35.686224Z"
}
},
"execution_count": 8,
"execution_count": 32,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001B[32m2023-08-26 19:12:55.112\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.quantum_circuit_to_braket_notation\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m37\u001B[0m - \u001B[34m\u001B[1mquantum circuit to bra-ket notation\u001B[0m\n"
"\u001B[32m2023-11-09 12:14:35.684\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.quantum_circuit_to_braket_notation\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m37\u001B[0m - \u001B[34m\u001B[1mquantum circuit to bra-ket notation\u001B[0m\n"
]
},
{
"data": {
"text/plain": "'(sqrt(2)/2)*|0> + (sqrt(2)/2)*|11>'"
},
"execution_count": 8,
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -375,26 +375,26 @@
"id": "H5nlXMyAUxEt",
"outputId": "5a593d26-4b8c-41a3-bddd-b4df282b82e3",
"ExecuteTime": {
"end_time": "2023-08-26T10:12:55.440633Z",
"start_time": "2023-08-26T10:12:55.398432Z"
"end_time": "2023-11-09T03:14:35.863484Z",
"start_time": "2023-11-09T03:14:35.742638Z"
}
},
"execution_count": 9,
"execution_count": 33,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001B[32m2023-08-26 19:12:55.394\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.quantum_circuit_to_braket_notation\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m37\u001B[0m - \u001B[34m\u001B[1mquantum circuit to bra-ket notation\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.409\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m8\u001B[0m - \u001B[1m\\frac{\\sqrt{2}}{2} |00\\rangle+\\frac{\\sqrt{2}}{2} |11\\rangle\u001B[0m\n"
"\u001B[32m2023-11-09 12:14:35.743\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.quantum_circuit_to_braket_notation\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m37\u001B[0m - \u001B[34m\u001B[1mquantum circuit to bra-ket notation\u001B[0m\n",
"\u001B[32m2023-11-09 12:14:35.758\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m8\u001B[0m - \u001B[1m\\frac{\\sqrt{2}}{2} |00\\rangle+\\frac{\\sqrt{2}}{2} |11\\rangle\u001B[0m\n"
]
},
{
"data": {
"text/plain": "<IPython.core.display.Math object>",
"text/latex": "$\\displaystyle \\frac{\\sqrt{2}}{2} |00\\rangle+\\frac{\\sqrt{2}}{2} |11\\rangle$"
},
"execution_count": 9,
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -414,7 +414,8 @@
"source": [
"sample_converter = ConversionService(conversion_type=\"STR_TO_BRA_KET\")\n",
"result = sample_converter.convert(input_value=\"sqrt(2)*|00>/2+sqrt(2)*|11>/2\")\n",
"logger.info(result)"
"logger.info(result)\n",
"logger.info(type(result))"
],
"metadata": {
"colab": {
Expand All @@ -423,18 +424,19 @@
"id": "r3VTttrnv7J4",
"outputId": "ae7014f2-8c32-4fe2-d632-4665b79ac973",
"ExecuteTime": {
"end_time": "2023-08-26T10:12:55.441323Z",
"start_time": "2023-08-26T10:12:55.420999Z"
"end_time": "2023-11-09T03:14:35.876478Z",
"start_time": "2023-11-09T03:14:35.773414Z"
}
},
"execution_count": 10,
"execution_count": 34,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001B[32m2023-08-26 19:12:55.417\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.string_to_braket_notation\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m120\u001B[0m - \u001B[34m\u001B[1mString to bra-ket notation\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.422\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m3\u001B[0m - \u001B[1msqrt(2)*|00>/2 + sqrt(2)*|11>/2\u001B[0m\n"
"\u001B[32m2023-11-09 12:14:35.771\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.string_to_braket_notation\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m120\u001B[0m - \u001B[34m\u001B[1mString to bra-ket notation\u001B[0m\n",
"\u001B[32m2023-11-09 12:14:35.775\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m3\u001B[0m - \u001B[1msqrt(2)*|00>/2 + sqrt(2)*|11>/2\u001B[0m\n",
"\u001B[32m2023-11-09 12:14:35.779\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m4\u001B[0m - \u001B[1m<class 'sympy.core.add.Add'>\u001B[0m\n"
]
}
]
Expand Down Expand Up @@ -466,26 +468,26 @@
"id": "6vNNhP67U_vA",
"outputId": "ada16afd-9730-4496-93cc-ba625ca6c045",
"ExecuteTime": {
"end_time": "2023-08-26T10:12:55.446534Z",
"start_time": "2023-08-26T10:12:55.434570Z"
"end_time": "2023-11-09T03:14:35.878182Z",
"start_time": "2023-11-09T03:14:35.788021Z"
}
},
"execution_count": 11,
"execution_count": 35,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001B[32m2023-08-26 19:12:55.431\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.string_to_braket_notation\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m120\u001B[0m - \u001B[34m\u001B[1mString to bra-ket notation\u001B[0m\n",
"\u001B[32m2023-08-26 19:12:55.436\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m4\u001B[0m - \u001B[1m\\frac{\\sqrt{2} {\\left|00\\right\\rangle }}{2} + \\frac{\\sqrt{2} {\\left|11\\right\\rangle }}{2}\u001B[0m\n"
"\u001B[32m2023-11-09 12:14:35.787\u001B[0m | \u001B[34m\u001B[1mDEBUG \u001B[0m | \u001B[36mqiskit_class_converter.converters.string_to_braket_notation\u001B[0m:\u001B[36mactual_convert_action\u001B[0m:\u001B[36m120\u001B[0m - \u001B[34m\u001B[1mString to bra-ket notation\u001B[0m\n",
"\u001B[32m2023-11-09 12:14:35.792\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m4\u001B[0m - \u001B[1m\\frac{\\sqrt{2} {\\left|00\\right\\rangle }}{2} + \\frac{\\sqrt{2} {\\left|11\\right\\rangle }}{2}\u001B[0m\n"
]
},
{
"data": {
"text/plain": "<IPython.core.display.Math object>",
"text/latex": "$\\displaystyle \\frac{\\sqrt{2} {\\left|00\\right\\rangle }}{2} + \\frac{\\sqrt{2} {\\left|11\\right\\rangle }}{2}$"
},
"execution_count": 11,
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit 70aeb20

Please sign in to comment.