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

Correct some typos across the codebase #6280

Merged
merged 14 commits into from
Sep 20, 2024
2 changes: 1 addition & 1 deletion doc/development/adding_operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ knows a native implementation for ``FlipAndRotate``). It also defines an adjoint
# as the class differs from the standard `__init__` call signature of
# (*data, wires=wires, **hyperparameters), the _unflatten method that
# must be defined as well
# _unflatten recreates a opeartion from the serialized data and metadata of ``Operator._flatten``
# _unflatten recreates a operation from the serialized data and metadata of ``Operator._flatten``
# copied_op = type(op)._unflatten(*op._flatten())
wires = metadata[0]
hyperparams = dict(metadata[1])
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ If you are having issues, please let us know by posting the issue on our GitHub

We encourage contributions — simply fork the PennyLane repository, and then make a
`pull request <https://help.github.com/articles/about-pull-requests/>`_ containing
your contribution. All contributers to PennyLane will be listed as authors on the releases.
your contribution. All contributors to PennyLane will be listed as authors on the releases.

To chat directly with the team designing and building PennyLane, as well as members of
our community — ranging from quantum machine learning researchers, to students, to those
Expand Down
2 changes: 1 addition & 1 deletion doc/introduction/interfaces/numpy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ the following QNode that accepts two arguments ``data`` and ``weights``:
qml.CNOT(wires=[0, 2])
return qml.expval(qml.PauliZ(0))

rng = np.random.default_rng(seed=42) # make the results reproducable
rng = np.random.default_rng(seed=42) # make the results reproducible
data = rng.random([2 ** 3], requires_grad=False)
weights = np.array([0.1, 0.2, 0.3], requires_grad=True)

Expand Down
2 changes: 1 addition & 1 deletion doc/introduction/measurements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ circuit:

.. code-block:: python

# fix seed to make results reproducable
# fix seed to make results reproducible
np.random.seed(1)

dev = qml.device("default.qubit", wires=1)
Expand Down
2 changes: 1 addition & 1 deletion doc/introduction/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ The shape can for example be used to construct random weights at the beginning o
return qml.expval(qml.PauliZ(0))

shape = BasicEntanglerLayers.shape(n_layers=2, n_wires=n_wires)
np.random.seed(42) # to make the result reproducable
np.random.seed(42) # to make the result reproducible
weights = np.random.random(size=shape)

>>> circuit(weights)
Expand Down
2 changes: 1 addition & 1 deletion pennylane/circuit_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class CircuitGraph:
par_info (Optional[list[dict]]): Parameter information. For each index, the entry is a dictionary containing an operation
and an index into that operation's parameters.
trainable_params (Optional[set[int]]): A set containing the indices of parameters that support
differentiability. The indices provided match the order of appearence in the
differentiability. The indices provided match the order of appearance in the
quantum circuit.
"""

Expand Down
4 changes: 2 additions & 2 deletions pennylane/compiler/qjit_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def qjit(fn=None, *args, compiler="catalyst", **kwargs): # pylint:disable=keywo
Please see the :doc:`Catalyst documentation <catalyst:index>` for more details on
supported devices, operations, and measurements.

CUDA Quantum supports ``softwareq.qpp``, ``nvidida.custatevec``, and ``nvidia.cutensornet``.
CUDA Quantum supports ``softwareq.qpp``, ``nvidia.custatevec``, and ``nvidia.cutensornet``.

Args:
fn (Callable): Hybrid (quantum-classical) function to compile
Expand All @@ -77,7 +77,7 @@ def qjit(fn=None, *args, compiler="catalyst", **kwargs): # pylint:disable=keywo
elements of this list are named sequences of MLIR passes to be executed. A ``None``
value (the default) results in the execution of the default pipeline. This option is
considered to be used by advanced users for low-level debugging purposes.
static_argnums(int or Seqence[Int]): an index or a sequence of indices that specifies the
static_argnums(int or Sequence[Int]): an index or a sequence of indices that specifies the
positions of static arguments.
abstracted_axes (Sequence[Sequence[str]] or Dict[int, str] or Sequence[Dict[int, str]]):
An experimental option to specify dynamic tensor shapes.
Expand Down
4 changes: 2 additions & 2 deletions pennylane/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@
... doc="The hamiltonian of the system"))
>>> dataset.eigen = qml.data.attribute(
... {"eigvals": eigvals, "eigvecs": eigvecs},
... doc="Eigenvalues and eigenvectors of the hamiltonain")
... doc="Eigenvalues and eigenvectors of the hamiltonian")

This metadata can then be accessed using the :meth:`Dataset.attr_info` mapping:

>>> dataset.attr_info["eigen"]["doc"]
'Eigenvalues and eigenvectors of the hamiltonain'
'Eigenvalues and eigenvectors of the hamiltonian'


Declarative API
Expand Down
4 changes: 2 additions & 2 deletions pennylane/data/base/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,12 @@ def attribute(
... doc="The hamiltonian of the system"))
>>> dataset.eigen = qml.data.attribute(
... {"eigvals": eigvals, "eigvecs": eigvecs},
... doc="Eigenvalues and eigenvectors of the hamiltonain")
... doc="Eigenvalues and eigenvectors of the hamiltonian")

This metadata can then be accessed using the :meth:`~.Dataset.attr_info` mapping:

>>> dataset.attr_info["eigen"]["doc"]
'Eigenvalues and eigenvectors of the hamiltonain'
'Eigenvalues and eigenvectors of the hamiltonian'
"""
return match_obj_type(val)(val, AttributeInfo(doc=doc, py_type=type(val), **kwargs))

Expand Down
4 changes: 2 additions & 2 deletions pennylane/devices/device_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Device(abc.ABC):
Shot information is no longer stored on the device, but instead specified on individual input :class:`~.QuantumTape`.

The old devices defined a :meth:`~.Device.capabilities` dictionary that defined characteristics of the devices and controlled various
preprocessing and validation steps, such as ``"supports_broadcasting"``. These capabilites should now be handled by the
preprocessing and validation steps, such as ``"supports_broadcasting"``. These capabilities should now be handled by the
:meth:`~.Device.preprocess` method. For example, if a device does not support broadcasting, ``preprocess`` should
split a quantum script with broadcasted parameters into a batch of quantum scripts. If the device does not support mid circuit
measurements, then ``preprocess`` should apply :func:`~.defer_measurements`. A set of default preprocessing steps will be available
Expand All @@ -77,7 +77,7 @@ class Device(abc.ABC):
to certain inputs.

Versioning should be specified by the package containing the device. If an external package includes a PennyLane device,
then the package requirements should specify the minimium PennyLane version required to work with the device.
then the package requirements should specify the minimum PennyLane version required to work with the device.

.. details::
:title: The relationship between preprocessing and execution
Expand Down
2 changes: 1 addition & 1 deletion pennylane/fourier/qnode_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def circuit(x, y, z):
Note that the values of the output are dictionaries instead of the spectrum lists, that
they include the prefactors introduced by classical preprocessing, and
that we would not be able to compute the advanced spectrum for ``x`` because it is
preprocessed non-linearily in the gate ``qml.RX(0.5*x**2, wires=0, id="x")``.
preprocessed non-linearly in the gate ``qml.RX(0.5*x**2, wires=0, id="x")``.

