We're celebrating World Quantum Day 2022! Join us

cirq_google.engine.AbstractLocalProgram

A quantum program designed for local in-memory computation.

Inherits From: AbstractProgram

This implements all the methods in AbstractProgram using in-memory objects. Labels, descriptions, and time are all stored using dictionaries.

This is a partially implemented instance. Inheritors will still need to implement abstract methods.

Methods

add_job

View source

add_labels

View source

Adds new labels to a previously created quantum program.

Params:

  • labels: New labels to add to the existing program labels.

Returns
This AbstractProgram.

batch_size

View source

Returns the number of programs in a batch program.

create_time

View source

Returns when the program was created.

delete

View source

Deletes a previously created quantum program.

Params:

  • delete_jobs: If True will delete all the program's jobs, other this will fail if the program contains any jobs.

delete_job

View source

Removes a child job from this program.

description

View source

Returns the description of the program.

engine

View source

Returns the parent Engine object.

Returns
The program's parent Engine.

get_circuit

View source

Returns the cirq Circuit for the program. This is only supported if the program was created with the V2 protos.

Args
program_num if this is a batch program, the index of the circuit in the batch. This argument is zero-indexed. Negative values indexing from the end of the list.

Returns
The program's cirq Circuit.

get_job

View source

Returns an AbstractLocalJob for an existing Quantum Engine job.

Args
job_id Unique ID of the job within the parent program.

Returns
A AbstractLocalJob for this program.

Raises
KeyError if job is not found.

labels

View source

Returns the labels of the program.

list_jobs

View source

Returns the list of jobs for this program.

Args
created_after retrieve jobs that were created after this date or time.
created_before retrieve jobs that were created before this date or time.
has_labels retrieve jobs that have labels on them specified by this dict. If the value is set to *, filters having the label regardless of the label value will be filtered. For example, to query programs that have the shape label and have the color label with value red can be queried using

{'color': 'red', 'shape':'*'}

execution_states retrieve jobs that have an execution state that is contained in execution_states. See quantum.enums.ExecutionStatus.State enum for accepted values.

remove_labels

View source

Removes labels with given keys from the labels of a previously created quantum program.

Params:

  • label_keys: Label keys to remove from the existing program labels.

Returns
This AbstractProgram.

set_description

View source

Sets the description of the program.

Params:

  • description: The new description for the program.

Returns
This AbstractProgram.

set_labels

View source

Sets (overwriting) the labels for a previously created quantum program.

Params:

  • labels: The entire set of new program labels.

Returns
This AbstractProgram.

update_time

View source

Returns when the program was last updated.