dann5


Namedann5 JSON
Version 2.2.2 PyPI version JSON
download
home_pagehttps://github.com/voya-voja/d5o2
SummaryA Library of Quantum computing types for programming
upload_time2023-09-28 19:54:28
maintainer
docs_urlNone
authorvoya-voja
requires_python>=3.10
licenseGPLv3
keywords quantum computing programming coding language development types dwave ibm azure
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # dann5.ocean version 2 (d5o2)

This project aims to simplify the programming of quantum computing models and demonstrates ways of faster development of interactive examples, which will help you learn to formulate and solve problems on quantum computers by using [dann5 d5o library](https://github.com/voya-voja/dann5) quantum programing types and operations. The d5o library provides means of converting operational assignments into QUBO, which then can be executed on various quantum solvers, being analog quantum gate computers using IBM Qiskit for example, or quantum annealers or hybrid computers using DWave Ocean, or quantum simulators using Azure Quantum. Dann5 d5o library provides means of specifying undefined and defined variables in python of programming types such as q-bit, q-boolean, q-binary, q-whole, q-integer, quantum non-negative rational and q-rational. The specified quantum variables then can be linked into quantum logic assignments by applying appropriate operational expression to describe the problem that needs to be solved. In a way dann5 d5o library is an extension of D-Wave Ocean's stack of tools, which will allow you to develop integrated code, and to submit it to run in a quantum annealing computer (QAC), either D-Wave Advantage, 2000Q or Hybrid Solver.

The goal of Dann5 project and d5o framework is to provide QAC developers with programming constructs, such as:
- standard types:
    - **Qbit**† – quantum bit, where
      > Qbit x ϵ { 0, 1, S(uperposition) }
    - **Qbool**† – quantum boolean, where
      > Qbool x ϵ { T(rue), F(alse), S(uperposition) }
    - **Qbin**† – quantum binary, as an array of Qbit’s
      > Qbin x ≡ Qbit[ xi; where xi ϵ Qbit & 0 <= i <= n ]
    - **Qwhole** – quantum whole numbers (non-negative integer), where 
      > 	Qwhole x ∈ { n | n ≥ 0                                         }
      >                {   | n = U(nknown) if ni = S | ni ϵ Qbit & ni ϵ n} }
    - **Qint**† – quantum integer numbers, where 
      > 	Qint x ∈ Qwhole U -Qwhole                                         }
    - **Qnnr**†† – quantum non-negative rational numbers, where 
      > 	Qnnr x ∈ { r | r ∈ R(ational) & n≥0                          }
      >              {   | r = U(nknown) if ri = S | ri ϵ Qbit & ri ϵ r} }
    - **Qrat**†† – quantum rational numbers, where 
      > 	Qreal x ∈ Qnnr U -Qnnr                                         }
