Skip to content

Commit

Permalink
fix conflict in graysynth.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ShellyGarion committed Nov 3, 2022
2 parents a47e03c + 3095955 commit 01c0bdc
Show file tree
Hide file tree
Showing 145 changed files with 4,549 additions and 1,404 deletions.
10 changes: 0 additions & 10 deletions .azure/docs-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ jobs:
versionSpec: '${{ parameters.pythonVersion }}'
displayName: 'Use Python ${{ parameters.pythonVersion }}'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: Cache pip

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel
Expand Down
10 changes: 0 additions & 10 deletions .azure/lint-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ jobs:
versionSpec: '${{ parameters.pythonVersion }}'
displayName: 'Use Python ${{ parameters.pythonVersion }}'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: Cache pip

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel virtualenv
Expand Down
12 changes: 0 additions & 12 deletions .azure/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ jobs:
versionSpec: '${{ parameters.pythonVersion }}'
displayName: 'Use Python ${{ parameters.pythonVersion }}'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" |"$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: "Cache pip"

- task: Cache@2
inputs:
key: 'stestr | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
Expand Down Expand Up @@ -93,7 +83,6 @@ jobs:
pip install -U "cplex" "qiskit-aer" "z3-solver" -c constraints.txt
mkdir -p /tmp/terra-tests
cp -r test /tmp/terra-tests/.
cp tools/verify_parallel_map.py /tmp/terra-tests/.
cp .stestr.conf /tmp/terra-tests/.
cp -r .stestr /tmp/terra-tests/. || :
sudo apt-get update
Expand All @@ -108,7 +97,6 @@ jobs:
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 4294967295))")
echo "PYTHONHASHSEED=$PYTHONHASHSEED"
stestr run
python ./verify_parallel_map.py
popd
env:
QISKIT_PARALLEL: FALSE
Expand Down
11 changes: 0 additions & 11 deletions .azure/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ jobs:
versionSpec: '${{ parameters.pythonVersion }}'
displayName: 'Use Python ${{ parameters.pythonVersion }}'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: "Cache pip"

- task: Cache@2
inputs:
key: 'stestr | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
Expand Down Expand Up @@ -57,7 +47,6 @@ jobs:
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 4294967295))")
echo "PYTHONHASHSEED=$PYTHONHASHSEED"
stestr run
python ./tools/verify_parallel_map.py
env:
QISKIT_PARALLEL: FALSE
RUST_BACKTRACE: 1
Expand Down
1 change: 0 additions & 1 deletion .azure/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 1024))")
echo "PYTHONHASHSEED=$PYTHONHASHSEED"
stestr run
python ./tools/verify_parallel_map.py
env:
LANG: 'C.UTF-8'
PYTHONIOENCODING: 'utf-8:backslashreplace'
Expand Down
9 changes: 0 additions & 9 deletions .azure/tutorials-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ jobs:
versionSpec: '${{ parameters.pythonVersion }}'
displayName: 'Use Python ${{ parameters.pythonVersion }}'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"'
restoreKeys: |
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: Cache pip