"""
# pylint: disable=too-many-branches,protected-access
Expand Down
2 changes: 1 addition & 1 deletion pennylane/gradients/parameter_shift_cv.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def param_shift_cv(
If ``None``, the default gradient recipe containing the two terms
:math:`[c_0, a_0, s_0]=[1/2, 1, \pi/2]` and :math:`[c_1, a_1,
s_1]=[-1/2, 1, -\pi/2]` is assumed for every parameter.
fallback_fn (None or Callable): a fallback grdient function to use for
fallback_fn (None or Callable): a fallback gradient function to use for
any parameters that do not support the parameter-shift rule.
f0 (tensor_like[float] or None): Output of the evaluated input tape. If provided,
and the gradient recipe contains an unshifted term, this value is used,
Expand Down
2 changes: 1 addition & 1 deletion pennylane/gradients/parameter_shift_hessian.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def param_shift_hessian(
in the QNode execution.


Note: By default a QNode with the keyword ``hybrid=True`` computes derivates with respect to
Note: By default a QNode with the keyword ``hybrid=True`` computes derivatives with respect to
QNode arguments, which can include classical computations on those arguments before they are
passed to quantum operations. The "purely quantum" Hessian can instead be obtained with
``hybrid=False``, which is then computed with respect to the gate arguments and produces a
Expand Down
4 changes: 2 additions & 2 deletions pennylane/gradients/pulse_gradient_odegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

def _one_parameter_generators(op):
r"""Compute the effective generators :math:`\{\Omega_k\}` of one-parameter groups that
reproduce the partial derivatives of a parameterized evolution.
reproduce the partial derivatives of a parametrized evolution.
In particular, compute :math:`U` and :math:`\partial U / \partial \theta_k`
and recombine them into :math:`\Omega_k = U^\dagger \partial U / \partial \theta_k`

Expand Down Expand Up @@ -460,7 +460,7 @@ def pulse_odegen(

**Example**

Consider the parameterized Hamiltonian
Consider the parametrized Hamiltonian
:math:`\theta_0 Y_{0}+f(\boldsymbol{\theta_1}, t) Y_{1} + \theta_2 Z_{0}X_{1}`
with parameters :math:`\theta_0 = \frac{1}{5}`,
:math:`\boldsymbol{\theta_1}=\left(\frac{3}{5}, \frac{1}{5}\right)^{T}` and
Expand Down
12 changes: 6 additions & 6 deletions pennylane/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,18 @@ def circuit():
operator.

See below for more information regarding how to translate more complex circuits from Qiskit to
PennyLane, including handling parameterized Qiskit circuits, mid-circuit measurements, and
PennyLane, including handling parametrized Qiskit circuits, mid-circuit measurements, and
classical control flows.

.. details::
:title: Parameterized Quantum Circuits
:title: Parametrized Quantum Circuits

A Qiskit ``QuantumCircuit`` is parameterized if it contains
A Qiskit ``QuantumCircuit`` is parametrized if it contains
`Parameter <https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.Parameter>`__ or
`ParameterVector <https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.ParameterVector>`__
references that need to be given defined values to evaluate the circuit. These can be passed
to the generated quantum function as keyword or positional arguments. If we define a
parameterized circuit:
parametrized circuit:

.. code-block:: python

Expand Down Expand Up @@ -182,7 +182,7 @@ def circuit():
>>> qml.grad(circuit, argnum=[0, 1])(np.pi/4, np.pi/6)
(array(-0.61237244), array(-0.35355339))

The ``QuantumCircuit`` may also be parameterized with a ``ParameterVector``. These can be
The ``QuantumCircuit`` may also be parametrized with a ``ParameterVector``. These can be
similarly converted:

.. code-block:: python
Expand Down Expand Up @@ -363,7 +363,7 @@ def from_qiskit_op(qiskit_op, params=None, wires=None):
.. details::
:title: Usage Details

You can convert a parameterized ``SparsePauliOp`` into a PennyLane operator by assigning
You can convert a parametrized ``SparsePauliOp`` into a PennyLane operator by assigning
literal values to each coefficient parameter. For example, the script

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion pennylane/math/multi_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def eye(*args, like=None, **kwargs):


def multi_dispatch(argnum=None, tensor_list=None):
r"""Decorater to dispatch arguments handled by the interface.
r"""Decorator to dispatch arguments handled by the interface.

This helps simplify definitions of new functions inside PennyLane. We can
decorate the function, indicating the arguments that are tensors handled
Expand Down
2 changes: 1 addition & 1 deletion pennylane/math/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def get_interface(*values):
cannot both be present.

* Autograd tensors *may* be present alongside Torch, TensorFlow and Jax tensors,
but Torch, TensorFlow and Jax take precendence; the autograd arrays will
but Torch, TensorFlow and Jax take precedence; the autograd arrays will
be treated as non-differentiable NumPy arrays. A warning will be raised
suggesting that vanilla NumPy be used instead.

Expand Down
2 changes: 1 addition & 1 deletion pennylane/ops/cv.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class InterferometerUnitary(CVOperation):
This operation implements a **fixed** linear interferometer given a known
unitary matrix.

If you instead wish to parameterize the interferometer,
If you instead wish to parametrize the interferometer,
and calculate the gradient/optimize with respect to these parameters,
consider instead the :func:`pennylane.template.Interferometer` template,
which constructs an interferometer from a combination of beamsplitters
Expand Down
4 changes: 2 additions & 2 deletions pennylane/ops/op_math/prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class Prod(CompositeOp):
0. +0.j , 0. +0.j ]])