- definitions:
  - **Quantum variable** examples
    > Qbit x(“x”) ⇛ initialize a Q bit variable with the bit in S(uperpostion) state
    
    > Qbool y(“z”, d5o.Qbool.false()) ⇛ initialize a defined Q binary variable with bit z = 0
    
    > Qbin a(3, “a”) ⇛ initialize an undefined Q binary variable with 3 quantum bits in S(uperpostion) state
    
    > Qwhole b(“b”, 6) ⇛ initialize a defined Q whole variable b with value 6, i.e. contains 3 qbits with deterministic values: b0 = 0, b1 = 1 and b2 = 1
    
    > Qint i(3, “i”, -1) ⇛ initialize a defined Q whole variable i with value -1, i.e. contains 3 qbits with deterministic values: i0 = 1 i1 = 1 and i2 = 1
    
    > Qnnr c(“c”, 2.5) ⇛ initialize a defined Q non-negative rational variable c with binary value 10.1, i.e. c-1 = 1, c0 = 0 and c1 = 1 ††
    
    > Qrat a(1.2, “d”) ⇛ initialize a Q rational variable d with 3 quantum bits, as an unknown rational number, i.e. d-2 = S, d-1 = S and d0 = S ††
    
  - **Qassignment** - quantum assignment defines an operational interaction between predefined variables
    > eX = Qwhole(“X”, 15).assign(a * a) ⇛ for Q variable a (defined above) assigns multiplication expression with expected result X -= 15 to eX Q quantum assignment
    - QUBO integration into D-Wave Ocean, Azure Quantum or Qiskit:
      - **qubo()**  – returns QUBO binary quadratic model (BQM) of the assignment
        > eX.qubo() ⇛ for eX Q assignment (defined above) returns a QUBO dictionary object for execution on an exact or QAC solver
      - **add()**  – receives a dictionary of samples returned by a solver 
        > eX.add(lowSamples) ⇛ sets resulting samples returned from a solver into eX Q equation, which has been used to create QUBO BQM
      - **solutions()**  – returns string representation of the assignments solutions based on added samples 
        > eX.solutions() ⇛ for eX Q assignment (defined above) with expected result 15 and b set to 6 returns solutions for undefined Q variable a
      - **reset()**  – resets teh assignment into its inital state, i.e. without any solutions 
        > eX.reset() ⇛ for eX Q assignment (defined above) is set into its initial state
        
  - **Qcondition**†† - quantum condition statement
    > Qcondition cA(a > b) ⇛ creates a Q condition cA that compares (above defined) Q variables a and b
    
    > cA << eX ⇛ adds the (above defined) eX Q equation to be calculated under condition cA, i.e. a is bigger than b
    
  - **Qroutine**†† - quantum routine
    > Qroutine program(“my Q program”) ⇛ creates a Q routine program, which allows correlation of programming Q statements
    
    >	program << cA << eB ⇛ adds the (above defined) cA Q condition and a predefined eB Q equation into my Q program
    
  - **Qfunction**†† - quantum function routine
    >	Qfunction myF(“my F”, a) ⇛ creates a Q function routine my F with Q variable a as a return variable
    
    >	myF << cA << a + b ⇛ adds the (above defined) cA Q condition and addition Q equation of a and b into myF
    
    >	eB *= myF ⇛ updates eB Q equation with a multiplication of its existing expression with a return from myF Q function
    
   - **Qpow**††, **Qmod**††, **Qgcd**†† - specialized quantum function
      >	Qpow a_x3(a, 3) ⇛ creates a power Q function routine a_x3 with Q variable a as a base and exponent 3
   
      >	Qmod b_m3(b, 3) ⇛ creates a modulo Q function routine b_m3 with Q variable b as a dividend and divisor 3
   
      >	Qgcd a_b(a, b) ⇛ creates a greatest common divisor Q function routine a_b for Q variables a and b
- standard operations:
  - **assignment**  – of quantum variable or expression to the Q equation
  - **unary operators**: ~ (inversion)
  - **binary operators**: +, *, -, /
  - **logical operators**: &, |, ^, nand, nor
  - **comparison operators †**: ==, !=, >, >=, <, <=

    
      **Note** :  † features in development, †† planned features. 
    
For additional information on how to use features of d5o refer to [examples](examples).

## Install & Use

