Skip to main content

Simple minimalist quantum computing simalation for python

Project description

pythum

Simple minimalist quantum computing simalation for python

import pythum

Usage

Qubit

Class for qubit manipulation and instanciation by notation

from pythum import Qubit

qubit = Qubit()

|0>

Public Methods

Qubit.from_notation(cls, value: str) -> 'Qubit'

Instanciate a qubit by the formal notation.

The following are possible values:

  • "|0>": 0
  • "|1>": 1
  • "|10>", "|01>": super position
from pythum import Qubit

qubit1 = Qubit.from_notation("|0>")  # 0
qubit2 = Qubit.from_notation("|1>")  # 1
qubit3 = Qubit.from_notation("|10>")  # Super position

|0> |1> |01>

Qubit.from_qubit(cls, qubit: 'Qubit') -> 'Qubit'

Instanciate a copy of another qubit.

from pythum import Qubit

qubit1 = Qubit.from_notation("|1>")  # 1
qubit2 = Qubit.from_qubit(qubit1)  # 1

|1> |1>

up(self) -> 'self'

Points up the eletron.

The outcome of any measure will always be 1

from pythum import Qubit

qubit = Qubit()  # 0
qubit.up()       # 1

|1>

down(self) -> 'self'

Points down the eletron.

The outcome of any measure will always be 0

from pythum import Qubit

qubit = Qubit()  # 0
qubit.up()       # 1

|0>

left(self) -> 'self'

Points the eletronto the left.

The outcome of a measure may be 0 or 1

from pythum import Qubit

qubit = Qubit().left()  # Super position

|01>

right(self) -> 'self'

Points the eletronto the right.

The outcome of a measure may be 0 or 1

from pythum import Qubit

qubit = Qubit().left()  # Super position

|01>

Properties

alpha

Alpha probability for mesuring 0.

The returned probability is a number between 0 and 1.

from pythum import Qubit

Qubit().alpha
Qubit().up().alpha
Qubit().left().alpha
Qubit().right().alpha

1 0 0.5 0.5

beta

Beta probability for mesuring 1

The returned probability is a number between 0 and 1.

from pythum import Qubit

Qubit().beta
Qubit().up().beta
Qubit().left().beta
Qubit().right().beta

0 1 0.5 0.5

Qublock

Public methods

init(self, value: Union[int, 'Qublock', List[Qubit]])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythum-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythum-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file pythum-0.1.1.tar.gz.

File metadata

  • Download URL: pythum-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

File hashes

Hashes for pythum-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4ae0bde3a3802be9ec480641bbe35341cdc527d9e1b2b99e14de62bb7e61487b
MD5 d3104e19977fbd95128278c87d3b063f
BLAKE2b-256 0cc3680eadbf6802f0a943c54c0ee4d5c23902ce7f227677a28acff6f3d36124

See more details on using hashes here.

File details

Details for the file pythum-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pythum-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

File hashes

Hashes for pythum-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5bd30b220dcf50b52105ac3bab7edbfe4a6f67a8cf5f78b30e379fccf7fe17bb
MD5 1000b2ba8655be94a418e5292b6d6794
BLAKE2b-256 062fc139b0ba7ed61c38946ccc9e005b059438beb29fdc33a4b90e3c2fd37d1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page