The Prod operation can be used inside a `qnode` as an operation which,
if parameterized, can be differentiated.
if parametrized, can be differentiated.

.. code-block:: python

Expand All @@ -204,7 +204,7 @@ def circuit(theta):
tensor(-0.9424888, requires_grad=True)

The Prod operation can also be measured as an observable.
If the circuit is parameterized, then we can also differentiate through the
If the circuit is parametrized, then we can also differentiate through the
product observable.

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion pennylane/ops/op_math/sprod.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class SProd(ScalarSymbolicOp):
:title: Usage Details

The SProd operation can also be measured inside a qnode as an observable.
If the circuit is parameterized, then we can also differentiate through the observable.
If the circuit is parametrized, then we can also differentiate through the observable.

.. code-block:: python

Expand Down
4 changes: 2 additions & 2 deletions pennylane/ops/op_math/sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class Sum(CompositeOp):
.. details::
:title: Usage Details

We can combine parameterized operators, and support sums between operators acting on
We can combine parametrized operators, and support sums between operators acting on
different wires.

>>> summed_op = Sum(qml.RZ(1.23, wires=0), qml.I(wires=1))
Expand All @@ -186,7 +186,7 @@ class Sum(CompositeOp):
0. +0.j , 1.81677345+0.57695852j]])

The Sum operation can also be measured inside a qnode as an observable.
If the circuit is parameterized, then we can also differentiate through the
If the circuit is parametrized, then we can also differentiate through the
sum observable.

.. code-block:: python
Expand Down
4 changes: 2 additions & 2 deletions pennylane/ops/op_math/symbolicop.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SymbolicOp(Operator):
"""Developer-facing base class for single-operator symbolic operators.

Args:
base (~.operation.Operator): the base operation that is modified symbolicly
base (~.operation.Operator): the base operation that is modified symbolically
id (str): custom label given to an operator instance,
can be useful for some applications where the instance has to be identified

Expand Down Expand Up @@ -155,7 +155,7 @@ class ScalarSymbolicOp(SymbolicOp):
scalar coefficient.

Args:
base (~.operation.Operator): the base operation that is modified symbolicly
base (~.operation.Operator): the base operation that is modified symbolically
scalar (float): the scalar coefficient
id (str): custom label given to an operator instance, can be useful for some applications
where the instance has to be identified
Expand Down
2 changes: 1 addition & 1 deletion pennylane/ops/qubit/non_parametric_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ def is_hermitian(self) -> bool:
class ECR(Operation):
r""" ECR(wires)

