{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# PyOR Quantum\n", "## Author: Vineeth Thalakottoor\n", "## Introduction to Bloch vector" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Define the source path\n", "SourcePath = '/media/HD2/Vineeth/PostDoc_Simulations/Github/PyOR_V1/PyOR_Combined/PyOR/Source_Doc'\n", "\n", "# Add source path\n", "import sys\n", "sys.path.append(SourcePath)\n", "\n", "# Import PyOR package\n", "from PyOR_QuantumLibrary import QuantumLibrary\n", "QLib = QuantumLibrary()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1.0\\\\0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[1.0],\n", "[ 0]])" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Bloch Vector:\n", "vec1 = QLib.Bloch_Vector(theta = 0.0, phi = 0.0)\n", "vec1.matrix" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}6.12323399573677 \\cdot 10^{-17}\\\\1.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[6.12323399573677e-17],\n", "[ 1.0]])" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Bloch Vector:\n", "vec2 = QLib.Bloch_Vector(theta = 180.0, phi = 0.0)\n", "vec2.matrix" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0.707106781186548\\\\0.707106781186547\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[0.707106781186548],\n", "[0.707106781186547]])" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Bloch Vector:\n", "vec3 = QLib.Bloch_Vector(theta = 90.0, phi = 0.0)\n", "vec3.matrix" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0.707106781186548\\\\-0.707106781186547 + 8.65956056235493 \\cdot 10^{-17} i\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0.707106781186548],\n", "[-0.707106781186547 + 8.65956056235493e-17*I]])" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Bloch Vector:\n", "vec4 = QLib.Bloch_Vector(theta = 90.0, phi = 180.0)\n", "vec4.matrix" ] } ], "metadata": { "kernelspec": { "display_name": "base", "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.12.7" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }