Trajectree 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. trajectree/__init__.py +0 -3
  2. trajectree/fock_optics/devices.py +1 -1
  3. trajectree/fock_optics/light_sources.py +2 -2
  4. trajectree/fock_optics/measurement.py +9 -9
  5. trajectree/fock_optics/outputs.py +10 -6
  6. trajectree/fock_optics/utils.py +9 -6
  7. trajectree/sequence/swap.py +5 -4
  8. trajectree/trajectory.py +5 -4
  9. {trajectree-0.0.1.dist-info → trajectree-0.0.3.dist-info}/METADATA +2 -3
  10. trajectree-0.0.3.dist-info/RECORD +16 -0
  11. trajectree/quimb/docs/_pygments/_pygments_dark.py +0 -118
  12. trajectree/quimb/docs/_pygments/_pygments_light.py +0 -118
  13. trajectree/quimb/docs/conf.py +0 -158
  14. trajectree/quimb/docs/examples/ex_mpi_expm_evo.py +0 -62
  15. trajectree/quimb/quimb/__init__.py +0 -507
  16. trajectree/quimb/quimb/calc.py +0 -1491
  17. trajectree/quimb/quimb/core.py +0 -2279
  18. trajectree/quimb/quimb/evo.py +0 -712
  19. trajectree/quimb/quimb/experimental/__init__.py +0 -0
  20. trajectree/quimb/quimb/experimental/autojittn.py +0 -129
  21. trajectree/quimb/quimb/experimental/belief_propagation/__init__.py +0 -109
  22. trajectree/quimb/quimb/experimental/belief_propagation/bp_common.py +0 -397
  23. trajectree/quimb/quimb/experimental/belief_propagation/d1bp.py +0 -316
  24. trajectree/quimb/quimb/experimental/belief_propagation/d2bp.py +0 -653
  25. trajectree/quimb/quimb/experimental/belief_propagation/hd1bp.py +0 -571
  26. trajectree/quimb/quimb/experimental/belief_propagation/hv1bp.py +0 -775
  27. trajectree/quimb/quimb/experimental/belief_propagation/l1bp.py +0 -316
  28. trajectree/quimb/quimb/experimental/belief_propagation/l2bp.py +0 -537
  29. trajectree/quimb/quimb/experimental/belief_propagation/regions.py +0 -194
  30. trajectree/quimb/quimb/experimental/cluster_update.py +0 -286
  31. trajectree/quimb/quimb/experimental/merabuilder.py +0 -865
  32. trajectree/quimb/quimb/experimental/operatorbuilder/__init__.py +0 -15
  33. trajectree/quimb/quimb/experimental/operatorbuilder/operatorbuilder.py +0 -1631
  34. trajectree/quimb/quimb/experimental/schematic.py +0 -7
  35. trajectree/quimb/quimb/experimental/tn_marginals.py +0 -130
  36. trajectree/quimb/quimb/experimental/tnvmc.py +0 -1483
  37. trajectree/quimb/quimb/gates.py +0 -36
  38. trajectree/quimb/quimb/gen/__init__.py +0 -2
  39. trajectree/quimb/quimb/gen/operators.py +0 -1167
  40. trajectree/quimb/quimb/gen/rand.py +0 -713
  41. trajectree/quimb/quimb/gen/states.py +0 -479
  42. trajectree/quimb/quimb/linalg/__init__.py +0 -6
  43. trajectree/quimb/quimb/linalg/approx_spectral.py +0 -1109
  44. trajectree/quimb/quimb/linalg/autoblock.py +0 -258
  45. trajectree/quimb/quimb/linalg/base_linalg.py +0 -719
  46. trajectree/quimb/quimb/linalg/mpi_launcher.py +0 -397
  47. trajectree/quimb/quimb/linalg/numpy_linalg.py +0 -244
  48. trajectree/quimb/quimb/linalg/rand_linalg.py +0 -514
  49. trajectree/quimb/quimb/linalg/scipy_linalg.py +0 -293
  50. trajectree/quimb/quimb/linalg/slepc_linalg.py +0 -892
  51. trajectree/quimb/quimb/schematic.py +0 -1518
  52. trajectree/quimb/quimb/tensor/__init__.py +0 -401
  53. trajectree/quimb/quimb/tensor/array_ops.py +0 -610
  54. trajectree/quimb/quimb/tensor/circuit.py +0 -4824
  55. trajectree/quimb/quimb/tensor/circuit_gen.py +0 -411
  56. trajectree/quimb/quimb/tensor/contraction.py +0 -336
  57. trajectree/quimb/quimb/tensor/decomp.py +0 -1255
  58. trajectree/quimb/quimb/tensor/drawing.py +0 -1646
  59. trajectree/quimb/quimb/tensor/fitting.py +0 -385
  60. trajectree/quimb/quimb/tensor/geometry.py +0 -583
  61. trajectree/quimb/quimb/tensor/interface.py +0 -114
  62. trajectree/quimb/quimb/tensor/networking.py +0 -1058
  63. trajectree/quimb/quimb/tensor/optimize.py +0 -1818
  64. trajectree/quimb/quimb/tensor/tensor_1d.py +0 -4778
  65. trajectree/quimb/quimb/tensor/tensor_1d_compress.py +0 -1854
  66. trajectree/quimb/quimb/tensor/tensor_1d_tebd.py +0 -662
  67. trajectree/quimb/quimb/tensor/tensor_2d.py +0 -5954
  68. trajectree/quimb/quimb/tensor/tensor_2d_compress.py +0 -96
  69. trajectree/quimb/quimb/tensor/tensor_2d_tebd.py +0 -1230
  70. trajectree/quimb/quimb/tensor/tensor_3d.py +0 -2869
  71. trajectree/quimb/quimb/tensor/tensor_3d_tebd.py +0 -46
  72. trajectree/quimb/quimb/tensor/tensor_approx_spectral.py +0 -60
  73. trajectree/quimb/quimb/tensor/tensor_arbgeom.py +0 -3237
  74. trajectree/quimb/quimb/tensor/tensor_arbgeom_compress.py +0 -565
  75. trajectree/quimb/quimb/tensor/tensor_arbgeom_tebd.py +0 -1138
  76. trajectree/quimb/quimb/tensor/tensor_builder.py +0 -5411
  77. trajectree/quimb/quimb/tensor/tensor_core.py +0 -11179
  78. trajectree/quimb/quimb/tensor/tensor_dmrg.py +0 -1472
  79. trajectree/quimb/quimb/tensor/tensor_mera.py +0 -204
  80. trajectree/quimb/quimb/utils.py +0 -892
  81. trajectree/quimb/tests/__init__.py +0 -0
  82. trajectree/quimb/tests/test_accel.py +0 -501
  83. trajectree/quimb/tests/test_calc.py +0 -788
  84. trajectree/quimb/tests/test_core.py +0 -847
  85. trajectree/quimb/tests/test_evo.py +0 -565
  86. trajectree/quimb/tests/test_gen/__init__.py +0 -0
  87. trajectree/quimb/tests/test_gen/test_operators.py +0 -361
  88. trajectree/quimb/tests/test_gen/test_rand.py +0 -296
  89. trajectree/quimb/tests/test_gen/test_states.py +0 -261
  90. trajectree/quimb/tests/test_linalg/__init__.py +0 -0
  91. trajectree/quimb/tests/test_linalg/test_approx_spectral.py +0 -368
  92. trajectree/quimb/tests/test_linalg/test_base_linalg.py +0 -351
  93. trajectree/quimb/tests/test_linalg/test_mpi_linalg.py +0 -127
  94. trajectree/quimb/tests/test_linalg/test_numpy_linalg.py +0 -84
  95. trajectree/quimb/tests/test_linalg/test_rand_linalg.py +0 -134
  96. trajectree/quimb/tests/test_linalg/test_slepc_linalg.py +0 -283
  97. trajectree/quimb/tests/test_tensor/__init__.py +0 -0
  98. trajectree/quimb/tests/test_tensor/test_belief_propagation/__init__.py +0 -0
  99. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_d1bp.py +0 -39
  100. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_d2bp.py +0 -67
  101. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_hd1bp.py +0 -64
  102. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_hv1bp.py +0 -51
  103. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_l1bp.py +0 -142
  104. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_l2bp.py +0 -101
  105. trajectree/quimb/tests/test_tensor/test_circuit.py +0 -816
  106. trajectree/quimb/tests/test_tensor/test_contract.py +0 -67
  107. trajectree/quimb/tests/test_tensor/test_decomp.py +0 -40
  108. trajectree/quimb/tests/test_tensor/test_mera.py +0 -52
  109. trajectree/quimb/tests/test_tensor/test_optimizers.py +0 -488
  110. trajectree/quimb/tests/test_tensor/test_tensor_1d.py +0 -1171
  111. trajectree/quimb/tests/test_tensor/test_tensor_2d.py +0 -606
  112. trajectree/quimb/tests/test_tensor/test_tensor_2d_tebd.py +0 -144
  113. trajectree/quimb/tests/test_tensor/test_tensor_3d.py +0 -123
  114. trajectree/quimb/tests/test_tensor/test_tensor_arbgeom.py +0 -226
  115. trajectree/quimb/tests/test_tensor/test_tensor_builder.py +0 -441
  116. trajectree/quimb/tests/test_tensor/test_tensor_core.py +0 -2066
  117. trajectree/quimb/tests/test_tensor/test_tensor_dmrg.py +0 -388
  118. trajectree/quimb/tests/test_tensor/test_tensor_spectral_approx.py +0 -63
  119. trajectree/quimb/tests/test_tensor/test_tensor_tebd.py +0 -270
  120. trajectree/quimb/tests/test_utils.py +0 -85
  121. trajectree-0.0.1.dist-info/RECORD +0 -126
  122. {trajectree-0.0.1.dist-info → trajectree-0.0.3.dist-info}/WHEEL +0 -0
  123. {trajectree-0.0.1.dist-info → trajectree-0.0.3.dist-info}/licenses/LICENSE +0 -0
  124. {trajectree-0.0.1.dist-info → trajectree-0.0.3.dist-info}/top_level.txt +0 -0
@@ -1,479 +0,0 @@
1
- """Functions for generating quantum states.
2
- """
3
-
4
- import itertools
5
- import functools
6
- import math
7
- import numpy as np
8
-
9
- from ..core import (dag, ldmul, dot, make_immutable,
10
- qu, kron, eye, ikron, kronpow)
11
- from ..linalg.base_linalg import eigh
12
- from .operators import pauli, controlled
13
-
14
-
15
- def basis_vec(i, dim, ownership=None, **kwargs):
16
- r"""Constructs a unit vector ket:
17
-
18
- .. math::
19
-
20
- |i\rangle = \begin{pmatrix}
21
- 0 \\ \vdots \\ 1 \\ \vdots \\ 0
22
- \end{pmatrix}
23
-
24
- Parameters
25
- ----------
26
- i : int
27
- Which index should the single non-zero, unit entry.
28
- dim : int
29
- Total size of hilbert space.
30
- sparse : bool, optional
31
- Return vector as sparse matrix.
32
- kwargs
33
- Supplied to ``qu``.
34
-
35
- Returns
36
- -------
37
- vector
38
- The basis vector.
39
- """
40
- if ownership is None:
41
- shape = (dim, 1)
42
- x = np.zeros(shape, dtype=complex)
43
- x[i] = 1.0
44
- else:
45
- ri, rf = ownership
46
- shape = (rf - ri, 1)
47
- x = np.zeros(shape, dtype=complex)
48
- if ri <= i < rf:
49
- x[i - ri] = 1.0
50
-
51
- return qu(x, **kwargs)
52
-
53
-
54
- @functools.lru_cache(8)
55
- def up(**kwargs):
56
- r"""Returns up-state, aka. ``|0>``, +Z eigenstate:
57
-
58
- .. math::
59
-
60
- |0\rangle = \begin{pmatrix}
61
- 1 \\ 0
62
- \end{pmatrix}
63
-
64
- """
65
- u = qu([[1], [0]], **kwargs)
66
- make_immutable(u)
67
- return u
68
-
69
-
70
- zplus = up
71
-
72
-
73
- @functools.lru_cache(8)
74
- def down(**kwargs):
75
- r"""Returns down-state, aka. ``|1>``, -Z eigenstate:
76
-
77
- .. math::
78
-
79
- |1\rangle = \begin{pmatrix}
80
- 0 \\ 1
81
- \end{pmatrix}
82
-
83
- """
84
- d = qu([[0], [1]], **kwargs)
85
- make_immutable(d)
86
- return d
87
-
88
-
89
- zminus = down
90
-
91
-
92
- @functools.lru_cache(8)
93
- def plus(**kwargs):
94
- r"""Returns plus-state, aka. ``|+>``, +X eigenstate:
95
-
96
- .. math::
97
-
98
- |+\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix}
99
- 1 \\ 1
100
- \end{pmatrix}
101
-
102
- """
103
- return qu([[2**-0.5], [2**-0.5]], **kwargs)
104
-
105
-
106
- xplus = plus
107
-
108
-
109
- @functools.lru_cache(8)
110
- def minus(**kwargs):
111
- r"""Returns minus-state, aka. ``|->``, -X eigenstate:
112
-
113
- .. math::
114
-
115
- |-\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix}
116
- 1 \\ -1
117
- \end{pmatrix}
118
-
119
- """
120
- return qu([[2**-0.5], [-2**-0.5]], **kwargs)
121
-
122
-
123
- xminus = minus
124
-
125
-
126
- @functools.lru_cache(8)
127
- def yplus(**kwargs):
128
- r"""Returns yplus-state, aka. ``|y+>``, +Y eigenstate:
129
-
130
- .. math::
131
-
132
- |y+\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix}
133
- 1 \\ i
134
- \end{pmatrix}
135
-
136
- """
137
- return qu([[2**-0.5], [1.0j / (2**0.5)]], **kwargs)
138
-
139
-
140
- @functools.lru_cache(8)
141
- def yminus(**kwargs):
142
- r"""Returns yplus-state, aka. ``|y->``, -Y eigenstate:
143
-
144
- .. math::
145
-
146
- |y-\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix}
147
- 1 \\ -i
148
- \end{pmatrix}
149
-
150
- """
151
- return qu([[2**-0.5], [-1.0j / (2**0.5)]], **kwargs)
152
-
153
-
154
- def bloch_state(ax, ay, az, purified=False, **kwargs):
155
- r"""Construct qubit density operator from bloch vector:
156
-
157
- .. math::
158
-
159
- \rho = \frac{1}{2} \left( I + a_x X + a_y Y + a_z Z \right)
160
-
161
- Parameters
162
- ----------
163
- ax : float
164
- X component of bloch vector.
165
- ay : float
166
- Y component of bloch vector.
167
- az : float
168
- Z component of bloch vector.
169
- purified :
170
- Whether to map vector to surface of bloch sphere.
171
-
172
- Returns
173
- -------
174
- Matrix
175
- Density operator of qubit 'pointing' in (ax, ay, az) direction.
176
- """
177
- n = (ax**2 + ay**2 + az**2)**.5
178
- if purified:
179
- ax, ay, az = (a / n for a in (ax, ay, az))
180
- return sum(0.5 * a * pauli(s, **kwargs)
181
- for a, s in zip((1, ax, ay, az), "ixyz"))
182
-
183
-
184
- @functools.lru_cache(maxsize=8)
185
- def bell_state(s, **kwargs):
186
- r"""One of the four bell-states.
187
-
188
- If n = 2**-0.5, they are:
189
-
190
- 0. ``'psi-'`` : ``n * ( |01> - |10> )``
191
- 1. ``'psi+'`` : ``n * ( |01> + |10> )``
192
- 2. ``'phi-'`` : ``n * ( |00> - |11> )``
193
- 3. ``'phi+'`` : ``n * ( |00> + |11> )``
194
-
195
- They can be enumerated in this order.
196
-
197
- Parameters
198
- ----------
199
- s : str or int
200
- String of number of state corresponding to above.
201
- kwargs :
202
- Supplied to ``qu`` called on state.
203
-
204
- Returns
205
- -------
206
- p : immutable vector
207
- The bell-state ``s``.
208
- """
209
- keymap = {"psi-": "psi-", 0: "psi-", "psim": "psi-",
210
- "psi+": "psi+", 1: "psi+", "psip": "psi+",
211
- "phi-": "phi-", 2: "phi-", "phim": "phi-",
212
- "phi+": "phi+", 3: "phi+", "phip": "phi+"}
213
- c = 2.**-.5
214
- statemap = {"psi-": lambda: qu([0, c, -c, 0], **kwargs),
215
- "phi+": lambda: qu([c, 0, 0, c], **kwargs),
216
- "phi-": lambda: qu([c, 0, 0, -c], **kwargs),
217
- "psi+": lambda: qu([0, c, c, 0], **kwargs)}
218
- state = statemap[keymap[s]]()
219
- make_immutable(state)
220
- return state
221
-
222
-
223
- def singlet(**kwargs):
224
- """Alias for the 'psi-' bell-state.
225
- """
226
- return bell_state("psi-", **kwargs)
227
-
228
-
229
- def thermal_state(ham, beta, precomp_func=False):
230
- """Generate a thermal state of a Hamiltonian.
231
-
232
- Parameters
233
- ----------
234
- ham : operator or (1d-array, 2d-array)
235
- Hamiltonian, either full or tuple of (evals, evecs).
236
- beta : float
237
- Inverse temperature of state.
238
- precomp_func : bool, optional
239
- If True, return a function that takes ``beta``
240
- only and is closed over the solved hamiltonian.
241
-
242
- Returns
243
- -------
244
- operator or callable
245
- Density operator of thermal state, or function to generate such given
246
- a temperature.
247
- """
248
- if isinstance(ham, (list, tuple)): # solved already
249
- evals, evecs = ham
250
- else:
251
- evals, evecs = eigh(ham)
252
- evals -= evals.min() # offset by min to avoid numeric problems
253
-
254
- def gen_state(b):
255
- el = np.exp(-b * evals)
256
- el /= np.sum(el)
257
- return dot(evecs, ldmul(el, dag(evecs)))
258
-
259
- return gen_state if precomp_func else gen_state(beta)
260
-
261
-
262
- def computational_state(binary, **kwargs):
263
- """Generate the qubit computational state with ``binary``.
264
-
265
- Parameters
266
- ----------
267
- binary : sequence of 0s and 1s
268
- The binary of the computation state.
269
-
270
- Examples
271
- --------
272
- >>> computational_state('101'):
273
- qarray([[0.+0.j],
274
- [0.+0.j],
275
- [0.+0.j],
276
- [0.+0.j],
277
- [0.+0.j],
278
- [1.+0.j],
279
- [0.+0.j],
280
- [0.+0.j]])
281
-
282
- >>> qu.computational_state([0, 1], qtype='dop')
283
- qarray([[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
284
- [0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j],
285
- [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
286
- [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j]])
287
-
288
- See Also
289
- --------
290
- MPS_computational_state, basic_vec
291
- """
292
- if not isinstance(binary, str):
293
- binary = "".join(map(str, binary))
294
-
295
- return basis_vec(int(binary, 2), 2 ** len(binary), **kwargs)
296
-
297
-
298
- def neel_state(n, down_first=False, **kwargs):
299
- """Construct Neel state for n spins, i.e. alternating up/down.
300
-
301
- Parameters
302
- ----------
303
- n : int
304
- Number of spins.
305
- down_first : bool, optional
306
- Whether to start with '1' or '0' first.
307
- kwargs
308
- Supplied to ``qu`` called on state.
309
-
310
- See Also
311
- --------
312
- computational_state, MPS_neel_state
313
- """
314
- binary = "01" * (n // 2) + (n % 2 == 1) * "0"
315
- if down_first:
316
- binary = "1" + binary[:-1]
317
-
318
- return computational_state(binary, **kwargs)
319
-
320
-
321
- def singlet_pairs(n, **kwargs):
322
- """Construct fully dimerised spin chain.
323
-
324
- I.e. ``bell_state('psi-') & bell_state('psi-') & ...``
325
-
326
- Parameters
327
- ----------
328
- n : int
329
- Number of spins.
330
- kwargs
331
- Supplied to ``qu`` called on state.
332
-
333
- Returns
334
- -------
335
- vector
336
- """
337
- return kronpow(bell_state('psi-', **kwargs), (n // 2))
338
-
339
-
340
- def werner_state(p, **kwargs):
341
- """Construct Werner State, i.e. fractional mix of identity with singlet.
342
-
343
- Parameters
344
- ----------
345
- p : float
346
- Singlet Fraction.
347
- kwargs
348
- Supplied to :func:`~quimb.qu` called on state.
349
-
350
- Returns
351
- -------
352
- qarray
353
- """
354
- return (p * bell_state('psi-', qtype="dop", **kwargs) +
355
- (1 - p) * eye(4, **kwargs) / 4)
356
-
357
-
358
- def ghz_state(n, **kwargs):
359
- """Construct GHZ state of `n` spins, i.e. equal superposition of all up
360
- and down.
361
-
362
- Parameters
363
- ----------
364
- n : int
365
- Number of spins.
366
- kwargs
367
- Supplied to ``qu`` called on state.
368
-
369
- Returns
370
- -------
371
- vector
372
- """
373
- psi = (basis_vec(0, 2**n) +
374
- basis_vec(2**n - 1, 2**n)) / 2.**.5
375
- return qu(psi, **kwargs)
376
-
377
-
378
- def w_state(n, **kwargs):
379
- """Construct W-state: equal superposition of all single spin up states.
380
-
381
- Parameters
382
- ----------
383
- n : int
384
- Number of spins.
385
- kwargs
386
- Supplied to ``qu`` called on state.
387
-
388
- Returns
389
- -------
390
- vector
391
- """
392
- return sum(basis_vec(2**i, 2**n, **kwargs) for i in range(n)) / n**0.5
393
-
394
-
395
- def levi_civita(perm):
396
- """Compute the generalised levi-civita coefficient for a permutation.
397
-
398
- Parameters
399
- ----------
400
- perm : sequence of int
401
- The permutation, a re-arrangement of ``range(n)``.
402
-
403
- Returns
404
- -------
405
- int
406
- Either -1, 0 or 1.
407
- """
408
- n = len(perm)
409
- if n != len(set(perm)): # infer there are repeated elements
410
- return 0
411
- mat = np.zeros((n, n), dtype=np.int32)
412
- for i, j in zip(range(n), perm):
413
- mat[i, j] = 1
414
- return int(np.linalg.det(mat))
415
-
416
-
417
- def perm_state(ps):
418
- """Construct the anti-symmetric state which is the +- sum of all
419
- tensored permutations of states ``ps``.
420
-
421
- Parameters
422
- ----------
423
- ps : sequence of states
424
- The states to combine.
425
-
426
- Returns
427
- -------
428
- vector or operator
429
- The permutation state, dimension same as ``kron(*ps)``.
430
-
431
- Examples
432
- --------
433
- A singlet is the ``perm_state`` of up and down.
434
-
435
- >>> states = [up(), down()]
436
- >>> pstate = perm_state(states)
437
- >>> expec(pstate, singlet())
438
- 1.0
439
- """
440
- n = len(ps)
441
- vec_perm = itertools.permutations(ps)
442
- ind_perm = itertools.permutations(range(n))
443
-
444
- def terms():
445
- for vec, ind in zip(vec_perm, ind_perm):
446
- yield levi_civita(ind) * kron(*vec)
447
-
448
- return sum(terms()) / math.factorial(n)**0.5
449
-
450
-
451
- def graph_state_1d(n, cyclic=False, sparse=False):
452
- """Graph State on a line.
453
-
454
- Parameters
455
- ----------
456
- n : int
457
- The number of spins.
458
- cyclic : bool, optional
459
- Whether to use cyclic boundary conditions for the graph.
460
- sparse : bool, optional
461
- Whether to return a sparse state.
462
-
463
- Returns
464
- -------
465
- vector
466
- The 1d-graph state.
467
- """
468
- p = kronpow(plus(sparse=sparse), n)
469
-
470
- for i in range(n - 1):
471
- p = ikron(controlled("z", sparse=True), [2] * n, (i, i + 1)) @ p
472
-
473
- if cyclic:
474
- p = ((eye(2, sparse=True) & eye(2**(n - 2), sparse=True) &
475
- qu([1, 0], qtype="dop", sparse=True)) +
476
- (pauli("z", sparse=True) & eye(2**(n - 2), sparse=True) &
477
- qu([0, 1], qtype="dop", sparse=True))) @ p
478
-
479
- return p
@@ -1,6 +0,0 @@
1
- """Linear algebra routines to solve quantum systems for example.
2
- """
3
-
4
- from ..utils import find_library
5
-
6
- SLEPC4PY_FOUND = find_library("slepc4py")