Skip to content

GHZ State Preparation

Use the GHZStatePreparation function to create a Greenberger-Horne-Zeilinger (GHZ) state. i.e., a balanced superposition of all ones and all zeros, on an arbitrary number of qubits (three by default).

Syntax

Function: GHZStatePreparation

Parameters:

  • num_qubits: int
{
  "functions": [
    {
      "name": "main",
      "body": [
        {
          "function": "GHZStatePreparation",
          "function_params": {
              "num_qubits": 5
          }
        }
      ]
    }
  ]
}
from classiq import Model
from classiq.builtin_functions import GHZStatePreparation

model = Model()
params = GHZStatePreparation(num_qubits=5)
model.GHZStatePreparation(params)