Commit Graph

38 Commits

Author SHA1 Message Date
Christian Clauss
0f4e51245f
Upgrade to Python 3.12 (#9576)
* DRAFT: GitHub Actions: Test on Python 3.12

Repeats #8777
* #8777 

Some of our dependencies will not be ready yet.

* Python 3.12: Disable qiskit and tensorflow algorithms

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-03 14:47:10 +05:30
pre-commit-ci[bot]
421ace81ed
[pre-commit.ci] pre-commit autoupdate (#9013)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.285 → v0.0.286](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.285...v0.0.286)
- [github.com/tox-dev/pyproject-fmt: 0.13.1 → 1.1.0](https://github.com/tox-dev/pyproject-fmt/compare/0.13.1...1.1.0)

* updating DIRECTORY.md

* Fis ruff rules PIE808,PLR1714

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-08-29 15:18:10 +02:00
Tianyi Zheng
0ef9306976
Disable quantum/quantum_random.py (attempt 2) (#8902)
* Disable quantum/quantum_random.py

Temporarily disable quantum/quantum_random.py because it produces an illegal instruction error that causes all builds to fail

* updating DIRECTORY.md

* Disable quantum/quantum_random.py attempt 2

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-07-28 22:08:40 +02:00
Caeden Perelli-Harris
93fb169627
[Upgrade Ruff] Fix all errors raised from ruff (#8879)
* chore: Fix tests

* chore: Fix failing ruff

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* chore: Fix ruff errors

* chore: Fix ruff errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update cellular_automata/game_of_life.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* chore: Update ruff version in pre-commit

* chore: Fix ruff errors

* Update edmonds_karp_multiple_source_and_sink.py

* Update factorial.py

* Update primelib.py

* Update min_cost_string_conversion.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-07-22 12:05:10 +02:00
Christian Clauss
d764eec655
Fix failing pytest quantum/bb84.py (#8838)
* Fix failing pytest quantum/bb84.py

* Update bb84.py test results to match current qiskit
2023-06-26 08:54:50 +05:30
Christian Clauss
5ca7189563
Rename quantum_random.py.DISABLED.txt to quantum_random.py (#8601)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-02 10:18:19 +05:30
Christian Clauss
521fbca61c
Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
Christian Clauss
c909da9b08
pre-commit: Upgrade psf/black for stable style 2023 (#8110)
* pre-commit: Upgrade psf/black for stable style 2023

Updating https://github.com/psf/black ... updating 22.12.0 -> 23.1.0 for their `2023 stable style`.
* https://github.com/psf/black/blob/main/CHANGES.md#2310

> This is the first [psf/black] release of 2023, and following our stability policy, it comes with a number of improvements to our stable style…

Also, add https://github.com/tox-dev/pyproject-fmt and https://github.com/abravalheri/validate-pyproject to pre-commit.

I only modified `.pre-commit-config.yaml` and all other files were modified by pre-commit.ci and psf/black.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-02-01 18:44:54 +05:30
Mark Mayo
f32d611689
clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
Abhishek Chakraborty
8951d857fe
BB84 QKD algorithm (#7898)
* Added BB84 algorithm.

* Function name lowercase + imports fix

I thought uppercase was appropriate because they're initials.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update quantum/bb84.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Removed python < 3.11 restriction from qiskit

* Removed python < 3.11 restriction from qiskit

* scikit-learn

* Update quantum/bb84.py

Correct typo in `default_rng()` call

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2022-11-08 18:24:21 +01:00
Kevin Joven
21601a4070
create quantum_fourier_transform (#6682)
* create quantum_fourier_transform

This is part of the #Hacktoberfest.
I build the quantum fourier transform for N qubits. (n = 3 in the example)
Best,
Kevin

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update q_fourier_transform.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add the doctest!

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update q_fourier_transform.py

* Pass first then fail

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-31 18:32:54 +01:00
Caeden Perelli-Harris
48a73a28d4
fix(quantum): Correct simulator deprecation (#7869) 2022-10-30 11:11:29 +01:00
Kevin Joven
87a5d91976
quantum_teleportation.py (#6632)
* quantum_teleportation.py

This code is for the #Hacktoberfest.
This file run the quantum teleportation circuit using Qiskit.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update quantum/quantum_teleportation.py

Co-authored-by: Caeden <caedenperelliharris@gmail.com>

* Update quantum/quantum_teleportation.py

Co-authored-by: Caeden <caedenperelliharris@gmail.com>

* Update

Corrected some typos. 
Add more comments for adding the gates.
Update the variable qc with quantum_circuit in the simulator and execute.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* python return typehint solved.

* Fix long line

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 10:49:33 +01:00
Christian Clauss
74325d079c
Rename quantum_random.py to quantum_random.py.DISABLED.txt (#7683)
* Rename quantum_random.py to quantum_random.py.DISABLED.txt

#7682

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-26 22:08:53 +02:00
Caeden Perelli-Harris
d5f322f576
fix: Replace deprecated qasm_simulator with aer_simulator (#7308) (#7556) 2022-10-23 18:36:12 +05:30
Kevin Joven
a5362799a5
Create superdense_coding.py (#7349)
* Create superdense_coding.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-23 18:24:27 +05:30
Alan Paul
831280cedd
Add quantum_random.py (#7446)
* Create quantum_random.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update quantum_random.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update quantum_random.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update quantum/quantum_random.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update quantum/quantum_random.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update quantum/quantum_random.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update quantum_random.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update quantum_random.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* requirements.txt: Add projectq

* Update quantum_random.py

* Update quantum/quantum_random.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update quantum_random.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update quantum_random.py

* Update quantum_random.py

* Update quantum/quantum_random.py

* Update quantum/quantum_random.py

* Update quantum_random.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-20 12:27:13 +02:00
Tianyi Zheng
2859d4bf3a
Remove references to depreciated QasmSimulator (#7417)
* Fix typos

* Replace depreciated QasmSimulator in Deutsch-Jozsa algorithm

* Replace depreciated QasmSimulator in half adder algorithm

* Replace depreciated QasmSimulator in not gate algorithm

* Replace depreciated QasmSimulator in full adder algorithm

* Simplify qiskit import

* Make formatting more consistent

* Replace depreciated QasmSimulator in quantum entanglement algorithm

* Replace depreciated QasmSimulator in ripple adder algorithm

* Replace depreciated QasmSimulator in qubit measure algorithm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updating DIRECTORY.md

* updating DIRECTORY.md

* Remove qiskit import alias for clarity

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-19 22:12:44 +02:00
Kevin Joven
7776411621
Create q_full_adder.py (#6735)
* Create q_full_adder.py

This is for the #Hacktoberfest.
This circuit is the quantum full adder. I saw that in the repo is the half adder so I decided to build the full adder to complete the set of adders.
I hope that this is enough to be consider a contribution.
Best,
Kevin

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Erase the unused numpy library

* Create the doctest.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* doctest for negative numbers, float, etc.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-16 09:47:54 +02:00
Abinash Satapathy
1aa7bd9616
Added barcode_validator.py (#6771)
* Update README.md

Added Google Cirq references

* Create barcode_validator.py

Barcode/EAN validator

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Included docstring and updated variables to snake_case

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Included docset and updated bugs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Implemented the changes asked in review.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Updated with f-string format

* Update barcode_validator.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-13 00:56:10 +02:00
John Law
9135a1f411
Fix doctests and builds in various files (#6233)
* Fix doctest in hamming distance

* add line break

* try to fix quantum_riper_adder

* fix floating point build
2022-07-06 10:00:05 +02:00
Christian Clauss
24d3cf8244
The black formatter is no longer beta (#5960)
* The black formatter is no longer beta

* pre-commit autoupdate

* pre-commit autoupdate

* Remove project_euler/problem_145 which is killing our CI tests

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-01-30 20:29:54 +01:00
Christian Clauss
ef9827166e
Approve functions used as default arguments (#4699)
* Approve functions used as default argumenets

* The default value for **seed** is the result of a function call

The default value for **seed** is the result of a function call which is not normally recommended and causes flake8-bugbear to raise a B008 error. However, in this case, it is accptable because `LinearCongruentialGenerator.__init__()` will only be called once per instance and it ensures that each instance will generate a unique sequence of numbers.

* The default value for **backend** is the result of a function call

The default value for **backend** is the result of a function call which is not normally recommended and causes flake8-bugbear to raise a B008 error. However, in this case, it is accptable because `Aer.get_backend()` is called when the function is definition and that same backend is then reused for function calls.

* Update linear_congruential_generator.py

* Update ripple_adder_classic.py

* Update ripple_adder_classic.py

* Update ripple_adder_classic.py

* Update ripple_adder_classic.py

* Update ripple_adder_classic.py
2021-08-31 07:56:19 +02:00
algobytewise
959507901a
[mypy] fix small folders (#4292)
* add final else-statement

* fix file_transfer

* fix quantum folder

* fix divide_and_conquer-folder

* Update build.yml

* updating DIRECTORY.md

* Update ripple_adder_classic.py

* Update .github/workflows/build.yml

* removed imports from typing

* removed conversion to string

* Revert "removed conversion to string"

This reverts commit 2f7c4731d1.

* implemented suggested changes

* Update receive_file.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-03-23 16:51:50 +01:00
Rupansh
9f6188cc40
Add Quantum Full Adder circuit for classical integers (#2954)
* requirements: add qiskit

major library required for quantum computing

* quantum: add quantum ripple adder implementation

right now we are essentially performing the same task as a classic ripple adder

Signed-off-by: rupansh-arch <rupanshsekar@hotmail.com>
2020-11-11 19:24:31 +08:00
Abhinand C
fd7da5ff8f
Add IBM Qiskit References (#2561)
* Added IBM Qiskit References

* space

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-10-29 08:43:34 +08:00
Christian Clauss
a481bfa231
Fix broken build: Remove trailing spaces (#3501)
* Fix broken build: Remove trailing spaces

* updating DIRECTORY.md

* One more trailing space

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-18 18:07:27 +02:00
Abhishek Jaisingh
beb2c35dd8
Implement Deutsch-Jozsa Algorithm In Qiskit (#3447)
* Implement Deutsch-Jozsa Algorithm In Qiskit

Signed-off-by: Abhishek Jaisingh <abhi2254015@gmail.com>

* Add Changes Requested In Review

Signed-off-by: Abhishek Jaisingh <abhi2254015@gmail.com>

* Address Further Review Comments

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-18 16:54:46 +02:00
Christian Clauss
f34434a214
Fix the build -- 88 chars per line max. (#3437)
* Fix the build -- 88 chars per line max.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-17 13:42:29 +02:00
Abhishek Jaisingh
a88006d04a
Qiskit: Add Quantum Half Adder (#3405)
* Qiskit: Add Quantum Half Adder

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-17 07:41:24 +02:00
NAVEEN S R
75a9b460ad
added script to perform quantum entanglement (#3270)
* added code to perform quantum entanglement

* Update quantum_entanglement.py
2020-10-14 12:25:20 +02:00
Dhruv
23ab159f30
Fix errors in Quantum algorithm (#3273)
* Fix pre-commit errors in Quantum algorithm

* updating DIRECTORY.md

* Fix doctest

* Update not_gate.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-14 07:58:52 +02:00
Abhishek Jaisingh
ca2d269ed2
Add Qiskit Quantum NOT Gate Example Code (#3255)
* Add Qiskit Quantum NOT Gate Example Code

* Address Review Comments

Signed-off-by: Abhishek Jaisingh <abhi2254015@gmail.com>
2020-10-13 18:34:24 +02:00
Dhruv
29b32d3553
Improve validate solutions script & fix pre-commit error (#3253)
* Trying to time every solution

* Proposal 2 for timing PE solutions:

- Use pytest fixture along with --capture=no flag to print out the
  top DURATIONS slowest solution at the end of the test sessions.
- Remove the print part and try ... except ... block from the test
  function.

* Proposal 3 for timing PE solutions:

Completely changed the way I was performing the tests. Instead of
parametrizing the problem numbers and expected output, I will
parametrize the solution file path.

Steps:
- Collect all the solution file paths
- Convert the paths into a Python module
- Call solution on the module
- Assert the answer with the expected results

For assertion, it was needed to convert the JSON list object to
Python dictionary object which required changing the JSON file itself.

* Add type hints for variables

* Fix whitespace in single_qubit_measure
2020-10-13 15:41:12 +05:30
Abhishek Jaisingh
6e01004535
Add First Quantum Qiskit Code Tutorial (#3173)
* Add First Quantum Qiskit Code Tutorial

* Add Qiskit Requirement

* Address Review Comments

* fixup! Format Python code with psf/black push

* Update q1.py

* updating DIRECTORY.md

* Update and rename q1.py to single_qubit_measure.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-12 21:41:05 +02:00
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
hackercyclops12
1b65309dca
Update README.md (#1842) 2020-04-07 23:56:21 +02:00
Christian Clauss
3d129a4964
Create Python/quantum/README.md (#1834)
* Create Python/quantum/README.md

Started at #1831

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-04-07 11:58:23 +02:00