qonic-misc


Nameqonic-misc JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/Qonic-Team/qonic-misc.git
SummaryPython library with miscellaneous tools to be used in conjunction with the qonic framework
upload_time2024-05-24 20:03:43
maintainerNone
docs_urlNone
authorcogrpar
requires_pythonNone
licenseApache License 2.0
keywords qonic qonic_misc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Python application](https://github.com/Qonic-Team/qonic-misc/actions/workflows/python-app.yml/badge.svg)](https://github.com/Qonic-Team/qonic-misc/actions/workflows/python-app.yml)
[![CodeQL](https://github.com/Qonic-Team/qonic-misc/actions/workflows/codeql.yml/badge.svg)](https://github.com/Qonic-Team/qonic-misc/actions/workflows/codeql.yml)
<sup>[`Snyk Vulnerability Report`](https://snyk.io/test/github/Qonic-Team/qonic-misc?targetFile=source_dir/requirements.txt)</sup>

## qonic-misc Python Library:
Python library with miscellaneous tools to be used in conjunction with the qonic framework

**To install:** `pip3 install qonic_misc`

**Includes:**  
  * `qonic_misc.RotationConversions`: 
    * `operator_to_updated_state(operator, theta_init, phi_init)`
    
        **Description:**
        * this function takes a quantum operator (corresponding to a qbit gate), and the initial qbit state defined by the angles theta and phi
        * theta and phi define the state based on some point on the bloch sphere in spherical coordinates
        * the statevector of the qbit is defined as [*cos(theta/2)*, *sin(theta/2) e^(i phi)*]
        * the function returns the state after being acted on by the gate (in terms of the new theta and phi values)

        **Parameters:**
        * `operator <type 'list'>`: linear, hermitian matrix representing the quantum operator
        * `theta_init <type 'float'>`: initial value for the theta component of the quantum state (must be between 0.0 and pi/2)
        * `phi_init <type 'float'>`: initial value for the phi component of the quantum state (must be between 0.0 and pi/2)

        **Returns:**
        * `[theta_updated, phi_updated] <type 'list'>`: list storing the updated values for theta and phi after being operated on by 'operator'

        **Example:**
        
            
            >>> rc = qonic_misc.RotationConversions()
            >>> pauli_z = [[1, 0], [0, -1]] # pauli z gate
            >>> print(rc.operator_to_updated_state(pauli_z, 1, 1)) # operate on the initial state of ['theta': 1, 'phi': 1]
            [-1.0, 1.0]
            
            
            
    * `operator_to_rotation(operator, print_optimization_loss=False, epochs=300, num_of_vectors=3)`
        **Description:**
        * this function takes a quantum operator (corresponding to a qbit gate)
        * the function uses tensorflow to find the spacial rotations along the x, y, and z axes of the bloch sphere that corresponds to the operator acting on a qbit state state

        **Parameters:**
        * `operator <type 'list'>`: linear, hermitian matrix representing the quantum operator
        * `print_optimization_loss=False <type 'bool'>`: boolean value that determines if the function will print out the loss of the tf model as it optimizes to find the spacial rotations
        * `epochs=300 <type: 'int'>`: number of epochs that the tf model will optimize for
        * `num_of_vectors=3 <type 'int'>`: number of quantum statevectors that the tf model will optimize for (higher means more accurate but slower, lower means less accurate but faster)

        **Returns:**
        * `[RotX, RotY, RotZ] <type 'list'>`: list storing the spacial rotations along each axis corresponding to the passed operator

        **Example:**
        
            
            >>> rc = qonic_misc.RotationConversions()
            >>> pauli_z = [[1, 0], [0, -1]] # pauli z gate
            >>> print(rc.operator_to_rotation(pauli_z)) # solve for the spacial rotation of the pauli z gate
            [0.0, 0.0, 3.14159]
            
            
            
  * `qonic_misc.OperatorChecker`: tool for evaluating operators
    * `check_hermitian(operator)`

        **Description:**
        * this function takes a 2 by 2 operator matrix and checks to see if it is hermitian (equal to its transposed conjugate)
        * this is useful because all qbit operators corresponding to quantum logic gates must be hermitian
    
        **Parameters:**
        * `operator <type 'list'>`: matrix representing the quantum operator
            
        **Returns:**
        * `hermitian <type 'bool'>`: boolean value storing if the passed matrix is hermitian
     
        **Example:**
        
            >>> oc = qonic_misc.OperatorChecker
            >>> pauli_z = [[1, 0], [0, -1]] # pauli z gate
            >>> print(oc.check_hermitian(pauli_z)) # check to see if the pauli z gate is hermitian
            True



    * `check_unitary(operator)`
        
        **Description:**
        * this function takes a 2 by 2 operator matrix and checks to see if it is unitary (produces the identity matrix when multiplied by its transposed conjugate)
        * this is useful because all qbit operators corresponding to quantum logic gates must be unitary
        
        **Parameters:**
        * `operator <type 'list'>`: matrix representing the quantum operator
            
        **Returns:**
        * `unitary <type 'bool'>`: boolean value storing if the passed matrix is unitary
        
        **Example:**
        
            >>> oc = qonic_misc.OperatorChecker
            >>> pauli_z = [[1, 0], [0, -1]] # pauli z gate
            >>> print(oc.check_unitary(pauli_z) # check to see if the pauli z gate is unitary
            True

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Qonic-Team/qonic-misc.git",
    "name": "qonic-misc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "qonic, qonic_misc",
    "author": "cogrpar",
    "author_email": "owen.r.welsh@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/90/58/76baf8799e2a95c878ea638122a5dd1c143c74555d74e834717314f2d0f6/qonic_misc-0.1.6.tar.gz",
    "platform": null,
    "description": "[![Python application](https://github.com/Qonic-Team/qonic-misc/actions/workflows/python-app.yml/badge.svg)](https://github.com/Qonic-Team/qonic-misc/actions/workflows/python-app.yml)\n[![CodeQL](https://github.com/Qonic-Team/qonic-misc/actions/workflows/codeql.yml/badge.svg)](https://github.com/Qonic-Team/qonic-misc/actions/workflows/codeql.yml)\n<sup>[`Snyk Vulnerability Report`](https://snyk.io/test/github/Qonic-Team/qonic-misc?targetFile=source_dir/requirements.txt)</sup>\n\n## qonic-misc Python Library:\nPython library with miscellaneous tools to be used in conjunction with the qonic framework\n\n**To install:** `pip3 install qonic_misc`\n\n**Includes:**  \n  * `qonic_misc.RotationConversions`: \n    * `operator_to_updated_state(operator, theta_init, phi_init)`\n    \n        **Description:**\n        * this function takes a quantum operator (corresponding to a qbit gate), and the initial qbit state defined by the angles theta and phi\n        * theta and phi define the state based on some point on the bloch sphere in spherical coordinates\n        * the statevector of the qbit is defined as [*cos(theta/2)*, *sin(theta/2) e^(i phi)*]\n        * the function returns the state after being acted on by the gate (in terms of the new theta and phi values)\n\n        **Parameters:**\n        * `operator <type 'list'>`: linear, hermitian matrix representing the quantum operator\n        * `theta_init <type 'float'>`: initial value for the theta component of the quantum state (must be between 0.0 and pi/2)\n        * `phi_init <type 'float'>`: initial value for the phi component of the quantum state (must be between 0.0 and pi/2)\n\n        **Returns:**\n        * `[theta_updated, phi_updated] <type 'list'>`: list storing the updated values for theta and phi after being operated on by 'operator'\n\n        **Example:**\n        \n            \n            >>> rc = qonic_misc.RotationConversions()\n            >>> pauli_z = [[1, 0], [0, -1]] # pauli z gate\n            >>> print(rc.operator_to_updated_state(pauli_z, 1, 1)) # operate on the initial state of ['theta': 1, 'phi': 1]\n            [-1.0, 1.0]\n            \n            \n            \n    * `operator_to_rotation(operator, print_optimization_loss=False, epochs=300, num_of_vectors=3)`\n        **Description:**\n        * this function takes a quantum operator (corresponding to a qbit gate)\n        * the function uses tensorflow to find the spacial rotations along the x, y, and z axes of the bloch sphere that corresponds to the operator acting on a qbit state state\n\n        **Parameters:**\n        * `operator <type 'list'>`: linear, hermitian matrix representing the quantum operator\n        * `print_optimization_loss=False <type 'bool'>`: boolean value that determines if the function will print out the loss of the tf model as it optimizes to find the spacial rotations\n        * `epochs=300 <type: 'int'>`: number of epochs that the tf model will optimize for\n        * `num_of_vectors=3 <type 'int'>`: number of quantum statevectors that the tf model will optimize for (higher means more accurate but slower, lower means less accurate but faster)\n\n        **Returns:**\n        * `[RotX, RotY, RotZ] <type 'list'>`: list storing the spacial rotations along each axis corresponding to the passed operator\n\n        **Example:**\n        \n            \n            >>> rc = qonic_misc.RotationConversions()\n            >>> pauli_z = [[1, 0], [0, -1]] # pauli z gate\n            >>> print(rc.operator_to_rotation(pauli_z)) # solve for the spacial rotation of the pauli z gate\n            [0.0, 0.0, 3.14159]\n            \n            \n            \n  * `qonic_misc.OperatorChecker`: tool for evaluating operators\n    * `check_hermitian(operator)`\n\n        **Description:**\n        * this function takes a 2 by 2 operator matrix and checks to see if it is hermitian (equal to its transposed conjugate)\n        * this is useful because all qbit operators corresponding to quantum logic gates must be hermitian\n    \n        **Parameters:**\n        * `operator <type 'list'>`: matrix representing the quantum operator\n            \n        **Returns:**\n        * `hermitian <type 'bool'>`: boolean value storing if the passed matrix is hermitian\n     \n        **Example:**\n        \n            >>> oc = qonic_misc.OperatorChecker\n            >>> pauli_z = [[1, 0], [0, -1]] # pauli z gate\n            >>> print(oc.check_hermitian(pauli_z)) # check to see if the pauli z gate is hermitian\n            True\n\n\n\n    * `check_unitary(operator)`\n        \n        **Description:**\n        * this function takes a 2 by 2 operator matrix and checks to see if it is unitary (produces the identity matrix when multiplied by its transposed conjugate)\n        * this is useful because all qbit operators corresponding to quantum logic gates must be unitary\n        \n        **Parameters:**\n        * `operator <type 'list'>`: matrix representing the quantum operator\n            \n        **Returns:**\n        * `unitary <type 'bool'>`: boolean value storing if the passed matrix is unitary\n        \n        **Example:**\n        \n            >>> oc = qonic_misc.OperatorChecker\n            >>> pauli_z = [[1, 0], [0, -1]] # pauli z gate\n            >>> print(oc.check_unitary(pauli_z) # check to see if the pauli z gate is unitary\n            True\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Python library with miscellaneous tools to be used in conjunction with the qonic framework",
    "version": "0.1.6",
    "project_urls": {
        "Download": "https://github.com/Qonic-Team/qonic-misc/archive/refs/heads/main.zip",
        "Homepage": "https://github.com/Qonic-Team/qonic-misc.git"
    },
    "split_keywords": [
        "qonic",
        " qonic_misc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f5af3661161eb72bf64d6f940eef3de291b54c95756669e0c8fc0eb5e815629",
                "md5": "a9e518e6d3bcb559d0d7cd769017ef02",
                "sha256": "a009b3b52d17febd2ba3d37dc48f3210b2e7e31a7cf0fddb79354e78d1366694"
            },
            "downloads": -1,
            "filename": "qonic_misc-0.1.6-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a9e518e6d3bcb559d0d7cd769017ef02",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 7252,
            "upload_time": "2024-05-24T20:03:42",
            "upload_time_iso_8601": "2024-05-24T20:03:42.195787Z",
            "url": "https://files.pythonhosted.org/packages/8f/5a/f3661161eb72bf64d6f940eef3de291b54c95756669e0c8fc0eb5e815629/qonic_misc-0.1.6-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "905876baf8799e2a95c878ea638122a5dd1c143c74555d74e834717314f2d0f6",
                "md5": "a4eef9801a5487e2d516a88e8dac7c27",
                "sha256": "7d78de28b9b68f661e6a7bf4d5c825bfdacefa2292fb98c2b7f7cf5925a9c13b"
            },
            "downloads": -1,
            "filename": "qonic_misc-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "a4eef9801a5487e2d516a88e8dac7c27",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6134,
            "upload_time": "2024-05-24T20:03:43",
            "upload_time_iso_8601": "2024-05-24T20:03:43.320020Z",
            "url": "https://files.pythonhosted.org/packages/90/58/76baf8799e2a95c878ea638122a5dd1c143c74555d74e834717314f2d0f6/qonic_misc-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-24 20:03:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Qonic-Team",
    "github_project": "qonic-misc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "qonic-misc"
}
        
Elapsed time: 0.26012s