An echoed RZX(pi/2) gate.
An echoed RZX(:math:`\pi/2`) gate.

.. math:: ECR = {\frac{1}{\sqrt{2}}} \begin{bmatrix}
0 & 0 & 1 & i \\
Expand Down
2 changes: 1 addition & 1 deletion pennylane/ops/qubit/parametric_ops_multi_qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# pylint: disable=too-many-arguments
"""
This submodule contains the discrete-variable quantum operations that are the
core parameterized gates.
core parametrized gates.
"""
# pylint:disable=abstract-method,arguments-differ,protected-access,invalid-overridden-method
import functools
Expand Down
2 changes: 1 addition & 1 deletion pennylane/ops/qubit/parametric_ops_single_qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# pylint: disable=too-many-arguments
"""
This submodule contains the discrete-variable quantum operations that are the
core parameterized gates.
core parametrized gates.
"""
# pylint:disable=abstract-method,arguments-differ,protected-access,invalid-overridden-method
import functools
Expand Down
2 changes: 1 addition & 1 deletion pennylane/ops/qutrit/parametric_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# pylint: disable=too-many-arguments
"""
This submodule contains the discrete-variable quantum operations that are the
core parameterized gates for qutrits.
core parametrized gates for qutrits.
"""
import functools

Expand Down
4 changes: 2 additions & 2 deletions pennylane/optimize/adaptive.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

@transform
def append_gate(tape: QuantumScript, params, gates) -> tuple[QuantumScriptBatch, PostprocessingFn]:
"""Append parameterized gates to an existing tape.
"""Append parametrized gates to an existing tape.

Args:
tape (QuantumTape or QNode or Callable): quantum circuit to transform by adding gates
Expand Down Expand Up @@ -156,7 +156,7 @@ def __init__(self, param_steps=10, stepsize=0.5):

@staticmethod
def _circuit(params, gates, initial_circuit):
"""Append parameterized gates to an existing circuit.
"""Append parametrized gates to an existing circuit.

Args:
params (array[float]): parameters of the gates to be added
Expand Down
2 changes: 1 addition & 1 deletion pennylane/optimize/qng.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class QNGOptimizer(GradientDescentOptimizer):

where :math:`|\psi_\ell\rangle = V(\theta_1, \dots, \theta_{i-1})|0\rangle`
(that is, :math:`|\psi_\ell\rangle` is the quantum state prior to the application
of parameterized layer :math:`\ell`).
of parametrized layer :math:`\ell`).

Combining the quantum natural gradient optimizer with the analytic parameter-shift
rule to optimize a variational circuit with :math:`d` parameters and :math:`L` layers,
Expand Down
4 changes: 2 additions & 2 deletions pennylane/optimize/qnspsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class QNSPSAOptimizer:

where :math:`F(\mathbf{x}', \mathbf{x}) = \bigr\rvert\langle \phi(\mathbf{x}') | \phi(\mathbf{x}) \rangle \bigr\rvert ^ 2`
measures the state overlap between :math:`\phi(\mathbf{x}')` and :math:`\phi(\mathbf{x})`,
where :math:`\phi` is the parameterized ansatz. The finite difference :math:`\delta F` is
where :math:`\phi` is the parametrized ansatz. The finite difference :math:`\delta F` is
computed from the two perturbations:

.. math::
Expand Down Expand Up @@ -110,7 +110,7 @@ class QNSPSAOptimizer:

Keyword Args:
stepsize (float): the user-defined hyperparameter :math:`\eta` for learning rate (default: 1e-3)
regularization (float): regularitzation term :math:`\beta` to the Fubini-Study metric tensor
regularization (float): regularization term :math:`\beta` to the Fubini-Study metric tensor
for numerical stability (default: 1e-3)
finite_diff_step (float): step size :math:`\epsilon` to compute the finite difference
gradient and the Fubini-Study metric tensor (default: 1e-2)
Expand Down
Loading
Loading