|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "markdown",
|
5 |
| - "id": "a48878df", |
| 5 | + "id": "a697fa0f", |
6 | 6 | "metadata": {
|
7 | 7 | "cq.autogen": "title_cell"
|
8 | 8 | },
|
|
13 | 13 | {
|
14 | 14 | "cell_type": "code",
|
15 | 15 | "execution_count": null,
|
16 |
| - "id": "d083d346", |
| 16 | + "id": "f3a56020", |
17 | 17 | "metadata": {
|
18 | 18 | "cq.autogen": "top_imports"
|
19 | 19 | },
|
|
30 | 30 | },
|
31 | 31 | {
|
32 | 32 | "cell_type": "markdown",
|
33 |
| - "id": "56539662", |
| 33 | + "id": "39be898d", |
34 | 34 | "metadata": {
|
35 | 35 | "cq.autogen": "Permutation.bloq_doc.md"
|
36 | 36 | },
|
|
62 | 62 | {
|
63 | 63 | "cell_type": "code",
|
64 | 64 | "execution_count": null,
|
65 |
| - "id": "df73124f", |
| 65 | + "id": "88b7712d", |
66 | 66 | "metadata": {
|
67 | 67 | "cq.autogen": "Permutation.bloq_doc.py"
|
68 | 68 | },
|
|
73 | 73 | },
|
74 | 74 | {
|
75 | 75 | "cell_type": "markdown",
|
76 |
| - "id": "31147b0d", |
| 76 | + "id": "5c4722c6", |
77 | 77 | "metadata": {
|
78 | 78 | "cq.autogen": "Permutation.example_instances.md"
|
79 | 79 | },
|
|
84 | 84 | {
|
85 | 85 | "cell_type": "code",
|
86 | 86 | "execution_count": null,
|
87 |
| - "id": "ec6460b6", |
| 87 | + "id": "8e38bf3a", |
88 | 88 | "metadata": {
|
89 | 89 | "cq.autogen": "Permutation.permutation"
|
90 | 90 | },
|
|
96 | 96 | {
|
97 | 97 | "cell_type": "code",
|
98 | 98 | "execution_count": null,
|
99 |
| - "id": "0c8e04f0", |
| 99 | + "id": "52218544", |
100 | 100 | "metadata": {
|
101 | 101 | "cq.autogen": "Permutation.permutation_symb"
|
102 | 102 | },
|
|
113 | 113 | {
|
114 | 114 | "cell_type": "code",
|
115 | 115 | "execution_count": null,
|
116 |
| - "id": "8578d036", |
| 116 | + "id": "cb1a6988", |
117 | 117 | "metadata": {
|
118 | 118 | "cq.autogen": "Permutation.permutation_symb_with_cycles"
|
119 | 119 | },
|
|
132 | 132 | {
|
133 | 133 | "cell_type": "code",
|
134 | 134 | "execution_count": null,
|
135 |
| - "id": "84b5606a", |
| 135 | + "id": "f58b58f7", |
136 | 136 | "metadata": {
|
137 | 137 | "cq.autogen": "Permutation.sparse_permutation"
|
138 | 138 | },
|
|
143 | 143 | ")"
|
144 | 144 | ]
|
145 | 145 | },
|
| 146 | + { |
| 147 | + "cell_type": "code", |
| 148 | + "execution_count": null, |
| 149 | + "id": "e644f2ac", |
| 150 | + "metadata": { |
| 151 | + "cq.autogen": "Permutation.sparse_permutation_with_symbolic_N" |
| 152 | + }, |
| 153 | + "outputs": [], |
| 154 | + "source": [ |
| 155 | + "import sympy\n", |
| 156 | + "\n", |
| 157 | + "N = sympy.symbols(\"N\", positive=True, integer=True)\n", |
| 158 | + "sparse_permutation_with_symbolic_N = Permutation.from_partial_permutation_map(\n", |
| 159 | + " N, {0: 1, 1: 3, 2: 4, 3: 7}\n", |
| 160 | + ")" |
| 161 | + ] |
| 162 | + }, |
146 | 163 | {
|
147 | 164 | "cell_type": "markdown",
|
148 |
| - "id": "369df9cb", |
| 165 | + "id": "ace174d5", |
149 | 166 | "metadata": {
|
150 | 167 | "cq.autogen": "Permutation.graphical_signature.md"
|
151 | 168 | },
|
|
156 | 173 | {
|
157 | 174 | "cell_type": "code",
|
158 | 175 | "execution_count": null,
|
159 |
| - "id": "25b2dc2b", |
| 176 | + "id": "1e55dcd4", |
160 | 177 | "metadata": {
|
161 | 178 | "cq.autogen": "Permutation.graphical_signature.py"
|
162 | 179 | },
|
163 | 180 | "outputs": [],
|
164 | 181 | "source": [
|
165 | 182 | "from qualtran.drawing import show_bloqs\n",
|
166 |
| - "show_bloqs([permutation, permutation_symb, permutation_symb_with_cycles, sparse_permutation],\n", |
167 |
| - " ['`permutation`', '`permutation_symb`', '`permutation_symb_with_cycles`', '`sparse_permutation`'])" |
| 183 | + "show_bloqs([permutation, permutation_symb, permutation_symb_with_cycles, sparse_permutation, sparse_permutation_with_symbolic_N],\n", |
| 184 | + " ['`permutation`', '`permutation_symb`', '`permutation_symb_with_cycles`', '`sparse_permutation`', '`sparse_permutation_with_symbolic_N`'])" |
168 | 185 | ]
|
169 | 186 | },
|
170 | 187 | {
|
171 | 188 | "cell_type": "markdown",
|
172 |
| - "id": "ad4321ad", |
| 189 | + "id": "32e2b5dd", |
173 | 190 | "metadata": {
|
174 | 191 | "cq.autogen": "Permutation.call_graph.md"
|
175 | 192 | },
|
|
180 | 197 | {
|
181 | 198 | "cell_type": "code",
|
182 | 199 | "execution_count": null,
|
183 |
| - "id": "3bfbf3f7", |
| 200 | + "id": "fab3fd69", |
184 | 201 | "metadata": {
|
185 | 202 | "cq.autogen": "Permutation.call_graph.py"
|
186 | 203 | },
|
|
194 | 211 | },
|
195 | 212 | {
|
196 | 213 | "cell_type": "markdown",
|
197 |
| - "id": "b3e895db", |
| 214 | + "id": "408e209c", |
198 | 215 | "metadata": {
|
199 | 216 | "cq.autogen": "PermutationCycle.bloq_doc.md"
|
200 | 217 | },
|
|
230 | 247 | {
|
231 | 248 | "cell_type": "code",
|
232 | 249 | "execution_count": null,
|
233 |
| - "id": "d569cd2c", |
| 250 | + "id": "bc68fccd", |
234 | 251 | "metadata": {
|
235 | 252 | "cq.autogen": "PermutationCycle.bloq_doc.py"
|
236 | 253 | },
|
|
241 | 258 | },
|
242 | 259 | {
|
243 | 260 | "cell_type": "markdown",
|
244 |
| - "id": "a93c6e89", |
| 261 | + "id": "de4c7922", |
245 | 262 | "metadata": {
|
246 | 263 | "cq.autogen": "PermutationCycle.example_instances.md"
|
247 | 264 | },
|
|
252 | 269 | {
|
253 | 270 | "cell_type": "code",
|
254 | 271 | "execution_count": null,
|
255 |
| - "id": "264ba946", |
| 272 | + "id": "071de1e1", |
256 | 273 | "metadata": {
|
257 |
| - "cq.autogen": "PermutationCycle.permutation_cycle" |
| 274 | + "cq.autogen": "PermutationCycle.permutation_cycle_symb_N" |
258 | 275 | },
|
259 | 276 | "outputs": [],
|
260 | 277 | "source": [
|
261 |
| - "permutation_cycle = PermutationCycle(4, (0, 1, 2))" |
| 278 | + "import sympy\n", |
| 279 | + "\n", |
| 280 | + "N = sympy.symbols(\"n\", positive=True, integer=True)\n", |
| 281 | + "cycle = (3, 1, 2)\n", |
| 282 | + "permutation_cycle_symb_N = PermutationCycle(N, cycle)" |
262 | 283 | ]
|
263 | 284 | },
|
264 | 285 | {
|
265 | 286 | "cell_type": "code",
|
266 | 287 | "execution_count": null,
|
267 |
| - "id": "78572528", |
| 288 | + "id": "fd61e92a", |
268 | 289 | "metadata": {
|
269 | 290 | "cq.autogen": "PermutationCycle.permutation_cycle_symb"
|
270 | 291 | },
|
|
279 | 300 | "permutation_cycle_symb = PermutationCycle(N, cycle)"
|
280 | 301 | ]
|
281 | 302 | },
|
| 303 | + { |
| 304 | + "cell_type": "code", |
| 305 | + "execution_count": null, |
| 306 | + "id": "b818f3b1", |
| 307 | + "metadata": { |
| 308 | + "cq.autogen": "PermutationCycle.permutation_cycle" |
| 309 | + }, |
| 310 | + "outputs": [], |
| 311 | + "source": [ |
| 312 | + "permutation_cycle = PermutationCycle(4, (0, 1, 2))" |
| 313 | + ] |
| 314 | + }, |
282 | 315 | {
|
283 | 316 | "cell_type": "markdown",
|
284 |
| - "id": "87615783", |
| 317 | + "id": "3d3c3e1b", |
285 | 318 | "metadata": {
|
286 | 319 | "cq.autogen": "PermutationCycle.graphical_signature.md"
|
287 | 320 | },
|
|
292 | 325 | {
|
293 | 326 | "cell_type": "code",
|
294 | 327 | "execution_count": null,
|
295 |
| - "id": "f6961010", |
| 328 | + "id": "de967993", |
296 | 329 | "metadata": {
|
297 | 330 | "cq.autogen": "PermutationCycle.graphical_signature.py"
|
298 | 331 | },
|
299 | 332 | "outputs": [],
|
300 | 333 | "source": [
|
301 | 334 | "from qualtran.drawing import show_bloqs\n",
|
302 |
| - "show_bloqs([permutation_cycle, permutation_cycle_symb],\n", |
303 |
| - " ['`permutation_cycle`', '`permutation_cycle_symb`'])" |
| 335 | + "show_bloqs([permutation_cycle_symb_N, permutation_cycle_symb, permutation_cycle],\n", |
| 336 | + " ['`permutation_cycle_symb_N`', '`permutation_cycle_symb`', '`permutation_cycle`'])" |
304 | 337 | ]
|
305 | 338 | },
|
306 | 339 | {
|
307 | 340 | "cell_type": "markdown",
|
308 |
| - "id": "16e1c105", |
| 341 | + "id": "58deda5c", |
309 | 342 | "metadata": {
|
310 | 343 | "cq.autogen": "PermutationCycle.call_graph.md"
|
311 | 344 | },
|
|
316 | 349 | {
|
317 | 350 | "cell_type": "code",
|
318 | 351 | "execution_count": null,
|
319 |
| - "id": "27628f10", |
| 352 | + "id": "ec16903f", |
320 | 353 | "metadata": {
|
321 | 354 | "cq.autogen": "PermutationCycle.call_graph.py"
|
322 | 355 | },
|
323 | 356 | "outputs": [],
|
324 | 357 | "source": [
|
325 | 358 | "from qualtran.resource_counting.generalizers import ignore_split_join\n",
|
326 |
| - "permutation_cycle_g, permutation_cycle_sigma = permutation_cycle.call_graph(max_depth=1, generalizer=ignore_split_join)\n", |
327 |
| - "show_call_graph(permutation_cycle_g)\n", |
328 |
| - "show_counts_sigma(permutation_cycle_sigma)" |
| 359 | + "permutation_cycle_symb_N_g, permutation_cycle_symb_N_sigma = permutation_cycle_symb_N.call_graph(max_depth=1, generalizer=ignore_split_join)\n", |
| 360 | + "show_call_graph(permutation_cycle_symb_N_g)\n", |
| 361 | + "show_counts_sigma(permutation_cycle_symb_N_sigma)" |
329 | 362 | ]
|
330 | 363 | }
|
331 | 364 | ],
|
|
0 commit comments