ブログ
8
November
,
2021

Circuit of the month Nov 21: Fun with State Preparations

記事をシェア
ライブラリ

State preparations are often an important first step in many quantum algorithms. This month, we explore a circuit designed to load probability mass functions into five groups of three qubits each.

The unique angle here is how the Classiq platform generates the circuit when given a different number of qubits to work with.

In the first instance, we ask the synthesis platform to achieve this goal with 20 qubits. After automatically exploring many options, the engine decides that a good solution would be to split the 20 qubits into five groups of four qubits each. In each group, three qubits are initialized and the fourth qubit is used as an ancilla/auxiliary qubit.

Things get more interesting when the Classiq engine is asked to find a solution with 16 qubits. In this case, five groups of four qubits each is not possible. What the engine generates is a solution using the following steps:

  • First, four groups of three qubits are initialized (each using an ancilla qubit)
  • Then, the four ancialla qubits (one from each group) are cleaned up
  • Now, to take care of the last group of three qubits, not yet initialized, three of these four qubits (previously used as ancilla qubits for the previous groups) are initialized using the fourth qubit as ancilla

Here is the Classiq code for the 20-qubit case. This is the textual model, which one could run in the VSCode environment:


{
    "qubit_count":  20,
    "max_depth":1000,
    "draw_as_functions": false,
    "output_format": ["qasm"],
    "logic_flow": [{
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.05, 0.3, 0.0, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.3}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.05, 0.0, 0.3, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.32}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.0, 0.05, 0.3, 0.0, 0.2, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.32}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.0, 0.2, 0.05, 0.3, 0.0, 0.0, 0.05]
            },
            "error_metric": {"KL": {"upper_bound": 0.34}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.0, 0.35, 0.0, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.3}}
        },
        "add_as_single_gate": true
    }
]
}

 

and here is the resulting circuit. You can see that all the five groups (three qubits each) are initialized in parallel

20-qubit circuit

 

To explore the 16-qubit solution, a single line needs to change:


{
    "qubit_count":  16, // <-- this is the only line that has changed
    "max_depth":1000,
    "draw_as_functions": false,
    "output_format": ["qasm"],
    "logic_flow": [{
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.05, 0.3, 0.0, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.3}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.05, 0.0, 0.3, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.32}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.0, 0.05, 0.3, 0.0, 0.2, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.32}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.0, 0.2, 0.05, 0.3, 0.0, 0.0, 0.05]
            },
            "error_metric": {"KL": {"upper_bound": 0.34}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.0, 0.35, 0.0, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.3}}
        },
        "add_as_single_gate": true
    }
]
}

 

And here is the resulting circuit. You can see that qubits 3, 7, 11 and 15 are used after finishing the state preparation of qubits 0-2, 4-6, 8-10 and 12-14:

16-qubit solution

 

The Classiq platform not only allows designers to explore various options, but finds innovative solutions automatically.

 

State preparations are often an important first step in many quantum algorithms. This month, we explore a circuit designed to load probability mass functions into five groups of three qubits each.

The unique angle here is how the Classiq platform generates the circuit when given a different number of qubits to work with.

In the first instance, we ask the synthesis platform to achieve this goal with 20 qubits. After automatically exploring many options, the engine decides that a good solution would be to split the 20 qubits into five groups of four qubits each. In each group, three qubits are initialized and the fourth qubit is used as an ancilla/auxiliary qubit.

Things get more interesting when the Classiq engine is asked to find a solution with 16 qubits. In this case, five groups of four qubits each is not possible. What the engine generates is a solution using the following steps:

  • First, four groups of three qubits are initialized (each using an ancilla qubit)
  • Then, the four ancialla qubits (one from each group) are cleaned up
  • Now, to take care of the last group of three qubits, not yet initialized, three of these four qubits (previously used as ancilla qubits for the previous groups) are initialized using the fourth qubit as ancilla

Here is the Classiq code for the 20-qubit case. This is the textual model, which one could run in the VSCode environment:


{
    "qubit_count":  20,
    "max_depth":1000,
    "draw_as_functions": false,
    "output_format": ["qasm"],
    "logic_flow": [{
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.05, 0.3, 0.0, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.3}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.05, 0.0, 0.3, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.32}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.0, 0.05, 0.3, 0.0, 0.2, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.32}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.0, 0.2, 0.05, 0.3, 0.0, 0.0, 0.05]
            },
            "error_metric": {"KL": {"upper_bound": 0.34}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.0, 0.35, 0.0, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.3}}
        },
        "add_as_single_gate": true
    }
]
}

 

and here is the resulting circuit. You can see that all the five groups (three qubits each) are initialized in parallel

20-qubit circuit

 

To explore the 16-qubit solution, a single line needs to change:


{
    "qubit_count":  16, // <-- this is the only line that has changed
    "max_depth":1000,
    "draw_as_functions": false,
    "output_format": ["qasm"],
    "logic_flow": [{
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.05, 0.3, 0.0, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.3}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.05, 0.0, 0.3, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.32}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.0, 0.05, 0.3, 0.0, 0.2, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.32}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.0, 0.2, 0.05, 0.3, 0.0, 0.0, 0.05]
            },
            "error_metric": {"KL": {"upper_bound": 0.34}}
        },
        "add_as_single_gate": true
    },
    {
        "function": "StatePreparation",
        "function_params": {
            "num_qubits": 4,
            "probabilities": {
                "pmf": [0.4, 0.05, 0.2, 0.0, 0.35, 0.0, 0.0, 0.0]
            },
            "error_metric": {"KL": {"upper_bound": 0.3}}
        },
        "add_as_single_gate": true
    }
]
}

 

And here is the resulting circuit. You can see that qubits 3, 7, 11 and 15 are used after finishing the state preparation of qubits 0-2, 4-6, 8-10 and 12-14:

16-qubit solution

 

The Classiq platform not only allows designers to explore various options, but finds innovative solutions automatically.

 

"Qubit Guyのポッドキャスト "について

The Qubit Guy(弊社最高マーケティング責任者ユヴァル・ボーガー)がホストを務めるこのポッドキャストは、量子コンピューティングのオピニオンリーダーをゲストに迎え、量子コンピューティングのエコシステムに影響を与えるビジネスや技術的な疑問について議論します。ゲストは、量子コンピュータのソフトウェアやアルゴリズム、量子コンピュータのハードウェア、量子コンピューティングの主要なアプリケーション、量子産業の市場調査などについて興味深いインサイトを提供します。

ポッドキャストへのゲスト推薦をご希望の方は、こちらまでご連絡ください

さらに見る

見つかりませんでした。

量子ソフトウェア開発を開始

お問い合わせ