Skip to content

Commit accdeea

Browse files
Update 02-cpo-GRAPE-Hadamard.md
fixing spelling errors
1 parent ea023ce commit accdeea

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tutorials-v5/optimal-control/02-cpo-GRAPE-Hadamard.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ Alexander Pitchford ([email protected])
2121
Example to demonstrate using the control library to determine control
2222
pulses using the ctrlpulseoptim.optimize_pulse_unitary function.
2323
The (default) L-BFGS-B algorithm is used to optimise the pulse to
24-
minimise the fidelity error, which is equivalent maximising the fidelity
24+
minimise the fidelity error, which is equivalent to maximising the fidelity
2525
to an optimal value of 1.
2626

2727
The system in this example is a single qubit in a constant field in z
2828
with a variable control field in x
29-
The target evolution is the Hadamard gate irrespective of global phase
29+
The target evolution is the Hadamard gate, irrespective of global phase
3030

3131
The user can experiment with the timeslicing, by means of changing the
3232
number of timeslots and/or total time for the evolution.
3333
Different initial (starting) pulse types can be tried.
3434
The initial and final pulses are displayed in a plot
3535

36-
An in depth discussion of using methods of this type can be found in [1]
36+
An in-depth discussion of using methods of this type can be found in [1]
3737

3838
```python
3939
import datetime
@@ -82,10 +82,10 @@ n_ts = 10
8282
evo_time = 10
8383
```
8484

85-
### Set the conditions which will cause the pulse optimisation to terminate
85+
### Set the conditions that will cause the pulse optimisation to terminate
8686

8787

88-
At each iteration the fidelity of the evolution is tested by comparaing the calculated evolution U(T) with the target U_targ. For unitary systems such as this one this is typically:
88+
At each iteration, the fidelity of the evolution is tested by comparaing the calculated evolution U(T) with the target U_targ. For unitary systems such as this one this is typically:
8989
f = normalise(overlap(U(T), U_targ))
9090
For details of the normalisation see [1] or the source code.
9191
The maximum fidelity (for a unitary system) calculated this way would be 1, and hence the error is calculated as fid_err = 1 - fidelity. As such the optimisation is considered completed when the fid_err falls below such a target value.
@@ -126,7 +126,7 @@ f_ext = "{}_n_ts{}_ptype{}.txt".format(example_name, n_ts, p_type)
126126
### Run the optimisation
127127

128128

129-
In this step the L-BFGS-B algorithm is invoked. At each iteration the gradient of the fidelity error w.r.t. each control amplitude in each timeslot is calculated using an exact gradient method (see [1]). Using the gradients the algorithm will determine a set of piecewise control amplitudes that reduce the fidelity error. With repeated iterations an approximation of the Hessian matrix (the 2nd order differentials) is calculated, which enables a quasi 2nd order Newton method for finding a minima. The algorithm continues until one of the termination conditions defined above has been reached.
129+
In this step the L-BFGS-B algorithm is invoked. At each iteration the gradient of the fidelity error w.r.t. each control amplitude in each timeslot is calculated using an exact gradient method (see [1]). Using the gradients, the algorithm will determine a set of piecewise control amplitudes that reduce the fidelity error. With repeated iterations, an approximation of the Hessian matrix (the 2nd order differentials) is calculated, which enables a quasi 2nd order Newton method for finding a minima. The algorithm continues until one of the termination conditions defined above has been reached.
130130

131131
```python
132132
result = cpo.optimize_pulse_unitary(
@@ -149,11 +149,11 @@ result = cpo.optimize_pulse_unitary(
149149
### Report the results
150150

151151

152-
Firstly the performace statistics are reported, which gives a breadown of the processing times. The times given are those that are associated with calculating the fidelity and the gradients. Any remaining processing time can be assumed to be used by the optimisation algorithm (L-BFGS-B) itself. In this example it can be seen that the majority of time is spent calculating the propagators, i.e. exponentiating the combined Hamiltonian.
152+
Firstly the performace statistics are reported, which gives a breakdown of the processing times. The times given are those that are associated with calculating the fidelity and the gradients. Any remaining processing time can be assumed to be used by the optimisation algorithm (L-BFGS-B) itself. In this example, it can be seen that the majority of time is spent calculating the propagators, i.e., exponentiating the combined Hamiltonian.
153153

154154
The optimised U(T) is reported as the 'final evolution', which is essentially the string representation of the Qobj that holds the full time evolution at the point when the optimisation is terminated.
155155

156-
The key information is in the summary (given) last. Here the final fidelity is reported and the reasonn for termination of the algorithm.
156+
The key information is in the summary (given) last. Here the final fidelity is reported and the reason for termination of the algorithm.
157157

158158
```python
159159
result.stats.report()

0 commit comments

Comments
 (0)