|
28 | 28 | "source": [ |
29 | 29 | "### Clifford Instructions\n", |
30 | 30 | "\n", |
31 | | - "Tsim supports all instructions [supported by Stim](https://github.com/quantumlib/Stim/wiki/Stim-v1.9-Gate-Reference). Below we show the standard generating set of Clifford gates:" |
| 31 | + "Tsim supports most instructions [supported by Stim](https://github.com/quantumlib/Stim/wiki/Stim-v1.9-Gate-Reference). Below we show the standard generating set of Clifford gates:" |
32 | 32 | ] |
33 | 33 | }, |
34 | 34 | { |
|
330 | 330 | "cell_type": "markdown", |
331 | 331 | "id": "28", |
332 | 332 | "metadata": {}, |
| 333 | + "source": [ |
| 334 | + "The `SPP` instruction phases the $-1$ eigenspace of a Pauli product observable by $i$. For example, `SPP Z0` is equivalent to the `S` gate, and `SPP X0*X1` is equivalent to `SQRT_XX`. The `SPP_DAG` instruction phases by $-i$ instead. The `!` operator inverts the product, swapping `SPP` and `SPP_DAG` behavior." |
| 335 | + ] |
| 336 | + }, |
| 337 | + { |
| 338 | + "cell_type": "code", |
| 339 | + "execution_count": null, |
| 340 | + "id": "29", |
| 341 | + "metadata": {}, |
| 342 | + "outputs": [], |
| 343 | + "source": [ |
| 344 | + "c = Circuit(\"SPP X0*Y1*Z2\")\n", |
| 345 | + "c.diagram(\"timeline-svg\", height=220)" |
| 346 | + ] |
| 347 | + }, |
| 348 | + { |
| 349 | + "cell_type": "markdown", |
| 350 | + "id": "30", |
| 351 | + "metadata": {}, |
333 | 352 | "source": [ |
334 | 353 | "### Noise Channels\n", |
335 | 354 | "\n", |
|
341 | 360 | { |
342 | 361 | "cell_type": "code", |
343 | 362 | "execution_count": null, |
344 | | - "id": "29", |
| 363 | + "id": "31", |
345 | 364 | "metadata": {}, |
346 | 365 | "outputs": [], |
347 | 366 | "source": [ |
|
351 | 370 | }, |
352 | 371 | { |
353 | 372 | "cell_type": "markdown", |
354 | | - "id": "30", |
| 373 | + "id": "32", |
355 | 374 | "metadata": {}, |
356 | 375 | "source": [ |
357 | 376 | "The `PAULI_CHANNEL_1(p_x, p_y, p_z)` instruction is a `X`, `Y`, and `Z` instruction that is applied with probabilities `p_x`, `p_y`, and `p_z` respectively." |
|
360 | 379 | { |
361 | 380 | "cell_type": "code", |
362 | 381 | "execution_count": null, |
363 | | - "id": "31", |
| 382 | + "id": "33", |
364 | 383 | "metadata": {}, |
365 | 384 | "outputs": [], |
366 | 385 | "source": [ |
|
370 | 389 | }, |
371 | 390 | { |
372 | 391 | "cell_type": "markdown", |
373 | | - "id": "32", |
| 392 | + "id": "34", |
374 | 393 | "metadata": {}, |
375 | 394 | "source": [ |
376 | 395 | "The `PAULI_CHANNEL_2` instruction takes fifteen floats specifying the disjoint probabilities of each possible Pauli pair\n", |
|
397 | 416 | { |
398 | 417 | "cell_type": "code", |
399 | 418 | "execution_count": null, |
400 | | - "id": "33", |
| 419 | + "id": "35", |
401 | 420 | "metadata": {}, |
402 | 421 | "outputs": [], |
403 | 422 | "source": [ |
|
409 | 428 | }, |
410 | 429 | { |
411 | 430 | "cell_type": "markdown", |
412 | | - "id": "34", |
| 431 | + "id": "36", |
413 | 432 | "metadata": {}, |
414 | 433 | "source": [ |
415 | 434 | "The `DEPOLARIZE1(p)` instruction applies a randomly chosen Pauli with probability `p`." |
|
418 | 437 | { |
419 | 438 | "cell_type": "code", |
420 | 439 | "execution_count": null, |
421 | | - "id": "35", |
| 440 | + "id": "37", |
422 | 441 | "metadata": {}, |
423 | 442 | "outputs": [], |
424 | 443 | "source": [ |
|
428 | 447 | }, |
429 | 448 | { |
430 | 449 | "cell_type": "markdown", |
431 | | - "id": "36", |
| 450 | + "id": "38", |
432 | 451 | "metadata": {}, |
433 | 452 | "source": [ |
434 | 453 | "The `DEPOLARIZE2(p)` instruction applies a randomly chosen two-qubit Pauli with probability `p`." |
|
437 | 456 | { |
438 | 457 | "cell_type": "code", |
439 | 458 | "execution_count": null, |
440 | | - "id": "37", |
| 459 | + "id": "39", |
441 | 460 | "metadata": {}, |
442 | 461 | "outputs": [], |
443 | 462 | "source": [ |
|
447 | 466 | }, |
448 | 467 | { |
449 | 468 | "cell_type": "markdown", |
450 | | - "id": "38", |
| 469 | + "id": "40", |
451 | 470 | "metadata": {}, |
452 | 471 | "source": [ |
453 | 472 | "The `CORRELATED_ERROR(p)` instruction applies a specified Pauli product with probability `p`. If no error occurred, then a following `ELSE_CORRELATED_ERROR(p2)` instruction may apply a Pauli product with probabiliy `p2`. If no error occurs again, further `ELSE_CORRELATED_ERROR(pi)` instructions in the chain may apply a Pauli products." |
|
456 | 475 | { |
457 | 476 | "cell_type": "code", |
458 | 477 | "execution_count": null, |
459 | | - "id": "39", |
| 478 | + "id": "41", |
460 | 479 | "metadata": {}, |
461 | 480 | "outputs": [], |
462 | 481 | "source": [ |
|
470 | 489 | }, |
471 | 490 | { |
472 | 491 | "cell_type": "markdown", |
473 | | - "id": "40", |
| 492 | + "id": "42", |
474 | 493 | "metadata": {}, |
475 | 494 | "source": [ |
476 | 495 | "### Annotations\n", |
|
483 | 502 | { |
484 | 503 | "cell_type": "code", |
485 | 504 | "execution_count": null, |
486 | | - "id": "41", |
| 505 | + "id": "43", |
487 | 506 | "metadata": {}, |
488 | 507 | "outputs": [], |
489 | 508 | "source": [ |
|
496 | 515 | }, |
497 | 516 | { |
498 | 517 | "cell_type": "markdown", |
499 | | - "id": "42", |
| 518 | + "id": "44", |
500 | 519 | "metadata": {}, |
501 | 520 | "source": [ |
502 | 521 | "The `OBSERVABLE_INCLUDE` instruction is only used in observable sampling mode and ignored otherwise. It instructs the detector sampler to record the XOR of the specified measurement bits." |
|
505 | 524 | { |
506 | 525 | "cell_type": "code", |
507 | 526 | "execution_count": null, |
508 | | - "id": "43", |
| 527 | + "id": "45", |
509 | 528 | "metadata": {}, |
510 | 529 | "outputs": [], |
511 | 530 | "source": [ |
|
518 | 537 | }, |
519 | 538 | { |
520 | 539 | "cell_type": "markdown", |
521 | | - "id": "44", |
| 540 | + "id": "46", |
522 | 541 | "metadata": {}, |
523 | 542 | "source": [ |
524 | 543 | "## Sampling\n", |
|
529 | 548 | { |
530 | 549 | "cell_type": "code", |
531 | 550 | "execution_count": null, |
532 | | - "id": "45", |
| 551 | + "id": "47", |
533 | 552 | "metadata": {}, |
534 | 553 | "outputs": [], |
535 | 554 | "source": [ |
|
546 | 565 | { |
547 | 566 | "cell_type": "code", |
548 | 567 | "execution_count": null, |
549 | | - "id": "46", |
| 568 | + "id": "48", |
550 | 569 | "metadata": {}, |
551 | 570 | "outputs": [], |
552 | 571 | "source": [ |
|
555 | 574 | }, |
556 | 575 | { |
557 | 576 | "cell_type": "markdown", |
558 | | - "id": "47", |
| 577 | + "id": "49", |
559 | 578 | "metadata": {}, |
560 | 579 | "source": [ |
561 | 580 | "The second sampling mode is detector sampling. This will sample detector events and observable values. Detector and observable bits can always be obtained by linear transformations of the measurement bits as return by the measurement sampler.\n", |
|
565 | 584 | { |
566 | 585 | "cell_type": "code", |
567 | 586 | "execution_count": null, |
568 | | - "id": "48", |
| 587 | + "id": "50", |
569 | 588 | "metadata": {}, |
570 | 589 | "outputs": [], |
571 | 590 | "source": [ |
|
584 | 603 | { |
585 | 604 | "cell_type": "code", |
586 | 605 | "execution_count": null, |
587 | | - "id": "49", |
| 606 | + "id": "51", |
588 | 607 | "metadata": {}, |
589 | 608 | "outputs": [], |
590 | 609 | "source": [ |
|
595 | 614 | }, |
596 | 615 | { |
597 | 616 | "cell_type": "markdown", |
598 | | - "id": "50", |
| 617 | + "id": "52", |
599 | 618 | "metadata": {}, |
600 | 619 | "source": [ |
601 | 620 | "Finally, Tsim allows to compute probability values for target states via the `CompiledStateProbs` sampler." |
|
604 | 623 | { |
605 | 624 | "cell_type": "code", |
606 | 625 | "execution_count": null, |
607 | | - "id": "51", |
| 626 | + "id": "53", |
608 | 627 | "metadata": {}, |
609 | 628 | "outputs": [], |
610 | 629 | "source": [ |
|
617 | 636 | { |
618 | 637 | "cell_type": "code", |
619 | 638 | "execution_count": null, |
620 | | - "id": "52", |
| 639 | + "id": "54", |
621 | 640 | "metadata": {}, |
622 | 641 | "outputs": [], |
623 | 642 | "source": [ |
|
627 | 646 | { |
628 | 647 | "cell_type": "code", |
629 | 648 | "execution_count": null, |
630 | | - "id": "53", |
| 649 | + "id": "55", |
631 | 650 | "metadata": {}, |
632 | 651 | "outputs": [], |
633 | 652 | "source": [ |
|
637 | 656 | { |
638 | 657 | "cell_type": "code", |
639 | 658 | "execution_count": null, |
640 | | - "id": "54", |
| 659 | + "id": "56", |
641 | 660 | "metadata": {}, |
642 | 661 | "outputs": [], |
643 | 662 | "source": [ |
|
647 | 666 | { |
648 | 667 | "cell_type": "code", |
649 | 668 | "execution_count": null, |
650 | | - "id": "55", |
| 669 | + "id": "57", |
651 | 670 | "metadata": {}, |
652 | 671 | "outputs": [], |
653 | 672 | "source": [ |
|
656 | 675 | }, |
657 | 676 | { |
658 | 677 | "cell_type": "markdown", |
659 | | - "id": "56", |
| 678 | + "id": "58", |
660 | 679 | "metadata": {}, |
661 | 680 | "source": [ |
662 | 681 | "## Visualization\n", |
|
669 | 688 | { |
670 | 689 | "cell_type": "code", |
671 | 690 | "execution_count": null, |
672 | | - "id": "57", |
| 691 | + "id": "59", |
673 | 692 | "metadata": {}, |
674 | 693 | "outputs": [], |
675 | 694 | "source": [ |
|
696 | 715 | }, |
697 | 716 | { |
698 | 717 | "cell_type": "markdown", |
699 | | - "id": "58", |
| 718 | + "id": "60", |
700 | 719 | "metadata": {}, |
701 | 720 | "source": [ |
702 | 721 | "When `TICK` instructions are present, each tick can be shown as a 2D time slice with the `timeslice-svg` diagram. Here, `QUBIT_COORDS` annotations can be used to specify the 2D coordinates of the qubits." |
|
705 | 724 | { |
706 | 725 | "cell_type": "code", |
707 | 726 | "execution_count": null, |
708 | | - "id": "59", |
| 727 | + "id": "61", |
709 | 728 | "metadata": {}, |
710 | 729 | "outputs": [], |
711 | 730 | "source": [ |
|
714 | 733 | }, |
715 | 734 | { |
716 | 735 | "cell_type": "markdown", |
717 | | - "id": "60", |
| 736 | + "id": "62", |
718 | 737 | "metadata": {}, |
719 | 738 | "source": [ |
720 | 739 | "With the `pyzx` argument, the circuit can be visualized using the [pyzx](https://github.com/zxcalc/pyzx) as a ZX-diagram." |
|
723 | 742 | { |
724 | 743 | "cell_type": "code", |
725 | 744 | "execution_count": null, |
726 | | - "id": "61", |
| 745 | + "id": "63", |
727 | 746 | "metadata": {}, |
728 | 747 | "outputs": [], |
729 | 748 | "source": [ |
|
732 | 751 | }, |
733 | 752 | { |
734 | 753 | "cell_type": "markdown", |
735 | | - "id": "62", |
| 754 | + "id": "64", |
736 | 755 | "metadata": {}, |
737 | 756 | "source": [ |
738 | 757 | "The `pyzx-meas` and `pyzx-dets` diagrams show ZX diagrams where outputs represent probabilities of measurement outcomes for measurement and detector/observables, respectively." |
|
741 | 760 | { |
742 | 761 | "cell_type": "code", |
743 | 762 | "execution_count": null, |
744 | | - "id": "63", |
| 763 | + "id": "65", |
745 | 764 | "metadata": {}, |
746 | 765 | "outputs": [], |
747 | 766 | "source": [ |
|
751 | 770 | { |
752 | 771 | "cell_type": "code", |
753 | 772 | "execution_count": null, |
754 | | - "id": "64", |
| 773 | + "id": "66", |
755 | 774 | "metadata": {}, |
756 | 775 | "outputs": [], |
757 | 776 | "source": [ |
|
760 | 779 | }, |
761 | 780 | { |
762 | 781 | "cell_type": "markdown", |
763 | | - "id": "65", |
| 782 | + "id": "67", |
764 | 783 | "metadata": {}, |
765 | 784 | "source": [ |
766 | 785 | "## Detector Error Models\n", |
|
771 | 790 | { |
772 | 791 | "cell_type": "code", |
773 | 792 | "execution_count": null, |
774 | | - "id": "66", |
| 793 | + "id": "68", |
775 | 794 | "metadata": {}, |
776 | 795 | "outputs": [], |
777 | 796 | "source": [ |
|
0 commit comments