Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update outdated docstrings #1512

Merged
merged 28 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5f30a04
`qibo.rst`
renatomello Oct 31, 2024
8b4b23d
`advancedexamples`
renatomello Oct 31, 2024
b397dd3
`advancedexamples.rst`
renatomello Oct 31, 2024
e48134d
`canonizator.py`
renatomello Oct 31, 2024
e24949a
`examples/aavqe`
renatomello Oct 31, 2024
dfe8a2c
`examples/adiabatic_qml`
renatomello Oct 31, 2024
5700014
`examples/anomaly_detection`
renatomello Oct 31, 2024
5158830
batch of changes
renatomello Oct 31, 2024
7f7c6be
batch of changes
renatomello Oct 31, 2024
0fda301
batch of changes
renatomello Oct 31, 2024
ac06dce
batch of changes
renatomello Oct 31, 2024
fcc4648
batch of changes
renatomello Oct 31, 2024
82d53fd
fix doc test
renatomello Oct 31, 2024
a5fcf8d
fix tests
renatomello Oct 31, 2024
cc892a1
changes in tests
renatomello Oct 31, 2024
d4b5fa5
fix test
renatomello Nov 1, 2024
ae70e39
more modifications
renatomello Nov 1, 2024
d54bb81
`readme`
renatomello Nov 1, 2024
cde6e10
fix test
renatomello Nov 1, 2024
7862ece
clean examples
renatomello Nov 1, 2024
420bcc9
fix docs
renatomello Nov 1, 2024
8aa0096
Merge branch 'master' into docs
renatomello Nov 4, 2024
5040732
Merge branch 'master' into docs
renatomello Nov 12, 2024
18686cc
Update examples/qclustering/distance_calc.py
renatomello Nov 13, 2024
1bbf991
Update examples/qclustering/distance_calc.py
renatomello Nov 13, 2024
c4c4505
Update src/qibo/gates/measurements.py
renatomello Nov 13, 2024
0cd328e
Update src/qibo/models/qcnn.py
renatomello Nov 13, 2024
3110f99
Update src/qibo/noise_model.py
renatomello Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ Here another example with more gates and shots simulation:
import numpy as np
from qibo import Circuit, gates

c = Circuit(2)
c.add(gates.X(0))
circuit = Circuit(2)
circuit.add(gates.X(0))

# Add a measurement register on both qubits
c.add(gates.M(0, 1))
circuit.add(gates.M(0, 1))

# Execute the circuit with the default initial state |00>.
result = c(nshots=100)
result = circuit(nshots=100)
```

In both cases, the simulation will run in a single device CPU or GPU in double precision `complex128`.
Expand Down
53 changes: 26 additions & 27 deletions doc/source/api-reference/qibo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,20 @@ Circuit addition

.. testsetup::

import qibo
from qibo import models
from qibo import gates
from qibo import Circuit, gates
from qibo.models import QFT

.. testcode::

c1 = models.QFT(4)
circuit_1 = QFT(4)

c2 = models.Circuit(4)
c2.add(gates.RZ(0, 0.1234))
c2.add(gates.RZ(1, 0.1234))
c2.add(gates.RZ(2, 0.1234))
c2.add(gates.RZ(3, 0.1234))
circuit_2 = Circuit(4)
circuit_2.add(gates.RZ(0, 0.1234))
circuit_2.add(gates.RZ(1, 0.1234))
circuit_2.add(gates.RZ(2, 0.1234))
circuit_2.add(gates.RZ(3, 0.1234))

c = c1 + c2
circuit = circuit_1 + circuit_2

will create a circuit that performs the Quantum Fourier Transform on four qubits
followed by Rotation-Z gates.
Expand Down Expand Up @@ -93,28 +92,28 @@ For example the following:

.. testcode::

from qibo import models, gates
from qibo import Circuit, gates

c = models.Circuit(2)
c.add([gates.H(0), gates.H(1)])
c.add(gates.CZ(0, 1))
c.add([gates.X(0), gates.Y(1)])
fused_c = c.fuse()
circuit = Circuit(2)
circuit.add([gates.H(0), gates.H(1)])
circuit.add(gates.CZ(0, 1))
circuit.add([gates.X(0), gates.Y(1)])
fused_circuit = circuit.fuse()

will create a new circuit with a single :class:`qibo.gates.special.FusedGate`
acting on ``(0, 1)``, while the following:

.. testcode::

from qibo import models, gates
from qibo import Circuit, gates

c = models.Circuit(3)
c.add([gates.H(0), gates.H(1), gates.H(2)])
c.add(gates.CZ(0, 1))
c.add([gates.X(0), gates.Y(1), gates.Z(2)])
c.add(gates.CNOT(1, 2))
c.add([gates.H(0), gates.H(1), gates.H(2)])
fused_c = c.fuse()
circuit = Circuit(3)
circuit.add([gates.H(0), gates.H(1), gates.H(2)])
circuit.add(gates.CZ(0, 1))
circuit.add([gates.X(0), gates.Y(1), gates.Z(2)])
circuit.add(gates.CNOT(1, 2))
circuit.add([gates.H(0), gates.H(1), gates.H(2)])
fused_circuit = circuit.fuse()

will give a circuit with two fused gates, the first of which will act on
``(0, 1)`` corresponding to
Expand Down Expand Up @@ -1422,10 +1421,10 @@ The final result of the circuit execution can also be saved to disk and loaded b

.. testcode::

c = Circuit(2)
c.add(gates.M(0,1))
circuit = Circuit(2)
circuit.add(gates.M(0,1))
# this will be a CircuitResult object
result = c()
result = circuit()
# save it to final_result.npy
result.dump('final_result.npy')
# can be loaded back
Expand Down
Loading