- bash: |
set -e
git clone https://github.com/Qiskit/qiskit-tutorials --depth=1
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,17 @@ jobs:
pip install -r requirements-dev.txt qiskit-aer
stestr run
./grcov . --binary-path ./target/debug/ -s . --llvm --parallel -t lcov --branch --ignore-not-existing --ignore "/*" -o ./rust_unittest.info
mkdir rust_lcov
mv ./rust_unittest.info rust_lcov/.
rm *profraw
env:
QISKIT_TEST_CAPTURE_STREAMS: 1
QISKIT_PARALLEL: FALSE
PYTHON: "coverage3 run --source qiskit --parallel-mode"
- name: Generate parallel_map test
run: |
set -e
coverage3 run --source qiskit --parallel-mode ./tools/verify_parallel_map.py
./grcov . --binary-path ./target/debug/ -s . --llvm --parallel -t lcov --branch --ignore-not-existing --ignore "/*" -o ./rust_parallel_map.info
mv rust_lcov/rust_unittest.info .
env:
QISKIT_TEST_CAPTURE_STREAMS: 1
QISKIT_PARALLEL: FALSE
PYTHON: "coverage3 run --source qiskit --parallel-mode"
- name: Convert to lcov and combine data
run: |
set -e
coverage3 combine
coveragepy-lcov --output_file_path python.info
lcov --add-tracefile python.info -a rust_unittest.info -a rust_parallel_map.info -o combined.info
lcov --add-tracefile python.info -a rust_unittest.info -o combined.info
lcov --remove combined.info "target/*" -o coveralls.info
- name: Coveralls
uses: coverallsapp/github-action@master
Expand Down
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "qiskit-terra"
version = "0.23.0"
edition = "2018"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include qiskit/schemas/examples/*.json
include qiskit/VERSION.txt
recursive-include qiskit *.pyx
recursive-include qiskit *.pxd
include qiskit/visualization/styles/*.json
include qiskit/visualization/circuit/styles/*.json
recursive-include qiskit/providers/fake_provider/backends *.json

# Include the tests files.
Expand Down
112 changes: 57 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@

**Qiskit** is an open-source framework for working with noisy quantum computers at the level of pulses, circuits, and algorithms.

Qiskit is made up of elements that work together to enable quantum computing. This element is **Terra** and is the foundation on which the rest of Qiskit is built.
This library is the core component of Qiskit, **Terra**, which contains the building blocks for creating
and working with quantum circuits, programs, and algorithms. It also contains a compiler that supports
different quantum computers and a common interface for running programs on different quantum computer architectures.

For more details on how to use Qiskit you can refer to the documentation located here:

https://qiskit.org/documentation/


## Installation

We encourage installing Qiskit via the pip tool (a python package manager). The following command installs the core Qiskit components, including Terra.
We encourage installing Qiskit via ``pip``. The following command installs the core Qiskit components, including Terra.

```bash
pip install qiskit
Expand All @@ -19,76 +26,71 @@ To install from source, follow the instructions in the [documentation](https://q

## Creating Your First Quantum Program in Qiskit Terra

Now that Qiskit is installed, it's time to begin working with Terra.

We are ready to try out a quantum circuit example, which is simulated locally using
the Qiskit BasicAer element. This is a simple example that makes an entangled state.

```
$ python
```
Now that Qiskit is installed, it's time to begin working with Qiskit. To do this
we create a `QuantumCircuit` object to define a basic quantum program.

```python
>>> from qiskit import QuantumCircuit, transpile
>>> from qiskit.providers.basicaer import QasmSimulatorPy
>>> qc = QuantumCircuit(2, 2)
>>> qc.h(0)
>>> qc.cx(0, 1)
>>> qc.measure([0,1], [0,1])
>>> backend_sim = QasmSimulatorPy()
>>> transpiled_qc = transpile(qc, backend_sim)
>>> result = backend_sim.run(transpiled_qc).result()
>>> print(result.get_counts(qc))
from qiskit import QuantumCircuit
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0,1], [0,1])
```

In this case, the output will be:
This simple example makes an entangled state, also called a [Bell state](https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html#3.2-Entangled-States-).

Once you've made your first quantum circuit, you can then simulate it.
To do this, first we need to compile your circuit for the target backend we're going to run
on. In this case we are leveraging the built-in `BasicAer` simulator. However, this
simulator is primarily for testing and is limited in performance and functionality (as the name
implies). You should consider more sophisticated simulators, such as [`qiskit-aer`](https://github.com/Qiskit/qiskit-aer/),
for any real simulation work.

```python
{'00': 513, '11': 511}
from qiskit import transpile
from qiskit.providers.basicaer import QasmSimulatorPy
backend_sim = QasmSimulatorPy()
transpiled_qc = transpile(qc, backend_sim)
```

A script is available [here](examples/python/ibmq/hello_quantum.py), where we also show how to
run the same program on a real quantum computer via IBMQ.

### Executing your code on a real quantum chip
After compiling the circuit we can then run this on the ``backend`` object with:

You can also use Qiskit to execute your code on a
**real quantum chip**.
In order to do so, you need to configure Qiskit for using the credentials in
your IBM Q account:
```python
result = backend_sim.run(transpiled_qc).result()
print(result.get_counts(qc))
```

#### Configure your IBMQ credentials
The output from this execution will look similar to this:

1. Create an _[IBM Q](https://quantum-computing.ibm.com) > Account_ if you haven't already done so.
```python
{'00': 513, '11': 511}
```

2. Get an API token from the IBM Q website under _My Account > API Token_.
For further examples of using Qiskit you can look at the example scripts in **examples/python**. You can start with
[using_qiskit_terra_level_0.py](examples/python/using_qiskit_terra_level_0.py) and working up in the levels. Also
you can refer to the tutorials in the documentation here:

3. Take your token from step 2, here called `MY_API_TOKEN`, and run:
https://qiskit.org/documentation/tutorials.html

```python
>>> from qiskit import IBMQ
>>> IBMQ.save_account('MY_API_TOKEN')
```

After calling `IBMQ.save_account()`, your credentials will be stored on disk.
Once they are stored, at any point in the future you can load and use them
in your program simply via:
### Executing your code on a real quantum chip

```python
>>> from qiskit import IBMQ
>>> IBMQ.load_account()
```
You can also use Qiskit to execute your code on a **real quantum processor**.
Qiskit provides an abstraction layer that lets users run quantum circuits on hardware from any
vendor that provides an interface to their systems through Qiskit. Using these ``providers`` you can run any Qiskit code against
real quantum computers. Some examples of published provider packages for running on real hardware are:

Those who do not want to save their credentials to disk should use instead:
* https://github.com/Qiskit/qiskit-ibmq-provider
* https://github.com/Qiskit-Partners/qiskit-ionq
* https://github.com/Qiskit-Partners/qiskit-aqt-provider
* https://github.com/qiskit-community/qiskit-braket-provider
* https://github.com/qiskit-community/qiskit-quantinuum-provider
* https://github.com/rigetti/qiskit-rigetti

```python
>>> from qiskit import IBMQ
>>> IBMQ.enable_account('MY_API_TOKEN')
```
<!-- This is not an exhasutive list, and if you maintain a provider package please feel free to open a PR to add new providers -->

and the token will only be active for the session. For examples using Terra with real
devices we have provided a set of examples in **examples/python** and we suggest starting with [using_qiskit_terra_level_0.py](examples/python/using_qiskit_terra_level_0.py) and working up in
the levels.
You can refer to the documentation of these packages for further instructions
on how to get access and use these systems.

## Contribution Guidelines

Expand All @@ -98,7 +100,7 @@ If you'd like to contribute to Qiskit Terra, please take a look at our
We use [GitHub issues](https://github.com/Qiskit/qiskit-terra/issues) for tracking requests and bugs. Please
[join the Qiskit Slack community](https://ibm.co/joinqiskitslack)
and use our [Qiskit Slack channel](https://qiskit.slack.com) for discussion and simple questions.
For questions that are more suited for a forum we use the Qiskit tag in the [Stack Exchange](https://quantumcomputing.stackexchange.com/questions/tagged/qiskit).
For questions that are more suited for a forum we use the `qiskit` tag in the [Stack Exchange](https://quantumcomputing.stackexchange.com/questions/tagged/qiskit).

## Next Steps

Expand Down Expand Up @@ -126,7 +128,7 @@ release.
Additionally, as part of each release detailed release notes are written to
document in detail what has changed as part of a release. This includes any
documentation on potential breaking changes on upgrade and new features.
For example, You can find the release notes for the `0.9.0` release in the
For example, you can find the release notes for the `0.9.0` release in the
Qiskit documentation here:

https://qiskit.org/documentation/release_notes.html#terra-0-9
Expand Down
2 changes: 1 addition & 1 deletion examples/python/rippleadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def unmajority(p, a, b, c):
qc.x(a[0]) # Set input a = 0...0001
qc.x(b) # Set input b = 1...1111
# Apply the adder
qc += adder_subcircuit
qc &= adder_subcircuit
# Measure the output register in the computational basis
for j in range(n):
qc.measure(b[j], ans[j])
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ before-test = "pip install --only-binary=numpy,scipy numpy scipy"

[tool.cibuildwheel.linux]
before-all = "yum install -y wget && {package}/tools/install_rust.sh"
environment = 'PATH="$PATH:$HOME/.cargo/bin"'
environment = 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"'
Loading

0 comments on commit 01c0bdc

Please sign in to comment.