### Installation prerequisites
To install and use Dann5 d5o precompiled library
-	install [Python 3.9.9 (64-bit)](https://www.python.org/downloads/release/python-399/), which has been used to test released functionality
-	install D-Wave Ocean Tools into python environment; follow [Installing Ocean Tools](https://docs.ocean.dwavesys.com/en/stable/overview/install.html)
-	install pybind11 into the same python environment; follow [Installing the library](https://pybind11.readthedocs.io/en/stable/installing.html)

To compile Dann5 d5o source code in addition to above prerequisites
-	install [Eigen](https://eigen.tuxfamily.org/dox/GettingStarted.html) by following [download instructions](http://eigen.tuxfamily.org/index.php?title=Main_Page#Download)

### Installation
Dann5 d5o library is in active development on Windows x64 as a primary OS. A Mac OS X/Linux version and package installation will be released in the future.

#### Install Windows x64 version from this repository into python project or environment

> pip install --upgrade dann5

#####Install manually
  1.	Download dann5 folder with d5o.cp38-win_amd64.pyd library from [examples folder](examples) 
  2.	Make dann5 a sub-folder of
   -	your python project folder; or
   -	site-packages folder for your python environment, e.g. for anaconda distribution, on windows, the path should be:
   
        > C:\Users\<user_name>\AppData\Local\Continuum\anaconda3\envs\<env_name>\Lib\site-packages
    
  3.	Copy d5o.cp38-win_amd64.pyd into Dann5 sub-folder

#####Install package from source code
  1.	Simply clone or download the dann5 repository 
    -	If using the MS Visual Studio dann5.ocean.sln, make sure dann5 and Eigen are sub-folders in the same folder.
  2.	Build 
    -	d5o.cp38-win_amd64.pyd for windows and python x64
    -	d5o.cp38-win_amd32.pyd for windows and python x32
    -	d5o.so for Mac OS X or Linux
  3.	Deploy d5o library into dann5 folder within your python project or environment as described above in Windows x64 version installation
  
### Use
After installing d5o library as per instructions above, use released features in your python source code:
  > import dann5.d5o2 as d5o
  >
  > a = Qwhole(4, "a")
  >
  > b = Qwhole(3, "b")
  >
  > A = Qwhole("A", 15))
  >
  > eA = A.assign( a + b )
  >
  > print(eA.toString())
  >
  > print(eA.toString(True))
  >
  > print(eA.qubo())

Or use Jupyter Notebook [examples](examples) to review Dann5 d50 version 2 functionality. 

## Bugs, issues and contributing
Contributions to this project are welcome.

**Note**: if you have an issue, please send me the code example.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/voya-voja/d5o2",
    "name": "dann5",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "quantum computing programming coding language development types dwave ibm azure",
    "author": "voya-voja",
    "author_email": "nebojsa@nand5.onmicrosoft.com",
    "download_url": "https://files.pythonhosted.org/packages/d2/c5/10f5f62108a2568531fe450d2e771707453870945bab24e76015978c4dd8/dann5-2.2.2.tar.gz",
    "platform": null,
    "description": "# dann5.ocean version 2 (d5o2)\r\n\r\nThis project aims to simplify the programming of quantum computing models and demonstrates ways of faster development of interactive examples, which will help you learn to formulate and solve problems on quantum computers by using [dann5 d5o library](https://github.com/voya-voja/dann5) quantum programing types and operations. The d5o library provides means of converting operational assignments into QUBO, which then can be executed on various quantum solvers, being analog quantum gate computers using IBM Qiskit for example, or quantum annealers or hybrid computers using DWave Ocean, or quantum simulators using Azure Quantum. Dann5 d5o library provides means of specifying undefined and defined variables in python of programming types such as q-bit, q-boolean, q-binary, q-whole, q-integer, quantum non-negative rational and q-rational. The specified quantum variables then can be linked into quantum logic assignments by applying appropriate operational expression to describe the problem that needs to be solved. In a way dann5 d5o library is an extension of D-Wave Ocean's stack of tools, which will allow you to develop integrated code, and to submit it to run in a quantum annealing computer (QAC), either D-Wave Advantage, 2000Q or Hybrid Solver.\r\n\r\nThe goal of Dann5 project and d5o framework is to provide QAC developers with programming constructs, such as:\r\n- standard types:\r\n    - **Qbit**\u2020 \u2013 quantum bit, where\r\n      > Qbit x \u03f5 { 0, 1, S(uperposition) }\r\n    - **Qbool**\u2020 \u2013 quantum boolean, where\r\n      > Qbool x \u03f5 { T(rue), F(alse), S(uperposition) }\r\n    - **Qbin**\u2020 \u2013 quantum binary, as an array of Qbit\u2019s\r\n      > Qbin x \u2261 Qbit[ xi; where xi \u03f5 Qbit & 0 <= i <= n ]\r\n    - **Qwhole** \u2013 quantum whole numbers (non-negative integer), where \r\n      > \tQwhole x \u2208 { n | n \u2265 0                                         }\r\n      >                {   | n = U(nknown) if ni = S | ni \u03f5 Qbit & ni \u03f5 n} }\r\n    - **Qint**\u2020 \u2013 quantum integer numbers, where \r\n      > \tQint x \u2208 Qwhole U -Qwhole                                         }\r\n    - **Qnnr**\u2020\u2020 \u2013 quantum non-negative rational numbers, where \r\n      > \tQnnr x \u2208 { r | r \u2208 R(ational) & n\u22650                          }\r\n      >              {   | r = U(nknown) if ri = S | ri \u03f5 Qbit & ri \u03f5 r} }\r\n    - **Qrat**\u2020\u2020 \u2013 quantum rational numbers, where \r\n      > \tQreal x \u2208 Qnnr U -Qnnr                                         }\r\n- definitions:\r\n  - **Quantum variable** examples\r\n    > Qbit x(\u201cx\u201d) \u21db initialize a Q bit variable with the bit in S(uperpostion) state\r\n    \r\n    > Qbool y(\u201cz\u201d, d5o.Qbool.false()) \u21db initialize a defined Q binary variable with bit z = 0\r\n    \r\n    > Qbin a(3, \u201ca\u201d) \u21db initialize an undefined Q binary variable with 3 quantum bits in S(uperpostion) state\r\n    \r\n    > Qwhole b(\u201cb\u201d, 6) \u21db initialize a defined Q whole variable b with value 6, i.e. contains 3 qbits with deterministic values: b0 = 0, b1 = 1 and b2 = 1\r\n    \r\n    > Qint i(3, \u201ci\u201d, -1) \u21db initialize a defined Q whole variable i with value -1, i.e. contains 3 qbits with deterministic values: i0 = 1 i1 = 1 and i2 = 1\r\n    \r\n    > Qnnr c(\u201cc\u201d, 2.5) \u21db initialize a defined Q non-negative rational variable c with binary value 10.1, i.e. c-1 = 1, c0 = 0 and c1 = 1 \u2020\u2020\r\n    \r\n    > Qrat a(1.2, \u201cd\u201d) \u21db initialize a Q rational variable d with 3 quantum bits, as an unknown rational number, i.e. d-2 = S, d-1 = S and d0 = S \u2020\u2020\r\n    \r\n  - **Qassignment** - quantum assignment defines an operational interaction between predefined variables\r\n    > eX = Qwhole(\u201cX\u201d, 15).assign(a * a) \u21db for Q variable a (defined above) assigns multiplication expression with expected result X -= 15 to eX Q quantum assignment\r\n    - QUBO integration into D-Wave Ocean, Azure Quantum or Qiskit:\r\n      - **qubo()**  \u2013 returns QUBO binary quadratic model (BQM) of the assignment\r\n        > eX.qubo() \u21db for eX Q assignment (defined above) returns a QUBO dictionary object for execution on an exact or QAC solver\r\n      - **add()**  \u2013 receives a dictionary of samples returned by a solver \r\n        > eX.add(lowSamples) \u21db sets resulting samples returned from a solver into eX Q equation, which has been used to create QUBO BQM\r\n      - **solutions()**  \u2013 returns string representation of the assignments solutions based on added samples \r\n        > eX.solutions() \u21db for eX Q assignment (defined above) with expected result 15 and b set to 6 returns solutions for undefined Q variable a\r\n      - **reset()**  \u2013 resets teh assignment into its inital state, i.e. without any solutions \r\n        > eX.reset() \u21db for eX Q assignment (defined above) is set into its initial state\r\n        \r\n  - **Qcondition**\u2020\u2020 - quantum condition statement\r\n    > Qcondition cA(a > b) \u21db creates a Q condition cA that compares (above defined) Q variables a and b\r\n    \r\n    > cA << eX \u21db adds the (above defined) eX Q equation to be calculated under condition cA, i.e. a is bigger than b\r\n    \r\n  - **Qroutine**\u2020\u2020 - quantum routine\r\n    > Qroutine program(\u201cmy Q program\u201d) \u21db creates a Q routine program, which allows correlation of programming Q statements\r\n    \r\n    >\tprogram << cA << eB \u21db adds the (above defined) cA Q condition and a predefined eB Q equation into my Q program\r\n    \r\n  - **Qfunction**\u2020\u2020 - quantum function routine\r\n    >\tQfunction myF(\u201cmy F\u201d, a) \u21db creates a Q function routine my F with Q variable a as a return variable\r\n    \r\n    >\tmyF << cA << a + b \u21db adds the (above defined) cA Q condition and addition Q equation of a and b into myF\r\n    \r\n    >\teB *= myF \u21db updates eB Q equation with a multiplication of its existing expression with a return from myF Q function\r\n    \r\n   - **Qpow**\u2020\u2020, **Qmod**\u2020\u2020, **Qgcd**\u2020\u2020 - specialized quantum function\r\n      >\tQpow a_x3(a, 3) \u21db creates a power Q function routine a_x3 with Q variable a as a base and exponent 3\r\n   \r\n      >\tQmod b_m3(b, 3) \u21db creates a modulo Q function routine b_m3 with Q variable b as a dividend and divisor 3\r\n   \r\n      >\tQgcd a_b(a, b) \u21db creates a greatest common divisor Q function routine a_b for Q variables a and b\r\n- standard operations:\r\n  - **assignment**  \u2013 of quantum variable or expression to the Q equation\r\n  - **unary operators**: ~ (inversion)\r\n  - **binary operators**: +, *, -, /\r\n  - **logical operators**: &, |, ^, nand, nor\r\n  - **comparison operators \u2020**: ==, !=, >, >=, <, <=\r\n\r\n    \r\n      **Note** :  \u2020 features in development, \u2020\u2020 planned features. \r\n    \r\nFor additional information on how to use features of d5o refer to [examples](examples).\r\n\r\n## Install & Use\r\n\r\n### Installation prerequisites\r\nTo install and use Dann5 d5o precompiled library\r\n-\tinstall [Python 3.9.9 (64-bit)](https://www.python.org/downloads/release/python-399/), which has been used to test released functionality\r\n-\tinstall D-Wave Ocean Tools into python environment; follow [Installing Ocean Tools](https://docs.ocean.dwavesys.com/en/stable/overview/install.html)\r\n-\tinstall pybind11 into the same python environment; follow [Installing the library](https://pybind11.readthedocs.io/en/stable/installing.html)\r\n\r\nTo compile Dann5 d5o source code in addition to above prerequisites\r\n-\tinstall [Eigen](https://eigen.tuxfamily.org/dox/GettingStarted.html) by following [download instructions](http://eigen.tuxfamily.org/index.php?title=Main_Page#Download)\r\n\r\n### Installation\r\nDann5 d5o library is in active development on Windows x64 as a primary OS. A Mac OS X/Linux version and package installation will be released in the future.\r\n\r\n#### Install Windows x64 version from this repository into python project or environment\r\n\r\n> pip install --upgrade dann5\r\n\r\n#####Install manually\r\n  1.\tDownload dann5 folder with d5o.cp38-win_amd64.pyd library from [examples folder](examples) \r\n  2.\tMake dann5 a sub-folder of\r\n   -\tyour python project folder; or\r\n   -\tsite-packages folder for your python environment, e.g. for anaconda distribution, on windows, the path should be:\r\n   \r\n        > C:\\Users\\<user_name>\\AppData\\Local\\Continuum\\anaconda3\\envs\\<env_name>\\Lib\\site-packages\r\n    \r\n  3.\tCopy d5o.cp38-win_amd64.pyd into Dann5 sub-folder\r\n\r\n#####Install package from source code\r\n  1.\tSimply clone or download the dann5 repository \r\n    -\tIf using the MS Visual Studio dann5.ocean.sln, make sure dann5 and Eigen are sub-folders in the same folder.\r\n  2.\tBuild \r\n    -\td5o.cp38-win_amd64.pyd for windows and python x64\r\n    -\td5o.cp38-win_amd32.pyd for windows and python x32\r\n    -\td5o.so for Mac OS X or Linux\r\n  3.\tDeploy d5o library into dann5 folder within your python project or environment as described above in Windows x64 version installation\r\n  \r\n### Use\r\nAfter installing d5o library as per instructions above, use released features in your python source code:\r\n  > import dann5.d5o2 as d5o\r\n  >\r\n  > a = Qwhole(4, \"a\")\r\n  >\r\n  > b = Qwhole(3, \"b\")\r\n  >\r\n  > A = Qwhole(\"A\", 15))\r\n  >\r\n  > eA = A.assign( a + b )\r\n  >\r\n  > print(eA.toString())\r\n  >\r\n  > print(eA.toString(True))\r\n  >\r\n  > print(eA.qubo())\r\n\r\nOr use Jupyter Notebook [examples](examples) to review Dann5 d50 version 2 functionality. \r\n\r\n## Bugs, issues and contributing\r\nContributions to this project are welcome.\r\n\r\n**Note**: if you have an issue, please send me the code example.\r\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "A Library of Quantum computing types for programming",
    "version": "2.2.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/voya-voja/d5o2/issues",
        "Homepage": "https://github.com/voya-voja/d5o2"
    },
    "split_keywords": [
        "quantum",
        "computing",
        "programming",
        "coding",
        "language",
        "development",
        "types",
        "dwave",
        "ibm",
        "azure"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22ba9f960ae2538dd0cebf67b5d538db9ee8397b84a863fb75cba96d22d0ea5e",
                "md5": "b2a2076f37cee7702bfaa5fb15907f4d",
                "sha256": "3b6cdc87bce2096f062a671fc27014907a6b40c8c215c506c04b3983de7801a5"
            },
            "downloads": -1,
            "filename": "dann5-2.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b2a2076f37cee7702bfaa5fb15907f4d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 2526182,
            "upload_time": "2023-09-28T19:54:25",
            "upload_time_iso_8601": "2023-09-28T19:54:25.405942Z",
            "url": "https://files.pythonhosted.org/packages/22/ba/9f960ae2538dd0cebf67b5d538db9ee8397b84a863fb75cba96d22d0ea5e/dann5-2.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d2c510f5f62108a2568531fe450d2e771707453870945bab24e76015978c4dd8",
                "md5": "866312342b47716729d5e979c2d4f9bd",
                "sha256": "69cb5f76193cf7d4a8d5228d00c11811464ad98c1fd59a009024107e69aa7aa7"
            },
            "downloads": -1,
            "filename": "dann5-2.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "866312342b47716729d5e979c2d4f9bd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 2502524,
            "upload_time": "2023-09-28T19:54:28",
            "upload_time_iso_8601": "2023-09-28T19:54:28.349116Z",
            "url": "https://files.pythonhosted.org/packages/d2/c5/10f5f62108a2568531fe450d2e771707453870945bab24e76015978c4dd8/dann5-2.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-28 19:54:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "voya-voja",
    "github_project": "d5o2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "dann5"
}
        
Elapsed time: 0.12284s