Skip to content

Computational Basis State Preparation

Use the ComputationalBasisStatePreparation function to create computational basis states, i.e., states specified by binary strings. Its usage in quantum programs is similar to that of StatePreparation, and so is its syntax.

Syntax

Function: ComputationalBasisStatePreparation

Parameters:

  • computational_state: [str]
{
  "functions": [
    {
      "name": "main",
      "body": [
        {
          "function": "ComputationalBasisStatePreparation",
          "function_params": {
              "computational_state": "10011101"
          }
        }
      ]
    }
  ]
}
from classiq import Model
from classiq.builtin_functions import ComputationalBasisStatePreparation

model = Model()
params = ComputationalBasisStatePreparation(computational_state="10011101")
model.ComputationalBasisStatePreparation(params)