Program#
- class Program(instructions: Optional[list] = None)#
The class representing the quantum program.
A Program object can be used with the with statement. In this context all the instructions could be specified.
Example usage:
import numpy as np import piquasso as pq with pq.Program() as program: pq.Q() | pq.Vacuum() pq.Q(0, 1) | pq.Squeezing(r=0.5) simulator = pq.GaussianSimulator(d=5) result = simulator.execute(program)
- Parameters
instructions (list[Instruction], optional) – The set of instructions, e.g. quantum gates and measurements.
- classmethod from_dict(dict_: dict) piquasso.api.program.Program #
Creates a Program instance from a dict.
The currently supported format is:
{ "instructions": [ { "type": <INSTRUCTION_CLASS_NAME>, "attributes": { "constructor_kwargs": <CONSTRUCTOR_KWARGS_IN_DICT_FORMAT>, "modes": <LIST_OF_MODES> } } ] }
- load_blackbird(filename: str) None #
Loads the gates to be applied into
instructions
from a BlackBird file (.xbb).- Parameters
filename (str) – Location of a Blackbird program (.xbb).
- loads_blackbird(string: str) None #
Loads the gates to apply into
instructions
from a string representing aBlackbirdProgram
.- Parameters
string (str) – String containing a valid Blackbird program.