-
Notifications
You must be signed in to change notification settings - Fork 0
/
scratch.txt
359 lines (239 loc) · 10.9 KB
/
scratch.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
- use console colors: chalk
- separate derived engines
- use facade for gates
- to distinguish targets from controls
- find out why quantastica starts so slowly
- for adder.js example, make it easier to set and get 4-bit values
- circuit.unit(1, 4).write()
- circuit.unit(1, 4).read()
- let cin = circuit.unit(0)
- let a = circuit.unit(1, 4)
- let b = circuit.unit(5, 4)
- let cout = circuit.unit(9)
- in addition to .each(), use .one() in adder.js
- circuit.one(function() {})
- or
- let result = circuit.one()
- consider whether to allow:
- either circuit.addGate(targets, controls)
- or circuit.addGate(controls, targets)
- e.g. circuit.options({ controls_first : true})
- allow: no-trace, no-changes
- https://github.com/unconed/mathbox
- adder.js get_value(index, length)
- see unit.js
- circuit.read(5, 4)
- circuit.write(5, 4, value)
- better:
- .unit(0, 1).read()
- .unit(0, 1).write(1)
- .unit(0, 4).read()
- .unit(0, 4).write(14)
- circuit.unit(0, 3).read()
- circuit.unit(0, 3).write(14)
- to keep range implementation out of the circuit implementation
- no abbreviation h -> hadamard
- make amplify example more configurable
- e.g. which outcome?
- also: how to customize the level of an amplification?
- inside format.label - use Bits class instead
- changes does not seem to be displaying changes properly
- https://en.wikipedia.org/wiki/Alice_and_Bob
- add individual qubit objects to circuits
- add gate functions to individual qubits
- create larger qfts dynamically
- see: https://github.com/oreilly-qc/oreilly-qc.github.io/blob/master/samples/QCEngine/ch07_04_qft_big_sq_wave.js
- move changes/changed out of core circuit
- create an example which illustrates that phase operations on zero state have no effect
- also illustrate in superposition
- create a glossary
- also: what is the formal name for the output array?
- state vector?
- need to enforce when we are expecting a single result at 100% probability
- .one()
- how to create probability spread among 3 of 4?
- example: 33.33% 33.33% 33.33% 0%
- instead of: 25% 25% 25% 25%
- allow configuration of phase display 0 - 360
- create an examples index.md / README document
- implement phase gate .phase(0, 20)
- unit(0), unit(0, 1), unit(0), unit(0, 2)
- implement measure and unit measure
- remove number_to_bits & bits_to_number from Utility
- move Chain into Utility.js
- implement chain for units in Utility.js
- example: circuit.unit(0, 2).unit(1).measure()
- what if the unit qubits are not contiguous
- implement circuit.unit
- implement circuit.one - fail if less than 100.00%
- .one() and .each() should probably actually be .measure() before run
- can measuring into classical register variables be optional?
- instead measure into functions
- instead call circuit.measure(function(result) {})
- instead call circuit.unit(0).measure(function(result) {})
- zero based indexes or one based indexes?
- use circuit configuration
let circuit = require('../src/circuit.js')(name, size, {
engine: 'optimized',
order: ['targets', 'controls'] || ['controls', 'targets']
indexing: 0 || 1
})
- gate facade
- issue: a default circuit should return 100% at state | >
- fixed
- maybe
circuit.unit(0, 6, function(unit) {
unit.h()
})
.swap(0, 1)
.run()
or better
circuit
.unit(0, 6)
.h()
.circuit()
.swap(0, 1)
.run()
- remove params attribute (consolidate)
- implement circuit options
- targets/controls
- endian-ness
- engine
- difference between swap and teleport?
- how to conditional teleport?
- maybe allow for passing of an array to unit()
- phase rotation changes do not appear to print correctly - no evidence of change from the right column
- store to executed results of each example in the repo - for quick browsing review without installing
- idea: circuit().input().run()
- then: circuit().input().transform().run()
- is it possible to illustatate the vector state of each qubit from the amplitudes?
- look at quantum-circuit
- example with non-contrived inputs
- because amplifying "14" seems contrived
- come up with some example where we amplify some individual outcome bits with individual meaning
- what sort of illustration can we come up with with say 16 or 20 qubits
- how does entanglement work in a simulator? how does another qubit automatically update?
- illustrate why it is necessary to run a circuit many times
- because you can't actually see the internal structure of the probability
- you measure but you might not get the most likely result
- so run again multiple times to measure for more certainty
- create header for state results
- because the phase column is not obvious
- puzzle: table of 10: alternate seating of male female
- puzzle: table of 12: alternate seating of male, female, girl, boy
- puzzle: how to turn the qubits off
- puzzle: what are some ideas for desired state outputs
- puzzle: maze?
- example: reversibility
- illustrate what is reversible and what is not reversible
- illustrate that phase is no technically reversible until loop around again
- but show how to use negative phi, sdagger, tdagger
- illustrate s, t as rz(phi)
- illustrate how some gates can be constructed with other primitives
- refactor adder.js as add(3, 12)
- ensure that the algorithms are adaptable to dynamic qubits
- refactor amplify.js as amplify(Bits.fromNumber(3, 4))
- create a list of simple statements of fact
- possible outcomes = 2^n-qubits
- can really only know probability by measuring multiple (100-1000) times
- some gates are reversible
- some gates are not reversible
- any gate can be created with u3
- u1 is the same as rz (confirm)
- t-gate is the same as rx (pi / 4)
- altering phase on zero has no effect - qubit must be on/up or in superposition
- some common gates can be constructed from other gates
- finds wave frequency from period
- a single qubit can also hold 2 classical bits (why?) (but can use multiple qubits)
- idea: highlight important aspects in red
- look at the amplify example
- need markers for bit ranges
- specifically for adder.js
- with simple two qubit circuit - illustate how probablity and phase are caluclated
- illustate how magnitude must always add up to 1
- illustate how probability must always add up to 100%
- for these examples, consider highjacking console.log instead of using logger.log
- however, leave logger intact as the underlying basis
- pass every option to circuit class using oln (done)
- illustarte how pauli-x (not) is actually a magnitude inversion operation
- illustrate how u1 is the same as rz
- illustrate how cu1 is the same as crz
- illustrate how to create an arbitrary gate using u3
- remove the dashes from circuit names - use spaces and real sentences instead
- implement auto-reversability
- something like:
```
.autoreverse({
gates: function() {
this.h(0).h(1).h(2).h(3)
}
})
```
- print gate params in logger output: phi, lambda, etc
- illustate why scratch qubits as needed and how to use one
- figure out how to measure a single qubit from the circuit register
- introduce alice and bob to teleportation
- work on re-implementing simon's, bernstein-vazirani, deutch jozsa
- want these examples to tell stories, actually show, don't tell
- once two qubits are entangled, what are some effects we can demo?
- if we rotate z on qubit 0, will qubit 1 also rotate on z? how can we verify this?
- how to compare and contrast entagled state vs non-entangled state?
- need to measure for adder.js and deutsch-jozsa oracle
- implement harness for multi-run probability calc
- want to list the state index when printing results table
- helpful for changes
- search for qasm examples and openqasm examples
- important: still need to explain how the quantum Deutsch-Jozsa solution corresponds to the classical solution
- Bits array might be storing the bits in the wrong (reverse) order: should be little endian
- in Bits.js, maybe store bits as 0/1 and not booleans
- todo: need to be able to measure only part of the circuit register
- because endian-ness of Bit.js could be configurable, I need methods for bit(x) and iterate(fn)
- add Bits.invert - for extra validation for Bernstein-Vazirani example
- illustrate more clearly how root of not applied twice creates a not (x)
- idea: can measure a specific qubit by measuring all - then extracting that bit
- classical "frame of reference" is "illustration"
- add measure() to unit.js
- use http://scholar.google.com/ to find the original algorithm papers
- this is kinda cool: https://quantumgame.io/
- add constant state 1 to the Deutsch-Jozsa quantum solution
- look more into implementing the Shor algorithm based on the qiskit example
- but first look into quantum phase estimation and perhaps inverse QFT
- create a skeleton for quantum Shor
- illustrate phase kickback
- illustrate phase estimation
- add Host() to algorithm-bitstring-query-quantum.js
- add attempts to the shor examples
- add unit context to shor populate - then dynamic rendering
- add silent option to circuit
- convert qft to operate on an array of qubit indices
- because it's possible that they might not all be contiguous
- in algorithm-semiprime-factoring-quantum.js > quantum_decide_size,
- might be able to use Bits.js
- in algorithm-semiprime-factoring-quantum.js > quantum_estimate_spikes,
- use e array: [0, 0, 0]
- in algorithm-semiprime-factoring-quantum.js > quantum_decide_size,
- reading value of work and not precision like in the original example
- but why? is the qft implementation incorrect? inverted? not inverted?
- issue: shor example works with semiprime 15 even if I don't apply the QFT. What?
- illustrate phase kickback
- actually illustrate the exact change at the exact step
- think that results table is displaying global phase
- as an example change phase of one qubit by 90 and other by -45
- and see if end up at 45 (interference?)
- something is wrong with the bit.js example
- bits.toString("01"): 0011
- find a way to denote units of a circuit when printing: example" adder.js
- demonstrate uncomputing relating to the use of scratch qubits
- find a way to illustrate an operation (majority) with trace on - "trace" "operations"
- is it possible to animate probability mutation with one or two qubits and incremental rotation along multiple axis'
- actually: how can you reverse engineer gates from a desired outcome?
- when tracing, try to highlight the bit which changed or whether phase changed
- when averaging multiple shots, throw out rogue candidates (partial median?)
- create a contruct, perhaps Sequence to make it easier to apply reversability
- illustrate circuits which are not reversible
- is measuring indeed the sole irreversible operation?
- illustrate classical Karatsuba multiplication
- https://www.quantamagazine.org/mathematicians-discover-the-perfect-way-to-multiply-20190411/
- https://medium.com/@sashwat.anagolum/arithmetic-on-quantum-computers-multiplication-4482cdc2d83b
- need to warn if calling ccx without enough controls
- move _incubate into it's own repo