Skip to content

W State Preparation

The WStatePreparation function allows for an easy creation of a W state.

Syntax

Function: WStatePreparation

Parameters:

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

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