Skip to content

Commit b27fd11

Browse files
fix: typos in python files of directory qiskit/algorithms/optimizers/ (#11080) (#11081)
(cherry picked from commit 2c01ff8) Co-authored-by: Surav Shrestha <148626286+shresthasurav@users.noreply.github.com>
1 parent 2f76ef0 commit b27fd11

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

qiskit/algorithms/optimizers/gradient_descent.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def __init__(
197197
perturbation in both directions (defaults to 1e-2 if required).
198198
Ignored when we have an explicit function for the gradient.
199199
Raises:
200-
ValueError: If ``learning_rate`` is an array and its lenght is less than ``maxiter``.
200+
ValueError: If ``learning_rate`` is an array and its length is less than ``maxiter``.
201201
"""
202202
super().__init__(maxiter=maxiter)
203203
self.callback = callback
@@ -250,7 +250,7 @@ def perturbation(self, perturbation: float | None) -> None:
250250

251251
def _callback_wrapper(self) -> None:
252252
"""
253-
Wraps the callback function to accomodate GradientDescent.
253+
Wraps the callback function to accommodate GradientDescent.
254254
255255
Will call :attr:`~.callback` and pass the following arguments:
256256
current number of function values, current parameters, current function value,
@@ -295,7 +295,7 @@ def ask(self) -> AskData:
295295

296296
def tell(self, ask_data: AskData, tell_data: TellData) -> None:
297297
"""
298-
Updates :attr:`.~GradientDescentState.x` by an ammount proportional to the learning
298+
Updates :attr:`.~GradientDescentState.x` by an amount proportional to the learning
299299
rate and value of the gradient at that point.
300300
301301
Args:

qiskit/algorithms/optimizers/scipy_optimizer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def minimize(
122122
jac: Callable[[POINT], POINT] | None = None,
123123
bounds: list[tuple[float, float]] | None = None,
124124
) -> OptimizerResult:
125-
# Remove ignored parameters to supress the warning of scipy.optimize.minimize
125+
# Remove ignored parameters to suppress the warning of scipy.optimize.minimize
126126
if self.is_bounds_ignored:
127127
bounds = None
128128
if self.is_gradient_ignored:

qiskit/algorithms/optimizers/spsa.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def calibrate(
328328
steps = 25
329329
points = []
330330
for _ in range(steps):
331-
# compute the random directon
331+
# compute the random direction
332332
pert = bernoulli_perturbation(dim)
333333
points += [initial_point + c * pert, initial_point - c * pert]
334334

qiskit/algorithms/optimizers/steppable_optimizer.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class OptimizerState:
7171
njev: int | None
7272
"""Number of jacobian evaluations so far in the opimization."""
7373
nit: int | None
74-
"""Number of optmization steps performed so far in the optimization."""
74+
"""Number of optimization steps performed so far in the optimization."""
7575

7676

7777
class SteppableOptimizer(Optimizer):
@@ -81,7 +81,7 @@ class SteppableOptimizer(Optimizer):
8181
This family of optimizers uses the `ask and tell interface
8282
<https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/009_ask_and_tell.html>`_.
8383
When using this interface the user has to call :meth:`~.ask` to get information about
84-
how to evaluate the fucntion (we are asking the optimizer about how to do the evaluation).
84+
how to evaluate the function (we are asking the optimizer about how to do the evaluation).
8585
This information is typically the next points at which the function is evaluated, but depending
8686
on the optimizer it can also determine whether to evaluate the function or its gradient.
8787
Once the function has been evaluated, the user calls the method :meth:`~..tell`
@@ -180,7 +180,7 @@ def ask(self) -> AskData:
180180
It is the first method inside of a :meth:`~.step` in the optimization process.
181181
182182
Returns:
183-
An object containing the data needed to make the funciton evaluation to advance the
183+
An object containing the data needed to make the function evaluation to advance the
184184
optimization process.
185185
186186
"""
@@ -217,7 +217,7 @@ def evaluate(self, ask_data: AskData) -> TellData:
217217

218218
def _callback_wrapper(self) -> None:
219219
"""
220-
Wraps the callback function to accomodate each optimizer.
220+
Wraps the callback function to accommodate each optimizer.
221221
"""
222222
pass
223223

qiskit/algorithms/optimizers/umda.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class UMDA(Optimizer):
4949
have been obtained [1]. UMDA seems to provide very good solutions for those circuits in which
5050
the number of layers is not big.
5151
52-
The optimization process can be personalized depending on the paremeters chosen in the
52+
The optimization process can be personalized depending on the parameters chosen in the
5353
initialization. The main parameter is the population size. The bigger it is, the final result
5454
will be better. However, this increases the complexity of the algorithm and the runtime will
5555
be much heavier. In the work [1] different experiments have been performed where population

0 commit comments

Comments
 (0)